public RegisterIO(IRegisterIo io_provider, byte update_rate_hz, IIoCompleteNotification notify_sink, IBoardCapabilities board_capabilities) { this.io_provider = io_provider; this.update_rate_hz = update_rate_hz; this.board_capabilities = board_capabilities; this.notify_sink = notify_sink; raw_data_update = new IMUProtocol.GyroUpdate(); ahrs_update = new AHRSProtocol.AHRSUpdate(); ahrspos_update = new AHRSProtocol.AHRSPosUpdate(); board_state = new BoardState(); board_id = new AHRSProtocol.BoardID(); }
const bool debug = false; /* Set to true to enable debug output (to smart dashboard) */ public SerialIO(SerialPort.Port port_id, byte update_rate_hz, bool processed_data, IIoCompleteNotification notify_sink, IBoardCapabilities board_capabilities) { this.serial_port_id = port_id; ypr_update_data = new IMUProtocol.YPRUpdate(); gyro_update_data = new IMUProtocol.GyroUpdate(); ahrs_update_data = new AHRSProtocol.AHRSUpdate(); ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate(); board_id = new AHRSProtocol.BoardID(); board_state = new BoardState(); this.notify_sink = notify_sink; this.board_capabilities = board_capabilities; serial_port = GetMaybeCreateSerialPort(); this.update_rate_hz = update_rate_hz; if (processed_data) { update_type = AHRSProtocol.MSGID_AHRSPOS_UPDATE; } else { update_type = IMUProtocol.MSGID_GYRO_UPDATE; } }