Outdated apps: add api-light-usage (#359)
This commit is contained in:
@@ -1,41 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include <furi.h>
|
||||
|
||||
// #include "flipper-core.h" TODO: Rust build disabled
|
||||
#include <api-hal.h>
|
||||
|
||||
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);
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0xFF);
|
||||
|
||||
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);
|
||||
api_hal_light_set(LightRed, 0x00);
|
||||
api_hal_light_set(LightGreen, 0xFF);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
} else {
|
||||
// test failed
|
||||
gpio_write(red_record, false);
|
||||
gpio_write(green_record, true);
|
||||
gpio_write(blue_record, true);
|
||||
api_hal_light_set(LightRed, 0xFF);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
api_hal_light_set(LightBlue, 0x00);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user