diff --git a/firmware/request_handlers.h b/firmware/request_handlers.h index 336f8f5..8882c9d 100644 --- a/firmware/request_handlers.h +++ b/firmware/request_handlers.h @@ -1,52 +1,13 @@ -#ifndef REQUESTS_H -#define REQUESTS_H +#ifndef REQUEST_HANDLERS_H +#define REQUEST_HANDLERS_H #include +#include "requests.h" #include "global_vars.h" #include "selftest.h" #include "boardinfo.h" #include "pwm.h" -constexpr static uint8_t RQ_DISC = 0; -constexpr static uint8_t RQ_TEST = 1; -constexpr static uint8_t RQ_INFO = 2; -constexpr static uint8_t RQ_INT = 3; -constexpr static uint8_t RQ_ST = 4; -constexpr static uint8_t RQ_BA0 = 5; -constexpr static uint8_t RQ_BA1 = 6; -constexpr static uint8_t RQ_BE0 = 7; -constexpr static uint8_t RQ_BE1 = 8; -constexpr static uint8_t RQ_DSW = 9; -constexpr static uint8_t RQ_AA0 = 10; -constexpr static uint8_t RQ_AA1 = 11; -constexpr static uint8_t RQ_ADC = 12; -constexpr static uint8_t RQ_ADC_DAC_STROKE = 13; -constexpr static uint8_t RQ_PWM_SET_FREQ = 14; -constexpr static uint8_t RQ_PWM_SET_VALUE = 15; -constexpr static uint8_t RQ_SET_REG = 16; -constexpr static uint8_t RQ_GET_REG = 17; - -uint8_t const rq_len[] = { - /* RQ_DISC */ 1, - /* RQ_TEST */ 2, - /* RQ_INFO */ 1, - /* RQ_INT */ 3, - /* RQ_ST */ 1, - /* RQ_BA0 */ 2, - /* RQ_BA1 */ 2, - /* RQ_BE0 */ 1, - /* RQ_BE1 */ 1, - /* RQ_DSW */ 1, - /* RQ_AA0 */ 3, - /* RQ_AA1 */ 3, - /* RQ_ADC */ 2, - /* RQ_ADC_DAC_STROKE */ 9, - /* RQ_PWM_SET_FREQ */ 5, - /* RQ_PWM_SET_VALUE */ 2, - /* RQ_SET_REG */ 3, - /* RQ_GET_REG */ 2 -}; - /** * Hauptfunktion für die Verarbeitung einer neuen empfangen Request */ @@ -72,4 +33,4 @@ void rqPwmSetValue(void); void rqSetRegister(void); void rqGetRegister(void); -#endif // REQUESTS_H +#endif // REQUEST_HANDLERS_H diff --git a/firmware/requests.h b/firmware/requests.h new file mode 100644 index 0000000..c17727b --- /dev/null +++ b/firmware/requests.h @@ -0,0 +1,44 @@ +#ifndef REQUESTS_H +#define REQUESTS_H + +constexpr static uint8_t RQ_DISC = 0; +constexpr static uint8_t RQ_TEST = 1; +constexpr static uint8_t RQ_INFO = 2; +constexpr static uint8_t RQ_INT = 3; +constexpr static uint8_t RQ_ST = 4; +constexpr static uint8_t RQ_BA0 = 5; +constexpr static uint8_t RQ_BA1 = 6; +constexpr static uint8_t RQ_BE0 = 7; +constexpr static uint8_t RQ_BE1 = 8; +constexpr static uint8_t RQ_DSW = 9; +constexpr static uint8_t RQ_AA0 = 10; +constexpr static uint8_t RQ_AA1 = 11; +constexpr static uint8_t RQ_ADC = 12; +constexpr static uint8_t RQ_ADC_DAC_STROKE = 13; +constexpr static uint8_t RQ_PWM_SET_FREQ = 14; +constexpr static uint8_t RQ_PWM_SET_VALUE = 15; +constexpr static uint8_t RQ_SET_REG = 16; +constexpr static uint8_t RQ_GET_REG = 17; + +uint8_t const rq_len[] = { + /* RQ_DISC */ 1, + /* RQ_TEST */ 2, + /* RQ_INFO */ 1, + /* RQ_INT */ 3, + /* RQ_ST */ 1, + /* RQ_BA0 */ 2, + /* RQ_BA1 */ 2, + /* RQ_BE0 */ 1, + /* RQ_BE1 */ 1, + /* RQ_DSW */ 1, + /* RQ_AA0 */ 3, + /* RQ_AA1 */ 3, + /* RQ_ADC */ 2, + /* RQ_ADC_DAC_STROKE */ 9, + /* RQ_PWM_SET_FREQ */ 5, + /* RQ_PWM_SET_VALUE */ 2, + /* RQ_SET_REG */ 3, + /* RQ_GET_REG */ 2 +}; + +#endif // REQUESTS_H