![](/media/cache/profiles/profile_pic_for_github_less_than_1MB.jpg.50x50_q85.jpg)
This is example code that can get you started with building your own IR vision robot that communicates over LoRa
Dependencies: Adafruit-MotorShield Adafruit-PWM-Servo-Driver Adafruit_GFX BufferedSerial MAX17055_EZconfig NEO-6m-GPS SX1276GenericLib USBDeviceHT max32630fthr max77650_charger_sample
Fork of MAX326xxFTHR_LoRa_Example_test by
Diff: global_buffers.h
- Revision:
- 28:0ed92c590607
- Parent:
- 27:6b549f838f0a
- Child:
- 41:1381a49e019e
diff -r 6b549f838f0a -r 0ed92c590607 global_buffers.h --- a/global_buffers.h Fri Jul 20 21:29:53 2018 +0000 +++ b/global_buffers.h Mon Jul 23 23:39:35 2018 +0000 @@ -19,14 +19,12 @@ */ #ifndef __GLOBAL_BUFFERS_H__ -#define __GLOBAL_BUFFERS_H__ +#define __GLOBAL_BUFFERS_H__\ #include "mbed.h" -#include "global_buffer_declarations.h" #include "GenericPingPong.h" - /*************************************************************************** * Indexes for which byte specific data begins at in the payload buffer **************************************************************************/ @@ -47,10 +45,11 @@ * the payload so we can instatiate the correct buffer sizes to store data that * is to be delivered and for data that is received. */ + const uint16_t PAYLOAD_BUFFER_SIZE_MASTER_TO_SLAVE = size_signature + size_of_ble; const uint16_t PAYLOAD_BUFFER_SIZE_SLAVE_TO_MASTER = size_signature + size_of_grid_eye + size_of_gps + size_of_MAX17055 + size_of_MAX77650; -/* determine the appropriate buffer sizes for each device in master/slave config */ +/* determine the appropriate buffer sizes */ #if defined(TARGET_MAX32630FTHR) // Master Device: Bluetooth Gateway const uint16_t BufferSizeTx = PAYLOAD_BUFFER_SIZE_MASTER_TO_SLAVE; const uint16_t BufferSizeRx = PAYLOAD_BUFFER_SIZE_SLAVE_TO_MASTER; @@ -85,33 +84,67 @@ #endif +/*************************************************************************** + * BLE Data Buffers + **************************************************************************/ +#if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway + static char curr_ble_data_to_slave[size_of_ble]; +#elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot + static char curr_ble_data_from_master[size_of_ble]; + static char prev_ble_data_from_master[size_of_ble]; +#endif +/*************************************************************************** + * Grid Eye Sensor Data Buffers + **************************************************************************/ #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway -void createAliasesForGlobalBufs(uint8_t * BufferTx_, - uint8_t * BufferRx_, - uint8_t * curr_ble_data_to_slave_, - char * curr_raw_frame_data_from_slave_, - uint8_t * curr_gps_data_from_slave_, - uint8_t * curr_MAX17055_from_slave_, - uint8_t * curr_MAX77650_from_slave_); + static char curr_raw_frame_data_from_slave[size_of_grid_eye]; + static char prev_raw_frame_data_from_slave[size_of_grid_eye]; + static int16_t conv_frame_data_from_slave[64]; +#elif defined(TARGET_MAX32620FTHR) // Client Device: LoRa Controlled Robot + static char curr_raw_frame_data_to_master[size_of_grid_eye]; + static char prev_raw_frame_data_to_master[size_of_grid_eye]; + static int16_t conv_frame_data_to_master[64]; +#endif + +/*************************************************************************** + * GPS Data Buffers + **************************************************************************/ +#if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway + static char curr_gps_data_from_slave[size_of_gps]; + static char prev_gps_data_from_slave[size_of_gps]; #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot -void createAliasesForGlobalBufs(uint8_t * BufferTx_, - uint8_t * BufferRx_, - uint8_t * curr_ble_data_from_master_, - char * curr_raw_frame_data_to_master_, - uint8_t * curr_gps_data_to_master_, - uint8_t * curr_MAX17055_to_master_, - uint8_t * curr_MAX77650_to_master_); + static char curr_gps_data_to_master[size_of_gps]; +#endif + +/*************************************************************************** + * MAX17055 Data Buffers + **************************************************************************/ +#if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway + static char curr_MAX17055_from_slave[size_of_MAX17055]; + static char prev_MAX17055_from_slave[size_of_MAX17055]; +#elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot + static char curr_MAX17055_to_master[size_of_MAX17055]; +#endif + +/*************************************************************************** + * MAX77650 Data Buffers + **************************************************************************/ +#if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway + static char curr_MAX77650_from_slave[size_of_MAX77650]; + static char prev_MAX77650_from_slave[size_of_MAX77650]; +#elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot + static char curr_MAX77650_to_master[size_of_MAX77650]; #endif /** * @brief This function constructs a payload buffer that is used in transmitting data in a LoRa Message */ -void fillPayloadWithGlobalBufs(); +void fillPayloadWithGlobalBufs(uint8_t * payload_buffer_tx); /** * @brief This function deconstructs a payload buffer that contains data from a received LoRa Message */ -void fillGlobalBufsWithPayload(); +void fillGlobalBufsWithPayload(uint8_t * payload_buffer_rx); #endif // __GLOBAL_BUFFERS_H__ \ No newline at end of file