Update config.h

This commit is contained in:
Daniël Koek 2024-04-08 18:01:18 +01:00
parent fb79b0a845
commit 7f047d8bd3

View file

@ -28,7 +28,7 @@ enum UART_BPS_SPEED {
UART_115200 = 0b111 UART_115200 = 0b111
}; };
enum UART_PARITY_SETTING { EBYTE_UART_8N1 = 0b00, EBYTE_UART_8O1 = 0b01, EBYTE_UART_8E1 = 0b10 }; enum UART_PARITY_SETTING { EBYTE_UART_8N1 = 0b00, EBYTE_UART_8O1 = 0b01, EBYTE_UART_8E1 = 0b10 };
typedef struct { struct reg_0 {
uint8_t air_data_rate : 3; uint8_t air_data_rate : 3;
std::string air_data_rate_description_() { std::string air_data_rate_description_() {
switch (this->air_data_rate) { switch (this->air_data_rate) {
@ -84,7 +84,7 @@ typedef struct {
return ""; return "";
} }
} }
} __attribute__((packed)) reg_0; } __attribute__((packed));
enum TRANSMISSION_POWER { enum TRANSMISSION_POWER {
TX_DEFAULT_MAX = 0b00, TX_DEFAULT_MAX = 0b00,
TX_LOWER = 0b01, TX_LOWER = 0b01,
@ -94,7 +94,7 @@ enum TRANSMISSION_POWER {
}; };
enum SUB_PACKET_SETTING { SUB_200b = 0b00, SUB_128b = 0b01, SUB_64b = 0b10, SUB_32b = 0b11 }; enum SUB_PACKET_SETTING { SUB_200b = 0b00, SUB_128b = 0b01, SUB_64b = 0b10, SUB_32b = 0b11 };
// again in reverse order on the data sheet // again in reverse order on the data sheet
typedef struct { struct reg_1 {
uint8_t transmission_power : 2; uint8_t transmission_power : 2;
std::string transmission_power_description_() { std::string transmission_power_description_() {
switch (this->transmission_power) { switch (this->transmission_power) {
@ -140,7 +140,7 @@ typedef struct {
return ""; return "";
} }
} }
} __attribute__((packed)) reg_1; } __attribute__((packed));
enum TRANSMISSION_MODE { TRANSPARENT = 0b0, FIXED = 0b1 }; enum TRANSMISSION_MODE { TRANSPARENT = 0b0, FIXED = 0b1 };
enum WOR_PERIOD { enum WOR_PERIOD {
WOR_500 = 0b000, WOR_500 = 0b000,
@ -154,7 +154,7 @@ enum WOR_PERIOD {
}; };
// reverse order on the data sheet // reverse order on the data sheet
typedef struct { struct reg_3 {
uint8_t wor_period : 3; uint8_t wor_period : 3;
std::string wor_period_description_() { std::string wor_period_description_() {
switch (this->wor_period) { switch (this->wor_period) {
@ -213,7 +213,7 @@ typedef struct {
return ""; return "";
} }
} }
} __attribute__((packed)) reg_3; } __attribute__((packed));
typedef struct { typedef struct {
uint8_t command = 0; uint8_t command = 0;
uint8_t starting_address = 0; uint8_t starting_address = 0;
@ -222,12 +222,12 @@ typedef struct {
std::string addh_description_() { return "addh:" + to_string(this->addh); } std::string addh_description_() { return "addh:" + to_string(this->addh); }
uint8_t addl = 0; uint8_t addl = 0;
std::string addl_description_() { return "addl:" + to_string(this->addh); } std::string addl_description_() { return "addl:" + to_string(this->addh); }
reg_0 reg_0; struct reg_0 reg_0;
reg_1 reg_1; struct reg_1 reg_1;
// reg2 // reg2
uint8_t channel; uint8_t channel;
std::string channel_description_() { return "channel: " + to_string(this->channel); } std::string channel_description_() { return "channel: " + to_string(this->channel); }
reg_3 reg_3; struct reg_3 reg_3;
uint8_t crypt_h; uint8_t crypt_h;
uint8_t crypt_l; uint8_t crypt_l;
} __attribute__((packed)) reg_config; } __attribute__((packed)) reg_config;