[FL-936] CLI commands for vibro, led and display backlight support (#367)
* api-hal: add api-hal-vibro * cli: add vibro cli command * cli: add cli commands for led and disp backlight
This commit is contained in:
19
firmware/targets/api-hal-include/api-hal-vibro.h
Normal file
19
firmware/targets/api-hal-include/api-hal-vibro.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <api-hal-resources.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Initialize vibro */
|
||||
void api_hal_vibro_init();
|
||||
|
||||
/* Turn on/off vibro */
|
||||
void api_hal_vibro_on(bool value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@@ -22,5 +22,6 @@ template <unsigned int N> struct STOP_EXTERNING_ME {};
|
||||
#include "api-hal-spi.h"
|
||||
#include "api-hal-flash.h"
|
||||
#include "api-hal-subghz.h"
|
||||
#include "api-hal-vibro.h"
|
||||
|
||||
void api_hal_init();
|
||||
|
11
firmware/targets/f5/api-hal/api-hal-vibro.c
Normal file
11
firmware/targets/f5/api-hal/api-hal-vibro.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <api-hal-vibro.h>
|
||||
#include <api-hal-gpio.h>
|
||||
|
||||
void api_hal_vibro_init() {
|
||||
hal_gpio_init(&vibro_gpio, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
|
||||
hal_gpio_write(&vibro_gpio, false);
|
||||
}
|
||||
|
||||
void api_hal_vibro_on(bool value) {
|
||||
hal_gpio_write(&vibro_gpio, value);
|
||||
}
|
@@ -7,4 +7,5 @@ void api_hal_init() {
|
||||
api_hal_i2c_init();
|
||||
api_hal_power_init();
|
||||
api_hal_light_init();
|
||||
api_hal_vibro_init();
|
||||
}
|
||||
|
Reference in New Issue
Block a user