12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef __USER_LIGHT_H__
- #define __USER_LIGHT_H__
- /*pwm.h: function and macro definition of PWM API , driver level */
- /*user_light.h: user interface for light API, user level*/
- /*user_light_adj: API for color changing and lighting effects, user level*/
- #include "pwm.h"
- /* NOTICE !!! ---this is for 512KB spi flash.*/
- /* You can change to other sector if you use other size spi flash. */
- /* Refer to the documentation about OTA support and flash mapping*/
- #define PRIV_PARAM_START_SEC 0x3C
- #define PRIV_PARAM_SAVE 0
- /*Define the channel number of PWM*/
- /*In this demo, we can set 3 for 3 PWM channels: RED, GREEN, BLUE*/
- /*Or , we can choose 5 channels : RED,GREEN,BLUE,COLD-WHITE,WARM-WHITE*/
- #define PWM_CHANNEL 5 // 5:5channel ; 3:3channel
- #define LIGHT_RED 0
- #define LIGHT_GREEN 1
- #define LIGHT_BLUE 2
- #define LIGHT_COLD_WHITE 3
- #define LIGHT_WARM_WHITE 4
- /*Definition of GPIO PIN params, for GPIO initialization*/
- #define PWM_0_OUT_IO_MUX PERIPHS_IO_MUX_MTDI_U
- #define PWM_0_OUT_IO_NUM 12
- #define PWM_0_OUT_IO_FUNC FUNC_GPIO12
- #define PWM_1_OUT_IO_MUX PERIPHS_IO_MUX_MTDO_U
- #define PWM_1_OUT_IO_NUM 15
- #define PWM_1_OUT_IO_FUNC FUNC_GPIO15
- #define PWM_2_OUT_IO_MUX PERIPHS_IO_MUX_MTCK_U
- #define PWM_2_OUT_IO_NUM 13
- #define PWM_2_OUT_IO_FUNC FUNC_GPIO13
- #define PWM_3_OUT_IO_MUX PERIPHS_IO_MUX_MTMS_U
- #define PWM_3_OUT_IO_NUM 14
- #define PWM_3_OUT_IO_FUNC FUNC_GPIO14
- #define PWM_4_OUT_IO_MUX PERIPHS_IO_MUX_GPIO5_U
- #define PWM_4_OUT_IO_NUM 5
- #define PWM_4_OUT_IO_FUNC FUNC_GPIO5
- struct light_saved_param {
- uint32 pwm_period;
- uint32 pwm_duty[PWM_CHANNEL];
- };
- void user_light_init(void);
- uint32 user_light_get_duty(uint8 channel);
- void user_light_set_duty(uint32 duty, uint8 channel);
- uint32 user_light_get_period(void);
- void user_light_set_period(uint32 period);
- #endif
|