flipperzero-firmware/lib/drivers/lp5562.h
Nikolay Minaylov d4787e859e
[FL-1506, FL-2197] Power, USB, LED driver improvements (#966)
* Power, USB, LED driver improvements
* u2f hid descriptor fix
* variable_item_list: value alignment fix
* InputTypeRepeat handling in menu/submenu/var_item_list
* lp5562: fix bugs on 400khz i2c
* Scripts: lint in parallel.
* FuriHal: rename some USB structure to match naming convention. Drivers: update magic values in LP5562.

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-01-21 19:55:44 +03:00

55 lines
1.3 KiB
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <furi_hal_i2c.h>
/** Channel types */
typedef enum {
LP5562ChannelRed,
LP5562ChannelGreen,
LP5562ChannelBlue,
LP5562ChannelWhite,
} LP5562Channel;
typedef enum {
LP5562Direct = 0,
LP5562Engine1 = 1,
LP5562Engine2 = 2,
LP5562Engine3 = 3,
} LP5562Engine;
/** Initialize Driver */
void lp5562_reset(FuriHalI2cBusHandle* handle);
/** Configure Driver */
void lp5562_configure(FuriHalI2cBusHandle* handle);
/** Enable Driver */
void lp5562_enable(FuriHalI2cBusHandle* handle);
/** Set channel current */
void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value);
/** Set channel PWM value */
void lp5562_set_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value);
/** Get channel PWM value */
uint8_t lp5562_get_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel);
/** Execute program sequence */
void lp5562_execute_program(
FuriHalI2cBusHandle* handle,
LP5562Engine eng,
LP5562Channel ch,
uint16_t* program);
/** Execute ramp program sequence */
void lp5562_execute_ramp(
FuriHalI2cBusHandle* handle,
LP5562Engine eng,
LP5562Channel ch,
uint8_t val_start,
uint8_t val_end,
uint16_t time);