add LIS302DL accelerometer testing function

This commit is contained in:
2025-03-09 21:53:24 +02:00
parent 8112ed27e8
commit 207f9c9ddf
5 changed files with 186 additions and 6 deletions
+10 -5
View File
@@ -29,6 +29,7 @@
#include "24AA02E48.h"
#include "CS43L22.h"
#include "SST25VF016B.h"
#include "LIS302DL.h"
/* USER CODE END Includes */
@@ -65,7 +66,9 @@ void ((*executors[])(void)) = {
PCA9685_run_test,
EEPROM_24AA02E48_run_test,
CS43L22_run_test,
SST25VF016B_run_test
SST25VF016B_run_test,
LIS302DL_run_test,
LIS302DL_run_test_dynamic
};
void ((*cleanup_functions[])(void)) = {
@@ -74,10 +77,12 @@ void ((*cleanup_functions[])(void)) = {
PCA9685_cleanup,
NULL,
CS43L22_cleanup,
NULL,
NULL,
NULL
};
int delay_between_runs[] = {250, 250, -1, -1, -1, -1};
int delay_between_runs[] = {250, 250, -1, -1, -1, -1, -1, 200};
size_t current_executor_id = 0;
@@ -101,7 +106,7 @@ static void MX_SPI1_Init(void);
void switch_to_next_test(void)
{
current_executor_id += 1;
current_executor_id %= 6;
current_executor_id %= 8;
}
void buttons_switch_to_interrupt(void)
@@ -283,11 +288,11 @@ int main(void)
if (delay_between_runs[current_executor_id] == -1) {
WAIT_UNTIL_CB_PRESSED;
HAL_Delay(150);
GPIOD->ODR = 0x1000;
GPIOD->BSRR = 0x1000;
WAIT_UNTIL_CB_RELEASED;
HAL_Delay(150);
GPIOD->ODR = 0x0000;
GPIOD->BSRR = 0x1000 << 16;
if (cleanup_functions[current_executor_id])
cleanup_functions[current_executor_id]();