This is an example on how the assembly test can be used to ease bring-up
The example executes as follows:
- Register the RSS HAL
- Create assembly test
- Enable one assembly test at a time
- Power on the sensor
- Enable the sensor
- Exceute assembly test
- Disable the sensor
- Power off the sensor
- Destroy assembly test
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define SENSOR_ID (1U)
#define SENSOR_TIMEOUT_MS (1000U)
{
(void)argc;
(void)argv;
bool test_ok = true;
{
return EXIT_FAILURE;
}
if (buffer == NULL)
{
printf("Assembly test: Memory allocation failed\n");
return EXIT_FAILURE;
}
if (assembly_test == NULL)
{
printf("Bring-up: Could not create assembly test\n");
return EXIT_FAILURE;
}
{
printf("Bring-up: Basic read test failed\n");
test_ok = false;
}
{
printf("Bring-up: Communication test failed\n");
test_ok = false;
}
{
printf("Bring-up: Enable test failed\n");
test_ok = false;
}
{
printf("Bring-up: Interrupt test failed\n");
test_ok = false;
}
{
printf("Bring-up: Clock and Supply test failed\n");
test_ok = false;
}
{
printf("Bring-up: Calibration test failed\n");
test_ok = false;
}
if (buffer != NULL)
{
}
if (test_ok)
{
printf("Bring-up: All tests passed\n");
printf("Application finished OK\n");
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
{
bool all_passed = true;
do
{
switch (assembly_test_state)
{
break;
{
}
else
{
}
break;
default:
break;
}
uint16_t nbr_of_test_results = 0U;
for (uint16_t idx = 0; idx < nbr_of_test_results; idx++)
{
printf("Bring-up: '%s' [%s]\n", test_results[idx].test_name, test_results[idx].test_result ? "PASS" : "FAIL");
if (!test_results[idx].test_result)
{
all_passed = false;
}
}
return all_passed;
}