[FL-873] Add F5 target, lp5562 driver and api-hal-light (#347)
* Add F5 target, lp5562 driver and api-hal-light. Update api-usage, switch to F5 by default. * API HAL: add i2c and hardware version api. Dolphin: show hardware version. * OTP version generator and flashing utility. * Assets script: fix code formatting * Backport F5 changes to F4 * F4: disable insomnia, prevent damage to BLE RX path * F5 HAL API Light: remove magic delay to fix magic BLE * Dolphin: HW target validation on start * invert RSSI indication in sub-1 * API HAL: rename board to body in version api * Gpio tester: detach and release viewport on exit Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
#include <furi.h>
|
||||
#include <api-hal.h>
|
||||
|
||||
#include <input/input.h>
|
||||
|
||||
typedef struct {
|
||||
GpioPin* led;
|
||||
GpioPin* vibro;
|
||||
} Ctx;
|
||||
|
||||
@@ -13,20 +14,18 @@ static void button_handler(const void* value, void* _ctx) {
|
||||
if(event->key != InputKeyOk) return;
|
||||
|
||||
if(event->type == InputTypePress) {
|
||||
gpio_write(ctx->led, false);
|
||||
api_hal_light_set(LightGreen, 0xFF);
|
||||
gpio_write(ctx->vibro, true);
|
||||
} else if(event->type == InputTypeRelease) {
|
||||
gpio_write(ctx->led, true);
|
||||
api_hal_light_set(LightGreen, 0x00);
|
||||
gpio_write(ctx->vibro, false);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t application_vibro(void* p) {
|
||||
Ctx ctx = {.led = (GpioPin*)&led_gpio[1], .vibro = (GpioPin*)&vibro_gpio};
|
||||
Ctx ctx = {.vibro = (GpioPin*)&vibro_gpio};
|
||||
|
||||
gpio_init(ctx.led, GpioModeOutputOpenDrain);
|
||||
gpio_init(ctx.vibro, GpioModeOutputPushPull);
|
||||
gpio_write(ctx.led, true);
|
||||
gpio_write(ctx.vibro, false);
|
||||
|
||||
// subscribe on buttons
|
||||
|
Reference in New Issue
Block a user