flipperzero-firmware/applications/tests/test_index.c
あく b835d7a451
[FL-872] Furi, API-HAL, App-Loader cleanup and improvements (#334)
* Furi: replace obsolete furiac_exit with osThreadExit, drop obsolete apis and test. Rename systemd to flipper and move to separate file, cleanup. ApiHal: Rename timebase to os and move freertos hooks there, move insomnia api to power module.
* Furi: new thread helper
* Furi: cleanup thread documentation
* Flipper, AppLoader: update to use FuriThread. Update tasks signatures to match FuriThreadCallback signature.
* F4: rename API_HAL_TIMEBASE_DEBUG to API_HAL_OS_DEBUG
* Applications: rename FuriApplication to FlipperApplication, use FuriThreadCallback signature for apps.
* C++ app template sample, new exit method
2021-02-12 20:24:34 +03:00

42 lines
1.1 KiB
C

#include <stdio.h>
#include <furi.h>
// #include "flipper-core.h" TODO: Rust build disabled
int run_minunit();
int32_t flipper_test_app(void* p) {
// create pins
GpioPin red = {.pin = LED_RED_Pin, .port = LED_RED_GPIO_Port};
GpioPin green = {.pin = LED_GREEN_Pin, .port = LED_GREEN_GPIO_Port};
GpioPin blue = {.pin = LED_BLUE_Pin, .port = LED_BLUE_GPIO_Port};
GpioPin* red_record = &red;
GpioPin* green_record = &green;
GpioPin* blue_record = &blue;
// configure pins
gpio_init(red_record, GpioModeOutputOpenDrain);
gpio_init(green_record, GpioModeOutputOpenDrain);
gpio_init(blue_record, GpioModeOutputOpenDrain);
gpio_write(red_record, true);
gpio_write(green_record, true);
gpio_write(blue_record, false);
uint32_t exitcode = run_minunit();
if(exitcode == 0) {
// test passed
gpio_write(red_record, true);
gpio_write(green_record, false);
gpio_write(blue_record, true);
} else {
// test failed
gpio_write(red_record, false);
gpio_write(green_record, true);
gpio_write(blue_record, true);
}
return 0;
}