Update config.h

This commit is contained in:
Daniël Koek 2024-03-29 13:25:41 +00:00
parent a861025cbd
commit 4e6f3d7c86

View file

@ -10,39 +10,39 @@ namespace ebyte_lora {
enum ENABLE_BYTE { ENABLED = 0b1, DISABLED = 0b0 }; enum ENABLE_BYTE { ENABLED = 0b1, DISABLED = 0b0 };
enum AIR_DATA_RATE { enum AIR_DATA_RATE {
_2_4kb = 0b000, AIR_2_4kb = 0b000,
_4_8kb = 0b011, AIR_4_8kb = 0b011,
_9_6kb = 0b100, AIR_9_6kb = 0b100,
_19_2kb = 0b101, AIR_19_2kb = 0b101,
_38_4kb = 0b110, AIR_38_4kb = 0b110,
_62_5kb = 0b111 AIR_62_5kb = 0b111
}; };
enum UART_BPS_SPEED { enum UART_BPS_SPEED {
_1200 = 0b000, UART_1200 = 0b000,
_2400 = 0b001, UART_2400 = 0b001,
_4800 = 0b010, UART_4800 = 0b010,
_9600 = 0b011, UART_9600 = 0b011,
_19200 = 0b100, UART_19200 = 0b100,
_38400 = 0b101, UART_38400 = 0b101,
_57600 = 0b110, UART_57600 = 0b110,
_115200 = 0b111 UART_115200 = 0b111
}; };
enum UART_PARITY { _8N1 = 0b00, _8O1 = 0b01, _8E1 = 0b10 }; enum UART_PARITY_SETTING { EBYTE_UART_8N1 = 0b00, EBYTE_UART_8O1 = 0b01, EBYTE_UART_8E1 = 0b10 };
struct REG0 { struct REG0 {
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) {
case _2_4kb: case AIR_2_4kb:
return "air_data_rate: 2.4kb"; return "air_data_rate: 2.4kb";
case _4_8kb: case AIR_4_8kb:
return "air_data_rate: 4.8kb"; return "air_data_rate: 4.8kb";
case _9_6kb: case AIR_9_6kb:
return "air_data_rate: 9.6kb"; return "air_data_rate: 9.6kb";
case _19_2kb: case AIR_19_2kb:
return "air_data_rate: 19.2kb"; return "air_data_rate: 19.2kb";
case _38_4kb: case AIR_38_4kb:
return "air_data_rate: 38.4kb"; return "air_data_rate: 38.4kb";
case _62_5kb: case AIR_62_5kb:
return "air_data_rate: 62.5kb"; return "air_data_rate: 62.5kb";
default: default:
return ""; return "";
@ -51,11 +51,11 @@ struct REG0 {
uint8_t parity : 2; uint8_t parity : 2;
std::string parity_description_() { std::string parity_description_() {
switch (this->parity) { switch (this->parity) {
case _8N1: case EBYTE_UART_8N1:
return "uart_parity: 8N1"; return "uart_parity: 8N1";
case _8O1: case EBYTE_UART_8O1:
return "uart_parity: 8O1"; return "uart_parity: 8O1";
case _8E1: case EBYTE_UART_8E1:
return "uart_parity: 8E1"; return "uart_parity: 8E1";
default: default:
return ""; return "";
@ -64,21 +64,21 @@ struct REG0 {
uint8_t uart_baud : 3; uint8_t uart_baud : 3;
std::string uart_baud_description_() { std::string uart_baud_description_() {
switch (this->uart_baud) { switch (this->uart_baud) {
case _1200: case UART_1200:
return "uart_baud: 1200"; return "uart_baud: 1200";
case _2400: case UART_2400:
return "uart_baud: 2400"; return "uart_baud: 2400";
case _4800: case UART_4800:
return "uart_baud: 4800"; return "uart_baud: 4800";
case _9600: case UART_9600:
return "uart_baud: 9600"; return "uart_baud: 9600";
case _19200: case UART_19200:
return "uart_baud: 19200"; return "uart_baud: 19200";
case _38400: case UART_38400:
return "uart_baud: 38400"; return "uart_baud: 38400";
case _57600: case UART_57600:
return "uart_baud: 57600"; return "uart_baud: 57600";
case _115200: case UART_115200:
return "uart_baud: 115200"; return "uart_baud: 115200";
default: default:
return ""; return "";
@ -86,25 +86,25 @@ struct REG0 {
} }
}; };
enum TRANSMISSION_POWER { enum TRANSMISSION_POWER {
_DEFAULT_MAX = 0b00, TX_DEFAULT_MAX = 0b00,
_LOWER = 0b01, TX_LOWER = 0b01,
_EVEN_LOWER = 0b10, TX_EVEN_LOWER = 0b10,
_LOWEST = 0b11 TX_LOWEST = 0b11
}; };
enum SUB_PACKET_SETTING { _200b = 0b00, _128b = 0b01, _64b = 0b10, _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
struct REG1 { struct REG1 {
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) {
case _DEFAULT_MAX: case TX_DEFAULT_MAX:
return "transmission_power: default or max"; return "transmission_power: default or max";
case _LOWER: case TX_LOWER:
return "transmission_power: lower"; return "transmission_power: lower";
case _EVEN_LOWER: case TX_EVEN_LOWER:
return "transmission_power: even lower"; return "transmission_power: even lower";
case _LOWEST: case TX_LOWEST:
return "transmission_power: Lowest"; return "transmission_power: Lowest";
default: default:
return ""; return "";
@ -125,16 +125,16 @@ struct REG1 {
uint8_t sub_packet : 2; uint8_t sub_packet : 2;
std::string sub_packet_description_() { std::string sub_packet_description_() {
switch (this->sub_packet) { switch (this->sub_packet) {
case _200b: case SUB_200b:
return "sub_packet: 200 bytes"; return "sub_packet: 200 bytes";
case _128b: case SUB_128b:
return "sub_packet: 128 bytes"; return "sub_packet: 128 bytes";
case _64b: case SUB_64b:
return "sub_packet: 64 bytes"; return "sub_packet: 64 bytes";
case _32b: case SUB_32b:
return "sub_packet: 32 bytes"; return "sub_packet: 32 bytes";
default: default:
return ""; return "";
@ -143,14 +143,14 @@ struct REG1 {
}; };
enum TRANSMISSION_MODE { TRANSPARENT = 0b0, FIXED = 0b1 }; enum TRANSMISSION_MODE { TRANSPARENT = 0b0, FIXED = 0b1 };
enum WOR_PERIOD { enum WOR_PERIOD {
_500 = 0b000, WOR_500 = 0b000,
_1000 = 0b001, WOR_1000 = 0b001,
_1500 = 0b010, WOR_1500 = 0b010,
_2000 = 0b011, WOR_2000 = 0b011,
_2500 = 0b100, WOR_2500 = 0b100,
_3000 = 0b101, WOR_3000 = 0b101,
_3500 = 0b110, WOR_3500 = 0b110,
_4000 = 0b111 WOR_4000 = 0b111
}; };
// reverse order on the data sheet // reverse order on the data sheet
@ -158,28 +158,21 @@ struct REG3 {
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) {
case _500: case WOR_500:
return "wor_period: 500"; return "wor_period: 500";
case WOR_1000:
case _1000:
return "wor_period: 1000"; return "wor_period: 1000";
case WOR_1500:
case _1500:
return "wor_period: 1500"; return "wor_period: 1500";
case WOR_2000:
case _2000:
return "wor_period: 2000"; return "wor_period: 2000";
case WOR_2500:
case _2500:
return "wor_period: 2500"; return "wor_period: 2500";
case WOR_3000:
case _3000:
return "wor_period: 3000"; return "wor_period: 3000";
case WOR_3500:
case _3500:
return "wor_period: 3500"; return "wor_period: 3500";
case WOR_4000:
case _4000:
return "wor_period: 4000"; return "wor_period: 4000";
default: default:
return ""; return "";
@ -191,10 +184,8 @@ struct REG3 {
switch (this->enable_lbt) { switch (this->enable_lbt) {
case ENABLED: case ENABLED:
return "enable_lbt: ENABLED"; return "enable_lbt: ENABLED";
case DISABLED: case DISABLED:
return "enable_lbt: DISABLED"; return "enable_lbt: DISABLED";
default: default:
} }
} }