diff --git a/src/system/gpio.c b/src/system/gpio.c --- a/src/system/gpio.c +++ b/src/system/gpio.c @@ -109,3 +109,21 @@ void user_input_signed(int32_t* to_modif } } } + +// Increment/decrement signed variable with up/down buttons +void user_input_float(float* to_modify) +{ + //fixme: need to cast to 16/32 bits correctly + if(CHANGE_ELAPSED) { + if(!HAL_GPIO_ReadPin(SW_UP) ) { + CHANGE_RESET; + if (*to_modify < 32768) + (*to_modify)++; + } + else if(!HAL_GPIO_ReadPin(SW_DOWN)) { + CHANGE_RESET; + if (*to_modify >= -32768) + (*to_modify)--; + } + } +}