Skip to content

Commit 80c56e9

Browse files
committed
Definition of type_55 message for accelerometer data
squash me message definition
1 parent 4e9bb4b commit 80c56e9

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

  • microSWIFT_V2.2/Core/Inc

microSWIFT_V2.2/Core/Inc/sbd.h

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
#include "time.h"
1313
#include "NEDWaves/rtwhalf.h"
14+
#include <stdint.h>
15+
1416
#define TYPE_99_CHAR_BUF_LEN 320
1517
#define IRIDIUM_SBD_MAX_LENGTH 340
1618
#define TELEMETRY_FIELD_ERROR_CODE (0x70E2)
@@ -118,6 +120,58 @@ typedef struct __packed
118120
iridium_checksum_t checksum;
119121
} sbd_message_type_54;
120122

123+
// Definition for accelerometer waves message; based heavily on type_52 for the
124+
// waves component.
125+
typedef struct __packed
126+
{
127+
char legacy_number_7; // byte 0
128+
uint8_t type; // Used by swift code to determine how to parse bytes
129+
// 1 byte required here for compatibility.
130+
// Historically, swift messages used this for port, and microSWIFT has
131+
// started using it for firmware version.
132+
uint8_t version;
133+
uint16_t size;
134+
135+
uint32_t timestamp; // byte 5-8
136+
137+
float latitude; // byte 9-12
138+
float longitude; // byte 13-16
139+
140+
// Bytes 17-27 are reserved for planned wake-on-shake support
141+
uint8_t reserved01;
142+
uint16_t reserved02;
143+
uint8_t reserved03;
144+
int16_t reserved04;
145+
int16_t reserved05;
146+
int16_t reserved06;
147+
uint8_t reserved07;
148+
149+
real16_T min_x_accel; // bytes 28-29
150+
real16_T max_x_accel;
151+
real16_T mean_x_accel;
152+
153+
real16_T min_y_accel; // bytes 34-35
154+
real16_T max_y_accel;
155+
real16_T mean_y_accel;
156+
157+
real16_T min_z_accel; // bytes 40-41
158+
real16_T max_z_accel;
159+
real16_T mean_z_accel;
160+
161+
real16_T x_spectra[48];
162+
real16_T y_spectra[48];
163+
real16_T z_spectra[48];
164+
165+
real16_T min_freq;
166+
real16_T max_freq;
167+
168+
// 2 bytes for the checksum; this MUST be the final element in the struct,
169+
// since the iridium thread calculates the checksum and calls memcpy on
170+
// payload[sizeof(sbd_message_type_55) - IRIDIUM_CHECKSUM_LENGTH]
171+
iridium_checksum_t checksum;
172+
173+
} sbd_message_type_55;
174+
121175
typedef struct
122176
{
123177
char message_body[TYPE_99_CHAR_BUF_LEN];

0 commit comments

Comments
 (0)