#ifndef PACKETS_STRUCTS #define PACKETS_STRUCTS #include "stdint.h" #define UplinkSync "PlechHore" #define DownlinkSync "PlechDole" #define UplinkPacketType_SystemControl 0 #define UplinkPacketType_Ping 1 #define UplinkPacketType_ACK 255 #define DownlinkPacketType_Telemetry 0 #define DownlinkPacketType_Ping 1 #define DownlinkPacketType_ACK 255 typedef struct __attribute__((packed)) { char syncPhrase[10]; //10 uint32_t packetIndex; //14 uint8_t packetType; //15 uint32_t missionTimer; //19 uint32_t CRCCheck; } DownBoundPacket; typedef struct __attribute__((packed)) { // MPU data int16_t accelerationX;//21 int16_t accelerationY; //23 int16_t accelerationZ;//25 int16_t gyroX;//27 int16_t gyroY;//29 int16_t gyroZ;//31 int16_t magnetX;//33 int16_t magnetY;//35 int16_t magnetZ;//37 int16_t accelerometer_temperature;//39 // CCS data uint16_t eCO2;//41 uint16_t tvoc;//43 uint8_t currentCCS;//44 uint16_t rawCCSData;//46 // INA data uint16_t volts;//48 uint16_t current;//50 uint16_t power;//52 // BME DATA uint32_t temperature;//56 uint16_t humidity;//58 uint32_t pressure;//62 uint16_t gas;//64 bool gas_valid;//later bool heater_stable;//later uint8_t gas_range;//65 uint8_t gas_index;//66 float air_temperature; /*!< air temperature in degrees celsius */ //70 float relative_humidity; /*!< relative humidity in percent */ //74 float barometric_pressure; /*!< barometric pressure in hecto-pascal */ //78 float gas_resistance; /*!< gas resistance in ohms */ //82 uint16_t iaq_score; /*!< air quality index (0..500) */ //84 float temperature_score; //88 float humidity_score; //92 float gas_score; //96 // GPS DATA uint32_t time_seconds; // Seconds since start of day //100 int32_t latitude_centi_degrees; // Latitude * 10,000 //104 int32_t longitude_centi_degrees; // Longitude * 10,000 //108 int16_t altitude_centi_meters; // Altitude * 100 //110 uint8_t fix_quality; //111 uint8_t num_satellites; //112 uint16_t date_yyddmm; // YYDDMM (from GPRMC) //114 uint16_t speed_centi_knots; // Speed * 100 (from GPRMC) //116 int32_t predicted_latitude_centi_degrees; // Latitude * 10,000 //120 int32_t predicted_longitude_centi_degrees; // Longitude * 10,000 //124 int16_t predicted_altitude_centi_meters; // Altitude * 100 //126 // ADC DATA int32_t NH3; //130 int32_t CO; //134 int32_t NO2; //138 int32_t UVC; //142 int16_t currentServoA; //144 int16_t targetServoA; //146 int16_t currentServoB; //148 int16_t targetServoB; //150 uint8_t presentDevices; uint8_t telemetryIndex; //151 } TelemetryPacket; typedef struct __attribute__((packed)) { char syncPhrase[10]; uint32_t packetIndex; uint8_t packetType; uint32_t CRCCheck; } UplinkPacket; typedef struct __attribute__((packed)) { uint8_t powerMode; uint8_t controlMode; uint16_t servoA; uint16_t servoB; } SystemControlPacket; typedef struct __attribute__((packed)) { uint8_t PingData[20]; } PingPacket; typedef struct __attribute__((packed)) { uint32_t packetIndex; uint32_t crc32Checksum; } ACKPacket; #endif