add new UI for testing phase, update modules to indicate success or failure in the return value
This commit is contained in:
parent
87eb642adc
commit
0eb025d3d4
|
@ -1,6 +1,6 @@
|
|||
#ifndef __EEPROM_24AA02E48
|
||||
#define __EEPROM_24AA02E48
|
||||
|
||||
void EEPROM_24AA02E48_run_test(void);
|
||||
int EEPROM_24AA02E48_run_test(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __CS43L22
|
||||
#define __CS43L22
|
||||
|
||||
void CS43L22_run_test(void);
|
||||
int CS43L22_run_test(void);
|
||||
void CS43L22_cleanup(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
void DNI_show_celsius(void);
|
||||
void DNI_show_fahrenheit(void);
|
||||
int DNI_show_celsius(void);
|
||||
int DNI_show_fahrenheit(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __LIS302DL
|
||||
#define __LIS302DL
|
||||
|
||||
void LIS302DL_run_test(void);
|
||||
void LIS302DL_run_test_dynamic(void);
|
||||
int LIS302DL_run_test(void);
|
||||
int LIS302DL_run_test_dynamic(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef __LSM9DS1
|
||||
#define __LSM9DS1
|
||||
|
||||
void LSM9DS1_test_accel(void);
|
||||
int LSM9DS1_test_accel(void);
|
||||
void LSM9DS1_cleanup_accel(void);
|
||||
void LSM9DS1_test_magnet(void);
|
||||
int LSM9DS1_test_magnet(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __MP45DT02
|
||||
#define __MP45DT02
|
||||
|
||||
void MP45DT02_run_test(void);
|
||||
int MP45DT02_run_test(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __PCA9685
|
||||
#define __PCA9685
|
||||
|
||||
void PCA9685_run_test(void);
|
||||
int PCA9685_run_test(void);
|
||||
void PCA9685_cleanup(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __SST25VF016B
|
||||
#define __SST25VF016B
|
||||
|
||||
void SST25VF016B_run_test(void);
|
||||
int SST25VF016B_run_test(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
void EEPROM_24AA02E48_run_test(void)
|
||||
int EEPROM_24AA02E48_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("24AA02E48 EEPROM");
|
||||
|
@ -94,9 +94,13 @@ void EEPROM_24AA02E48_run_test(void)
|
|||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq("E ");
|
||||
display_write_data_seq((char *) data_buffer);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK ");
|
||||
display_write_data_seq((char *) data_buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
void CS43L22_run_test(void)
|
||||
int CS43L22_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("CS43L22 Audio");
|
||||
|
@ -57,9 +57,13 @@ void CS43L22_run_test(void)
|
|||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" Errors");
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ static void DNI_print_fahrenheit(int temperature)
|
|||
DNI_print(temperature);
|
||||
}
|
||||
|
||||
void DNI_show_celsius(void)
|
||||
int DNI_show_celsius(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
DISPLAY_SET_INCREMENT;
|
||||
|
@ -83,9 +83,11 @@ void DNI_show_celsius(void)
|
|||
uint32_t value = DNI_read();
|
||||
int temp = DNI_convert_to_celsius(value);
|
||||
DNI_print_celsius(temp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DNI_show_fahrenheit(void)
|
||||
int DNI_show_fahrenheit(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
DISPLAY_SET_INCREMENT;
|
||||
|
@ -95,4 +97,6 @@ void DNI_show_fahrenheit(void)
|
|||
uint32_t value = DNI_read();
|
||||
int temp = DNI_convert_to_fahrenheit(value);
|
||||
DNI_print_fahrenheit(temp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ static void retrieve_data(size_t *err_count, uint8_t *data_xyz, char *postfix)
|
|||
FAILSAFE_POST_OP("RZ");
|
||||
}
|
||||
|
||||
void LIS302DL_run_test(void)
|
||||
int LIS302DL_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel");
|
||||
|
@ -129,13 +129,17 @@ void LIS302DL_run_test(void)
|
|||
display_write_data_byte('0' + err_count / 10 % 10);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" errs");
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void LIS302DL_run_test_dynamic(void)
|
||||
int LIS302DL_run_test_dynamic(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LIS302DL Accel D");
|
||||
|
@ -159,8 +163,12 @@ void LIS302DL_run_test_dynamic(void)
|
|||
display_write_data_byte('0' + err_count / 10 % 10);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" errs");
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ static void print_error_magnet(HAL_StatusTypeDef result, size_t *err_count, size
|
|||
print_error_message(result, err_count, t, prefix);
|
||||
}
|
||||
|
||||
void LSM9DS1_test_accel(void)
|
||||
int LSM9DS1_test_accel(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LSM9DS1 Accel");
|
||||
|
@ -84,11 +84,15 @@ void LSM9DS1_test_accel(void)
|
|||
if (!err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + ((err_count / 10) % 10));
|
||||
display_write_data_byte('0' + (err_count % 10));
|
||||
display_write_data_seq(" errors");
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +103,7 @@ void LSM9DS1_cleanup_accel(void)
|
|||
HAL_I2C_Master_Transmit(&hi2c1, 0xD6, buffer, 2, 1000);
|
||||
}
|
||||
|
||||
void LSM9DS1_test_magnet(void)
|
||||
int LSM9DS1_test_magnet(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("LSM9DS1 Magnet");
|
||||
|
@ -122,10 +126,14 @@ void LSM9DS1_test_magnet(void)
|
|||
if (!err_count) {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK");
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_byte('0' + ((err_count / 10) % 10));
|
||||
display_write_data_byte('0' + (err_count % 10));
|
||||
display_write_data_seq(" errors");
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
extern I2S_HandleTypeDef hi2s2;
|
||||
|
||||
void MP45DT02_run_test(void)
|
||||
int MP45DT02_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("MP45DT02 Mic");
|
||||
|
@ -30,7 +30,7 @@ void MP45DT02_run_test(void)
|
|||
display_write_data_seq(" full 0 samples");
|
||||
}
|
||||
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// if ended up here, then no samples equaled to 1; that is not a good sign
|
||||
|
@ -50,4 +50,6 @@ void MP45DT02_run_test(void)
|
|||
|
||||
DISPLAY_SET_CURSOR(1, 0);
|
||||
display_write_data_seq("No good samples!");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
extern I2C_HandleTypeDef hi2c1;
|
||||
|
||||
void PCA9685_run_test(void)
|
||||
int PCA9685_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("PCA9685 PWM");
|
||||
|
@ -68,9 +68,13 @@ void PCA9685_run_test(void)
|
|||
display_write_data_byte('0' + err_count / 10 % 10);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" errors");
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_seq("OK OUT ENABLED");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,14 @@
|
|||
|
||||
extern SPI_HandleTypeDef hspi1;
|
||||
|
||||
void SST25VF016B_run_test(void)
|
||||
int SST25VF016B_run_test(void)
|
||||
{
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("SST25VF016B Flas");
|
||||
|
||||
HAL_StatusTypeDef op_result;
|
||||
size_t err_count = 0;
|
||||
size_t chip_id_fault = 0;
|
||||
|
||||
uint8_t tx_buffer[8] = {0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t rx_buffer[9];
|
||||
|
@ -46,8 +47,6 @@ void SST25VF016B_run_test(void)
|
|||
display_write_data_seq("TIMEOUT");
|
||||
break;
|
||||
}
|
||||
|
||||
HAL_Delay(2000);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
@ -62,6 +61,8 @@ void SST25VF016B_run_test(void)
|
|||
DISPLAY_SET_CURSOR(1, 1);
|
||||
display_write_data_byte('0' + err_count % 10);
|
||||
display_write_data_seq(" Errors");
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
for (size_t i = 0; i < 4; i += 2) {
|
||||
// odd reads MUST result in 0xBF
|
||||
|
@ -70,6 +71,9 @@ void SST25VF016B_run_test(void)
|
|||
display_write_data_byte('B');
|
||||
display_write_data_byte('1'+i);
|
||||
display_write_data_seq(" WRONG");
|
||||
|
||||
chip_id_fault = 1;
|
||||
|
||||
goto write_retrieved_data;
|
||||
}
|
||||
}
|
||||
|
@ -81,6 +85,9 @@ void SST25VF016B_run_test(void)
|
|||
display_write_data_byte('B');
|
||||
display_write_data_byte('1'+i);
|
||||
display_write_data_seq(" WRONG");
|
||||
|
||||
chip_id_fault = 1;
|
||||
|
||||
goto write_retrieved_data;
|
||||
}
|
||||
}
|
||||
|
@ -94,4 +101,6 @@ void SST25VF016B_run_test(void)
|
|||
display_write_data_seq((char *) &(rx_buffer[4]));
|
||||
|
||||
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_7, GPIO_PIN_SET);
|
||||
|
||||
return (err_count || chip_id_fault);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ extern size_t display_current_frame;
|
|||
|
||||
/* USER CODE BEGIN PV */
|
||||
|
||||
void ((*executors[])(void)) = {
|
||||
int ((*executors[])(void)) = {
|
||||
DNI_show_celsius,
|
||||
DNI_show_fahrenheit,
|
||||
PCA9685_run_test,
|
||||
|
@ -307,16 +307,62 @@ int main(void)
|
|||
button_init_and_test();
|
||||
|
||||
// perform all tests
|
||||
display_to_framebuffer();
|
||||
size_t successful_tests = 0;
|
||||
size_t failed_tests = 0;
|
||||
|
||||
for (display_current_frame = 0; display_current_frame < 11; display_current_frame++)
|
||||
//display_to_framebuffer();
|
||||
|
||||
for (display_current_frame = 1; display_current_frame < 12; display_current_frame++)
|
||||
{
|
||||
executors[display_current_frame]();
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("Testing...");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 2);
|
||||
display_write_data_seq("P:");
|
||||
display_write_data_byte('0' + (successful_tests / 10) % 10);
|
||||
display_write_data_byte('0' + (successful_tests) % 10);
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 10);
|
||||
display_write_data_seq("F:");
|
||||
display_write_data_byte('0' + (failed_tests / 10) % 10);
|
||||
display_write_data_byte('0' + (failed_tests) % 10);
|
||||
|
||||
display_to_framebuffer();
|
||||
|
||||
// test
|
||||
if (executors[display_current_frame-1]())
|
||||
failed_tests++;
|
||||
else
|
||||
successful_tests++;
|
||||
|
||||
// cleanup (if required)
|
||||
if (cleanup_functions[display_current_frame-1])
|
||||
cleanup_functions[display_current_frame-1]();
|
||||
|
||||
display_to_direct();
|
||||
|
||||
HAL_Delay(150);
|
||||
}
|
||||
|
||||
// render final result to first framebuffer
|
||||
display_to_framebuffer();
|
||||
display_current_frame = 0;
|
||||
|
||||
DISPLAY_CLEAR;
|
||||
display_write_data_seq("All tests done!");
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 2);
|
||||
display_write_data_seq("P:");
|
||||
display_write_data_byte('0' + (successful_tests / 10) % 10);
|
||||
display_write_data_byte('0' + (successful_tests) % 10);
|
||||
|
||||
DISPLAY_SET_CURSOR(1, 10);
|
||||
display_write_data_seq("F:");
|
||||
display_write_data_byte('0' + (failed_tests / 10) % 10);
|
||||
display_write_data_byte('0' + (failed_tests) % 10);
|
||||
|
||||
display_to_direct();
|
||||
|
||||
display_current_frame = 0;
|
||||
|
||||
if (buttons_interrupt_enabled)
|
||||
buttons_switch_to_input();
|
||||
|
@ -342,6 +388,7 @@ int main(void)
|
|||
!(GPIOC->IDR & GPIO_PIN_8)
|
||||
) {
|
||||
display_current_frame += 1;
|
||||
display_current_frame %= 12;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -351,15 +398,19 @@ int main(void)
|
|||
!(GPIOC->IDR & GPIO_PIN_6)
|
||||
) {
|
||||
display_current_frame -= 1;
|
||||
|
||||
if (display_current_frame == 0xFFFFFFFFU)
|
||||
display_current_frame = 11;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// execute this test live
|
||||
// return to summary frame
|
||||
else if (
|
||||
!(GPIOA->IDR & GPIO_PIN_15)
|
||||
) {
|
||||
// not implemented
|
||||
continue;
|
||||
display_current_frame = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue