mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-22 10:43:11 +00:00
f5b342abbe
* initial gpio layer * move temlplate.c to template.c.example in preparing to applications.mk rework * separate arduino layer * separate flipper_hal.x * prepare to switch applications on v2 core gpio api * swithch applications to v2 gpio api * gpio api for local target * better gpio_disable handling * remove pwm functions from local target * inline gpio funcs * common function to init all api's * fix local example blink * move delay us to hal api folder * move pwm_set/pwm_stop to hal api folder * update applications to use hal pwm api * remove gpio mode case warning * add speaker demo to build Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
46 lines
No EOL
1.2 KiB
C
46 lines
No EOL
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
|
|
pinMode(red_record, GpioModeOutputOpenDrain);
|
|
pinMode(green_record, GpioModeOutputOpenDrain);
|
|
pinMode(blue_record, GpioModeOutputOpenDrain);
|
|
|
|
digitalWrite(red_record, HIGH);
|
|
digitalWrite(green_record, HIGH);
|
|
digitalWrite(blue_record, LOW);
|
|
|
|
uint32_t exitcode = run_minunit();
|
|
|
|
if(exitcode == 0) {
|
|
// test passed
|
|
digitalWrite(red_record, HIGH);
|
|
digitalWrite(green_record, LOW);
|
|
digitalWrite(blue_record, HIGH);
|
|
} else {
|
|
// test failed
|
|
digitalWrite(red_record, LOW);
|
|
digitalWrite(green_record, HIGH);
|
|
digitalWrite(blue_record, HIGH);
|
|
}
|
|
|
|
set_exitcode(exitcode);
|
|
|
|
furiac_exit(NULL);
|
|
} |