![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
LP Long Distance IR Vision Robot
Dependencies: max77650_charger_sample BufferedSerial SX1276GenericLib Adafruit-MotorShield NEO-6m-GPS MAX17055_EZconfig Adafruit_GFX USBDeviceHT Adafruit-PWM-Servo-Driver
Diff: global_buffers.h
- Revision:
- 27:6b549f838f0a
- Parent:
- 26:69aba05f010f
- Child:
- 28:0ed92c590607
diff -r 69aba05f010f -r 6b549f838f0a global_buffers.h --- a/global_buffers.h Fri Jul 20 16:31:41 2018 +0000 +++ b/global_buffers.h Fri Jul 20 21:29:53 2018 +0000 @@ -19,12 +19,14 @@ */ #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 **************************************************************************/ @@ -82,64 +84,34 @@ const uint8_t rx_idx_ble = rx_idx_signature + size_signature; // 2nd buf in rx payload #endif -/*************************************************************************** - * BLE Data Buffers - **************************************************************************/ - #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway - curr_ble_data_to_slave = new uint8_t[size_of_ble]; - #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot - curr_ble_data_from_master = new uint8_t[size_of_ble]; - prev_ble_data_from_master = new uint8_t[size_of_ble]; - #endif -/*************************************************************************** - * Grid Eye Sensor Data Buffers - **************************************************************************/ - #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway - curr_raw_frame_data_from_slave = new uint8_t[size_of_grid_eye]; - prev_raw_frame_data_from_slave = new uint8_t[size_of_grid_eye]; - conv_frame_data_from_slave = new int16_t[64]; - #elif defined(TARGET_MAX32620FTHR) // Client Device: LoRa Controlled Robot - curr_raw_frame_data_to_master = new uint8_t[size_of_grid_eye]; - prev_raw_frame_data_to_master = new uint8_t[size_of_grid_eye]; - conv_frame_data_to_master = new int16_t[64]; - #endif -/*************************************************************************** - * GPS Data Buffers - **************************************************************************/ - #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway - curr_gps_data_from_slave = new uint8_t[size_of_gps]; - prev_gps_data_from_slave = new uint8_t[size_of_gps]; - #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot - curr_gps_data_to_master = new uint8_t[size_of_gps]; - #endif -/*************************************************************************** - * MAX17055 Data Buffers - **************************************************************************/ - #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway - curr_MAX17055_from_slave = new uint8_t[size_of_MAX17055]; - prev_MAX17055_from_slave = new uint8_t[size_of_MAX17055]; - #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot - curr_MAX17055_to_master = new uint8_t[size_of_MAX17055]; - #endif - -/*************************************************************************** - * MAX77650 Data Buffers - **************************************************************************/ - #if defined(TARGET_MAX32630FTHR) // Master Device: BLE-to-LoRa Gateway - curr_MAX77650_from_slave = new uint8_t[size_of_MAX77650]; - prev_MAX77650_from_slave = new uint8_t[size_of_MAX77650]; - #elif defined(TARGET_MAX32620FTHR) // Slave Device: LoRa Controlled Robot - curr_MAX77650_to_master = new uint8_t[size_of_MAX77650]; - #endif + + +#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_); +#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_); +#endif /** * @brief This function constructs a payload buffer that is used in transmitting data in a LoRa Message */ -void fillPayloadWithGlobalBufs(uint8_t * payload_buffer_tx); +void fillPayloadWithGlobalBufs(); /** * @brief This function deconstructs a payload buffer that contains data from a received LoRa Message */ -void fillGlobalBufsWithPayload(uint8_t * payload_buffer_rx); +void fillGlobalBufsWithPayload(); #endif // __GLOBAL_BUFFERS_H__ \ No newline at end of file