flipperzero-firmware/applications/tests/test_index.c
DrZlo13 979af6c165
Core code cleanup (#206)
* add delay function
* todo about delay_isr
* remove arduino defines and fix all apps to use core-api/hal-api
* delay for local target
* remove warnings of task_equal
* fix BSP_SD_Init
* fix USBD_static
* grio read constant pointer to gpio
* add TODO about ISR context
* const void* arg for pubsub api
* mark unused functions
* app pointers now pointed to constant apps
* fix printf format
* fix "unused" warnings in local target
* fix const pin read in local target
* fix int to pointer warnings in local target
* power read mutex error fix
* delete old makefile
* add -werror

Co-authored-by: Aleksandr Kutuzov <aku@plooks.com>
Co-authored-by: aanper <mail@s3f.ru>
2020-10-29 10:58:19 +03:00

46 lines
1.2 KiB
C

#include <stdio.h>
#include "flipper.h"
#include "flipper_v2.h"
#include "log.h"
// #include "flipper-core.h" TODO: Rust build disabled
int run_minunit();
void 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);
}
set_exitcode(exitcode);
furiac_exit(NULL);
}