14 #include "../../../src/ISUtilities.h" 15 #include "../../../src/ISLogger.h" 16 #include "../../../hw-libs/misc/bootloaderApp.h" 17 #include "../drivers/d_quadEnc.h" 23 #include "../hw-libs/communications/CAN_comm.h" 24 #include "../src/protocol_nmea.h" 39 #define COM_RX_PORT_COUNT (EVB2_PORT_COUNT-1) // exclude CAN port 53 int comWrite(
int serialNum,
const unsigned char *buf,
int size, uint32_t ledPin )
62 len =
serWrite(serialNum, buf, size);
72 int comRead(
int serialNum,
unsigned char *buf,
int bufSize, uint32_t ledPin)
82 #if 0 // Wait for end of data. Check Rx buffer has data and hasn't change over 1ms. 85 if(used!=0 && used==usedLast[serialNum])
87 len =
serRead(serialNum, buf, bufSize, 0);
89 usedLast[serialNum] =
used;
92 len =
serRead(serialNum, buf, bufSize);
107 uint32_t stopbits, parity, databits;
360 logger.
LogData(0, &dataHdr, data);
398 bool initCbPreset =
false;
399 bool initIOconfig =
false;
400 bool reinitXBee =
false;
401 bool reinitWiFi =
false;
539 switch (messageIdUInt)
556 switch (messageIdUInt)
561 strncmp((
const char*)(&(comm->
buf.
start[6])),
"!!SAM-BA!!", 6) == 0)
585 #define CAN_COM_PORT 1 586 #define CAN_HDR 0xFC; 587 #define CAN_FTR 0xFE; 602 for(uint8_t *ptr=data; dataSize>0; )
757 if(dstCbf == 0 || len==0)
782 if(sendXbee || sendXradio)
784 sendRadio(buf, len, sendXbee, sendXradio);
802 #if 0 // Disabled when forwarding data directly in wifi task 822 #ifdef CONF_BOARD_SERIAL_XBEE // XBee Rx ======================================================= 826 #ifdef CONF_BOARD_SERIAL_EXT_RADIO // External Radio Rx ======================================================= 830 #ifdef CONF_BOARD_SERIAL_ATWINC_BLE // ATWINC BLE Rx ======================================================= 834 #ifdef CONF_BOARD_SERIAL_SP330 // SP330 RS232/RS422 converter Rx ======================================================= 838 #ifdef CONF_BOARD_SERIAL_GPIO_H8 // H8 Header GPIO TTL Rx ======================================================= 842 #ifdef CONF_BOARD_SPI_ATWINC_WIFI // WiFi Rx ======================================================= 846 #ifdef CONF_BOARD_CAN1 881 const size_t xTriggerLevel = 1;
StreamBufferHandle_t g_xStreamBufferWiFiTx
is_comm_instance_t g_commTx
StreamBufferHandle_t g_xStreamBufferWiFiRx
static uint8_t s_rxDecodeBuffer[PKT_BUF_SIZE]
void enable_bootloader(int pHandle)
#define DID_EVB_DEBUG_ARRAY
int serSetBaudRate(int serialNum, int baudrate)
Change USART baudrate. 0 on success, -1 on failure.
uint32_t cbf[EVB2_PORT_COUNT]
#define UNUSED(v)
Marking v as a unused parameter or value.
void(* pfnHandleUinsData)(p_data_hdr_t &dataHdr, uDatasets &data)
int comManagerValidateBaudRate(unsigned int baudRate)
void com_bridge_smart_forward(uint32_t srcPort, uint32_t ledPin)
static void ioport_set_pin_level(ioport_pin_t pin, bool level)
Set an IOPORT pin to a specified logical value.
#define xStreamBufferCreate(xBufferSizeBytes, xTriggerLevelBytes)
int comWrite(int serialNum, const unsigned char *buf, int size, uint32_t ledPin)
#define US_MR_PAR_EVEN
(US_MR) Even parity
#define US_MR_NBSTOP_1_BIT
(US_MR) 1 stop bit
int xbee_runtime_mode(void)
#define UART_XBEE_N_DTR_PIN
void(* pfnHandleHostData)(is_comm_instance_t *comm, protocol_type_t ptype, uint32_t srcPort)
void xbee_step(is_comm_instance_t *comm)
size_t xStreamBufferReceive(StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait) PRIVILEGED_FUNCTION
bool d_usartDMA_callback_cdc_enable(void)
static pfnHandleUinsData s_pfnHandleUinsData
void com_bridge_forward(uint32_t srcPort, uint8_t *buf, int len)
int is_comm_get_data(is_comm_instance_t *instance, uint32_t dataId, uint32_t offset, uint32_t size, uint32_t periodMultiple)
StreamBufferHandle_t g_xStreamBufferUINS
void evbUiRefreshLedCfg()
uint32_t h4xRadioBaudRate
int serRead(int serialNum, unsigned char *buf, int size)
Read data on USART. Returns number of bytes read. With use of the PDCA ring buffer, buffer overrun may occur if bytes are received is greater than bytes read plus buffer size.
char is_comm_copy_to_struct(void *sptr, const is_comm_instance_t *instance, const unsigned int maxsize)
void d_usartDMA_callback_cdc_disable(void)
#define WIFI_SSID_PSK_SIZE
void uINS_stream_enable_PPD(void)
static pfnHandleHostData s_pfnHandleHostData
void sendRadio(uint8_t *data, int dataSize, bool sendXbee, bool sendXrad)
char psk[WIFI_SSID_PSK_SIZE]
int error_check_config(evb_flash_cfg_t *cfg)
#define US_MR_PAR_NO
(US_MR) No parity
void communications_init(void)
uint32_t flash_write_needed
#define CONF_MCAN_ELEMENT_DATA_SIZE
Parity forced to 1 (mark)
comm_rx_port_t g_comRxPort[COM_RX_PORT_COUNT]
void com_bridge_apply_preset(evb_flash_cfg_t *cfg)
void callback_cdc_set_config(uint8_t port, usb_cdc_line_coding_t *cfg)
#define US_MR_NBSTOP_2_BIT
(US_MR) 2 stop bits
bool LogData(unsigned int device, p_data_hdr_t *dataHdr, const uint8_t *dataBuf)
int spiTouINS_serWrite(const unsigned char *buf, int size)
int is_comm_set_data(is_comm_instance_t *instance, uint32_t dataId, uint32_t offset, uint32_t size, void *data)
void comunications_set_uins_data_callback(pfnHandleUinsData pfn)
#define UART_XBEE_N_RTS_PIN
#define STREAM_BUFFER_SIZE
#define US_MR_PAR_MARK
(US_MR) Parity forced to 1 (Mark)
int is_comm_free(is_comm_instance_t *instance)
#define US_MR_CHRL_8_BIT
(US_MR) Character length is 8 bits
#define US_MR_PAR_ODD
(US_MR) Odd parity
uint32_t g_uInsBootloaderEnableTimeMs
#define DATA_CHUNK_MARKER
void callback_cdc_set_dtr(uint8_t port, bool b_enable)
int comRead(int serialNum, unsigned char *buf, int bufSize, uint32_t ledPin)
void uINS_stream_stop_all(void)
void uINS_stream_enable_std(void)
USBInterfaceDescriptor data
union evb_server_t::@40 ipAddr
evb_server_t server[NUM_WIFI_PRESETS]
void is_comm_init(is_comm_instance_t *instance, uint8_t *buffer, int bufferSize)
#define DID_EVB_FLASH_CFG
void comunications_set_host_data_callback(pfnHandleHostData pfn)
void update_flash_cfg(evb_flash_cfg_t &newCfg)
char ssid[WIFI_SSID_PSK_SIZE]
#define EVB_CFG_BITS_IDX_SERVER(bits)
evb_flash_cfg_t * g_flashCfg
void enable_bootloader_assistant(void)
uint32_t flash_write_enable
#define ASCII_MESSAGEID_TO_UINT(c4)
size_t xStreamBufferSend(StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait) PRIVILEGED_FUNCTION
uint8_t mcan_receive_message(uint32_t *id_value, uint8_t *data)
void handle_data_from_host(is_comm_instance_t *comm, protocol_type_t ptype, uint32_t srcPort)
void step_com_bridge(is_comm_instance_t &comm)
void * StreamBufferHandle_t
protocol_type_t is_comm_parse(is_comm_instance_t *instance)
int is_comm_data(is_comm_instance_t *instance, uint32_t dataId, uint32_t offset, uint32_t size, void *data)
Autogenerated API include file for the Atmel Software Framework (ASF)
#define RMC_PRESET_PPD_BITS
Parity forced to 0 (space)
void board_IO_config(void)
nvr_manage_t g_nvr_manage_config
int spiTouINS_serRead(unsigned char *buf, int size)
void log_ublox_raw_to_SD(cISLogger &logger, uint8_t *dataPtr, uint32_t dataSize)
#define US_MR_PAR_SPACE
(US_MR) Parity forced to 0 (Space)
#define COM_RX_PORT_COUNT
void handle_data_from_uINS(p_data_hdr_t &dataHdr, uint8_t *data)
int is_comm_stop_broadcasts_current_port(is_comm_instance_t *instance)
int serRxUsed(int serialNum)
Returns number of bytes used in Rx buffer.
uint32_t can_receive_address
#define EVB_CFG_BITS_IDX_WIFI(bits)
evb_wifi_t wifi[NUM_WIFI_PRESETS]
#define US_MR_NBSTOP_1_5_BIT
(US_MR) 1.5 stop bit (SYNC = 0) or reserved (SYNC = 1)
void log_uINS_data(cISLogger &logger, is_comm_instance_t &comm)
char copyDataPToStructP2(void *sptr, const p_data_hdr_t *dataHdr, const uint8_t *dataBuf, const unsigned int maxsize)
#define DID_EVB_RTOS_INFO
void com_bridge_smart_forward_xstream(uint32_t srcPort, StreamBufferHandle_t xStreamBuffer)
int serWrite(int serialNum, const unsigned char *buf, int size)
Write data on USART. Returns number of bytes written.