2021-02-18 12:49:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2022-01-05 16:10:18 +00:00
|
|
|
#include <furi_hal_i2c.h>
|
2021-02-18 12:49:32 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Channel types */
|
2021-02-18 12:49:32 +00:00
|
|
|
typedef enum {
|
2022-06-09 07:33:46 +00:00
|
|
|
LP5562ChannelRed = (1 << 0),
|
|
|
|
LP5562ChannelGreen = (1 << 1),
|
|
|
|
LP5562ChannelBlue = (1 << 2),
|
|
|
|
LP5562ChannelWhite = (1 << 3),
|
2021-02-18 12:49:32 +00:00
|
|
|
} LP5562Channel;
|
|
|
|
|
2022-01-21 16:55:44 +00:00
|
|
|
typedef enum {
|
|
|
|
LP5562Direct = 0,
|
|
|
|
LP5562Engine1 = 1,
|
|
|
|
LP5562Engine2 = 2,
|
|
|
|
LP5562Engine3 = 3,
|
|
|
|
} LP5562Engine;
|
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Initialize Driver */
|
2021-11-28 18:28:19 +00:00
|
|
|
void lp5562_reset(FuriHalI2cBusHandle* handle);
|
2021-02-18 12:49:32 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Configure Driver */
|
2021-11-28 18:28:19 +00:00
|
|
|
void lp5562_configure(FuriHalI2cBusHandle* handle);
|
2021-02-18 12:49:32 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Enable Driver */
|
2021-11-28 18:28:19 +00:00
|
|
|
void lp5562_enable(FuriHalI2cBusHandle* handle);
|
2021-02-18 12:49:32 +00:00
|
|
|
|
2021-03-24 09:35:33 +00:00
|
|
|
/** Set channel current */
|
2021-11-28 18:28:19 +00:00
|
|
|
void lp5562_set_channel_current(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value);
|
2021-02-18 12:49:32 +00:00
|
|
|
|
2022-01-21 16:55:44 +00:00
|
|
|
/** Set channel PWM value */
|
2021-11-28 18:28:19 +00:00
|
|
|
void lp5562_set_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel, uint8_t value);
|
2022-01-21 16:55:44 +00:00
|
|
|
|
|
|
|
/** Get channel PWM value */
|
|
|
|
uint8_t lp5562_get_channel_value(FuriHalI2cBusHandle* handle, LP5562Channel channel);
|
|
|
|
|
2022-06-09 07:33:46 +00:00
|
|
|
/** Set channel source */
|
|
|
|
void lp5562_set_channel_src(FuriHalI2cBusHandle* handle, LP5562Channel channel, LP5562Engine src);
|
|
|
|
|
2022-01-21 16:55:44 +00:00
|
|
|
/** Execute program sequence */
|
|
|
|
void lp5562_execute_program(
|
|
|
|
FuriHalI2cBusHandle* handle,
|
|
|
|
LP5562Engine eng,
|
|
|
|
LP5562Channel ch,
|
|
|
|
uint16_t* program);
|
|
|
|
|
2022-06-09 07:33:46 +00:00
|
|
|
/** Stop program sequence */
|
|
|
|
void lp5562_stop_program(FuriHalI2cBusHandle* handle, LP5562Engine eng);
|
|
|
|
|
2022-01-21 16:55:44 +00:00
|
|
|
/** 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);
|
2022-06-09 07:33:46 +00:00
|
|
|
|
|
|
|
/** Start blink program sequence */
|
|
|
|
void lp5562_execute_blink(
|
|
|
|
FuriHalI2cBusHandle* handle,
|
|
|
|
LP5562Engine eng,
|
|
|
|
LP5562Channel ch,
|
|
|
|
uint16_t on_time,
|
|
|
|
uint16_t period,
|
|
|
|
uint8_t brightness);
|