TactiltyC: Add enum warnings, none modulation in radio
This commit is contained in:
parent
c8a8816bd9
commit
166963288b
@ -17,6 +17,7 @@ enum RadioState {
|
||||
};
|
||||
|
||||
enum Modulation {
|
||||
MODULATION_NONE,
|
||||
MODULATION_LORA,
|
||||
MODULATION_FSK,
|
||||
MODULATION_LRFHSS
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "Tactility/hal/Device.h"
|
||||
#include "Tactility/hal/radio/RadioDevice.h"
|
||||
|
||||
auto constexpr TAG = "tt_hal_radio";
|
||||
|
||||
static RadioState fromCpp(tt::hal::radio::RadioDevice::State state);
|
||||
static tt::hal::radio::RadioDevice::State toCpp(RadioState state);
|
||||
@ -162,6 +163,7 @@ static RadioState fromCpp(tt::hal::radio::RadioDevice::State state) {
|
||||
case tt::hal::radio::RadioDevice::State::Off:
|
||||
return RADIO_OFF;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", state);
|
||||
tt_crash("Radio state not supported");
|
||||
}
|
||||
}
|
||||
@ -179,12 +181,15 @@ static tt::hal::radio::RadioDevice::State toCpp(RadioState state) {
|
||||
case RADIO_OFF:
|
||||
return tt::hal::radio::RadioDevice::State::Off;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", state);
|
||||
tt_crash("Radio state not supported");
|
||||
}
|
||||
}
|
||||
|
||||
static Modulation fromCpp(tt::hal::radio::RadioDevice::Modulation modulation) {
|
||||
switch (modulation) {
|
||||
case tt::hal::radio::RadioDevice::Modulation::None:
|
||||
return MODULATION_NONE;
|
||||
case tt::hal::radio::RadioDevice::Modulation::LoRa:
|
||||
return MODULATION_LORA;
|
||||
case tt::hal::radio::RadioDevice::Modulation::Fsk:
|
||||
@ -192,12 +197,15 @@ static Modulation fromCpp(tt::hal::radio::RadioDevice::Modulation modulation) {
|
||||
case tt::hal::radio::RadioDevice::Modulation::LrFhss:
|
||||
return MODULATION_LRFHSS;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", modulation);
|
||||
tt_crash("Modulation not supported");
|
||||
}
|
||||
}
|
||||
|
||||
static tt::hal::radio::RadioDevice::Modulation toCpp(Modulation modulation) {
|
||||
switch (modulation) {
|
||||
case MODULATION_NONE:
|
||||
return tt::hal::radio::RadioDevice::Modulation::None;
|
||||
case MODULATION_LORA:
|
||||
return tt::hal::radio::RadioDevice::Modulation::LoRa;
|
||||
case MODULATION_FSK:
|
||||
@ -205,6 +213,7 @@ static tt::hal::radio::RadioDevice::Modulation toCpp(Modulation modulation) {
|
||||
case MODULATION_LRFHSS:
|
||||
return tt::hal::radio::RadioDevice::Modulation::LrFhss;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", modulation);
|
||||
tt_crash("Modulation not supported");
|
||||
}
|
||||
}
|
||||
@ -234,6 +243,7 @@ static RadioParameter fromCpp(tt::hal::radio::RadioDevice::Parameter parameter)
|
||||
case tt::hal::radio::RadioDevice::Parameter::NarrowGrid:
|
||||
return RADIO_NARROWGRID;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", parameter);
|
||||
tt_crash("Parameter not supported");
|
||||
}
|
||||
}
|
||||
@ -263,6 +273,7 @@ static tt::hal::radio::RadioDevice::Parameter toCpp(RadioParameter parameter) {
|
||||
case RADIO_NARROWGRID:
|
||||
return tt::hal::radio::RadioDevice::Parameter::NarrowGrid;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", parameter);
|
||||
tt_crash("Parameter not supported");
|
||||
}
|
||||
}
|
||||
@ -276,6 +287,7 @@ static RadioParameterStatus fromCpp(tt::hal::radio::RadioDevice::ParameterStatus
|
||||
case tt::hal::radio::RadioDevice::ParameterStatus::Success:
|
||||
return RADIO_PARAM_SUCCESS;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", status);
|
||||
tt_crash("Parameter status not supported");
|
||||
}
|
||||
}
|
||||
@ -289,6 +301,7 @@ static tt::hal::radio::RadioDevice::ParameterStatus toCpp(RadioParameterStatus s
|
||||
case RADIO_PARAM_SUCCESS:
|
||||
return tt::hal::radio::RadioDevice::ParameterStatus::Success;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", status);
|
||||
tt_crash("Parameter status not supported");
|
||||
}
|
||||
}
|
||||
@ -306,6 +319,7 @@ static RadioTxState fromCpp(tt::hal::radio::RadioDevice::TransmissionState state
|
||||
case tt::hal::radio::RadioDevice::TransmissionState::Error:
|
||||
return RADIO_TX_ERROR;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", state);
|
||||
tt_crash("Transmission state not supported");
|
||||
}
|
||||
}
|
||||
@ -323,6 +337,7 @@ static tt::hal::radio::RadioDevice::TransmissionState toCpp(RadioTxState state)
|
||||
case RADIO_TX_ERROR:
|
||||
return tt::hal::radio::RadioDevice::TransmissionState::Error;
|
||||
default:
|
||||
TT_LOG_W(TAG, "Unknown enum \"%d\" passed!", state);
|
||||
tt_crash("Transmission state not supported");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user