diff --git a/UAV-ControlSystem/src/drivers/arduino_com.c b/UAV-ControlSystem/src/drivers/arduino_com.c index 8e1394d..594ff57 100644 --- a/UAV-ControlSystem/src/drivers/arduino_com.c +++ b/UAV-ControlSystem/src/drivers/arduino_com.c @@ -11,32 +11,40 @@ #include "string.h" #include "stm32f4xx_revo.h" +#define COMPASS_PACKET_SIZE 8 +#define GPS_PACKET_SIZE 10 + + usart_dma_profile dmaHandler; dma_usart_return raw_dma_data_t; +// enumeration to hold the id:s of the different packages enum packet_ids { COMPASS_PACKET_ID = 0xA1, GPS_PACKET_ID = 0xB1, }; +// Structure used to hold the data for "data_arr" typedef struct arduino_data_t { uint8_t size; //Size of the data void * dataPtr; //pointer to the data } arduino_data_t ; +// An enumeration of the array positions of the data in the "data_arr" enum arduino_data_e { COMPASS_DATA_ID, GPS_DATA_ID, ARDUINO_DATA_COUNT, }; +// An array to hold the pointers to the different data structures that are used in the rest of the system; arduino_data_t data_arr[ARDUINO_DATA_COUNT] = { [COMPASS_DATA_ID] = { - .size = 8, + .size = COMPASS_PACKET_SIZE, .dataPtr = &compass_data, }, [GPS_DATA_ID] = { - .size = 10, + .size = GPS_PACKET_SIZE, .dataPtr = &gps_data, }, };