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