Hi Guys,
I working on my dimmer device to finish the PWM definitions. As I wrote, in another posts here, I have use as a reference Z-Stack Home 1.2.2a.44539 and HA SampleLight project.
I already setup my workspace as RouterZlight and consequently CC2530PMP4712 as a target (including hal_board_cfg.h and hal_timer.c) that has setting environments prepared to work with PWM. Additionally I have connect an LED in a ground together a resistor driver in a P0_5.
But my PWM duty cycle percentage is insignificant, as i see in oscilloscope.
I have those settings to working with PWM and dimmer in my device:
Compiler options:
ZCL_LEVEL_CTRL
WHITE_LED_ONLY
HAL_PWM
My C file:
#elif (defined HAL_PWM)
#define LEVEL_MAX 0xFE
#define LEVEL_MIN 0x0
#define GAMMA_VALUE 2
#define PWM_FULL_DUTY_CYCLE 100
#endif
#if (defined HAL_BOARD_ZLIGHT) || (defined HAL_PWM)
HalTimer1Init( 0 );
halTimer1SetChannelDuty( WHITE_LED, PWM_FULL_DUTY_CYCLE );
halTimer1SetChannelDuty(WHITE_LED, (uint16)(((uint32)gammaCorrectedLevel*PWM_FULL_DUTY_CYCLE)/LEVEL_MAX) );
Hal_board_cfg.h:
#if defined (WHITE_LED_ONLY)
#define ENABLE_LAMP P0SEL |= ( 0x20); /* P0.5 */ > I connected a LED to make tests
#else
#define ENABLE_LAMP P0SEL |= ( 0x08 | 0x10 | 0x20 | 0x40); /* P0.3:6 */
#endif
#define DISABLE_LAMP P0SEL &= ~( 0x08 | 0x10 | 0x20 | 0x40); /* P0.3:6 */\
P0 &= ~( 0x08 | 0x10 | 0x20 | 0x40); /* P0.3:6 */
#endif
I have some doubts if it is caused by the DUTY CYCLE value, on c file, the original value to HAL_PWM is 100. I´ve changed to another values (1000 and 2000) but nothing caused changes.
Somebody can help me how to adjust duty cycle, please?

