flipperzero-firmware/applications/examples/blink.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

46 lines
1.3 KiB
C

#include <furi.h>
void rgb_set(
bool r,
bool g,
bool b,
const GpioPin* led_r,
const GpioPin* led_g,
const GpioPin* led_b) {
gpio_write(led_r, !r);
gpio_write(led_g, !g);
gpio_write(led_b, !b);
}
int32_t application_blink(void* p) {
// TODO open record
const GpioPin* led_r_record = &led_gpio[0];
const GpioPin* led_g_record = &led_gpio[1];
const GpioPin* led_b_record = &led_gpio[2];
// configure pin
gpio_init(led_r_record, GpioModeOutputOpenDrain);
gpio_init(led_g_record, GpioModeOutputOpenDrain);
gpio_init(led_b_record, GpioModeOutputOpenDrain);
while(1) {
rgb_set(1, 0, 0, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(0, 1, 0, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(1, 1, 0, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(0, 0, 1, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(1, 0, 1, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(0, 1, 1, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(1, 1, 1, led_r_record, led_g_record, led_b_record);
delay(500);
rgb_set(0, 0, 0, led_r_record, led_g_record, led_b_record);
delay(500);
}
return 0;
}