[main] add macros for checking specific buttons
This commit is contained in:
parent
e65c4d612c
commit
cc32a3092a
|
@ -79,7 +79,7 @@ extern size_t display_current_frame;
|
||||||
|
|
||||||
/* USER CODE BEGIN PV */
|
/* USER CODE BEGIN PV */
|
||||||
|
|
||||||
const int ((*executors[])(void)) = {
|
static const int ((*executors[])(void)) = {
|
||||||
DNI_show_celsius,
|
DNI_show_celsius,
|
||||||
PCA9685_run_test,
|
PCA9685_run_test,
|
||||||
EEPROM_24AA02E48_run_test,
|
EEPROM_24AA02E48_run_test,
|
||||||
|
@ -91,7 +91,7 @@ const int ((*executors[])(void)) = {
|
||||||
LSM9DS1_test_magnet
|
LSM9DS1_test_magnet
|
||||||
};
|
};
|
||||||
|
|
||||||
const void ((*cleanup_functions[])(void)) = {
|
static const void ((*cleanup_functions[])(void)) = {
|
||||||
NULL,
|
NULL,
|
||||||
PCA9685_cleanup,
|
PCA9685_cleanup,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -103,8 +103,6 @@ const void ((*cleanup_functions[])(void)) = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t current_executor_id = 0;
|
|
||||||
|
|
||||||
/* USER CODE END PV */
|
/* USER CODE END PV */
|
||||||
|
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
|
@ -122,7 +120,7 @@ static void MX_I2S2_Init(void);
|
||||||
/* Private user code ---------------------------------------------------------*/
|
/* Private user code ---------------------------------------------------------*/
|
||||||
/* USER CODE BEGIN 0 */
|
/* USER CODE BEGIN 0 */
|
||||||
|
|
||||||
void button_init_and_test(void)
|
static void button_init_and_test(void)
|
||||||
{
|
{
|
||||||
// letting the buttons be tested
|
// letting the buttons be tested
|
||||||
display_write_data_seq("Fill any bar:");
|
display_write_data_seq("Fill any bar:");
|
||||||
|
@ -300,33 +298,24 @@ int main(void)
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// go to next report
|
// go to next report
|
||||||
if (
|
if (UB || SWT1 || SWT5) {
|
||||||
(GPIOA->IDR & GPIO_PIN_0) ||
|
|
||||||
!(GPIOC->IDR & GPIO_PIN_11) ||
|
|
||||||
!(GPIOC->IDR & GPIO_PIN_8)
|
|
||||||
) {
|
|
||||||
display_current_frame += 1;
|
display_current_frame += 1;
|
||||||
display_current_frame %= LEN(executors)+1;
|
display_current_frame %= LEN(executors)+1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// go to previous report
|
// go to previous report
|
||||||
else if (
|
else if (SWT3 || SWT4) {
|
||||||
!(GPIOC->IDR & GPIO_PIN_9) ||
|
|
||||||
!(GPIOC->IDR & GPIO_PIN_6)
|
|
||||||
) {
|
|
||||||
display_current_frame -= 1;
|
display_current_frame -= 1;
|
||||||
|
|
||||||
if (display_current_frame == 0xFFFFFFFFU)
|
if ((int) display_current_frame == -1)
|
||||||
display_current_frame = LEN(executors);
|
display_current_frame = LEN(executors);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return to summary frame
|
// return to summary frame
|
||||||
else if (
|
else if (SWT2) {
|
||||||
!(GPIOA->IDR & GPIO_PIN_15)
|
|
||||||
) {
|
|
||||||
display_current_frame = 0;
|
display_current_frame = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue