mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-21 02:03:18 +00:00
68a3f6b4b7
* 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>
43 lines
No EOL
1.3 KiB
C
43 lines
No EOL
1.3 KiB
C
#include <api-hal-light.h>
|
|
#include <lp5562.h>
|
|
|
|
#define LED_CURRENT_RED 50
|
|
#define LED_CURRENT_GREEN 50
|
|
#define LED_CURRENT_BLUE 50
|
|
#define LED_CURRENT_WHITE 150
|
|
|
|
void api_hal_light_init() {
|
|
lp5562_reset();
|
|
|
|
lp5562_set_channel_current(LP5562ChannelRed, LED_CURRENT_RED);
|
|
lp5562_set_channel_current(LP5562ChannelGreen, LED_CURRENT_GREEN);
|
|
lp5562_set_channel_current(LP5562ChannelBlue, LED_CURRENT_BLUE);
|
|
lp5562_set_channel_current(LP5562ChannelWhite, LED_CURRENT_WHITE);
|
|
|
|
lp5562_set_channel_value(LP5562ChannelRed, 0x00);
|
|
lp5562_set_channel_value(LP5562ChannelGreen, 0x00);
|
|
lp5562_set_channel_value(LP5562ChannelBlue, 0x00);
|
|
lp5562_set_channel_value(LP5562ChannelWhite, 0x00);
|
|
|
|
lp5562_enable();
|
|
lp5562_configure();
|
|
}
|
|
|
|
void api_hal_light_set(Light light, uint8_t value) {
|
|
switch(light) {
|
|
case LightRed:
|
|
lp5562_set_channel_value(LP5562ChannelRed, value);
|
|
break;
|
|
case LightGreen:
|
|
lp5562_set_channel_value(LP5562ChannelGreen, value);
|
|
break;
|
|
case LightBlue:
|
|
lp5562_set_channel_value(LP5562ChannelBlue, value);
|
|
break;
|
|
case LightBacklight:
|
|
lp5562_set_channel_value(LP5562ChannelWhite, value);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
} |