I feel like this is a stupid question, but I can't seem to find the answer.
I am using the led pin on the da14683 to drive the backlight of a display.
我有这段代码,我真的在我的任务ggling between on and off every 5 seconds. The backlight will power up initially, but after being disabled once, it will never power on again. I know the display is going into and out of sleep mode every 5 seconds (I'm watching the current consumption), but no backlight.
For what it is worth, I assume this is an issue with sleep mode on the device. When I set the device to pm_set_sleep_mode(pm_mode_active); instead of extended_sleep I am able to turn the LED pins back on with the following code.
Any ideas?
void displayPower(int ON_OFF)
{
if(ON_OFF)
{
static timer2_config cfg = {
.frequency = 0,
.pwm2_end = 0,
.pwm2_start = 0,
.pwm3_end = 0,
.pwm3_start = 0,
.pwm4_end = 0,
.pwm4_start = 0,
};
hw_timer2_init(&cfg);
hw_timer2_set_division_factor(HW_TIMER2_DIV_4);
hw_timer2_set_frequency(100);
hw_timer2_set_pwm_duty_cycle(HW_TIMER2_PWM_3, 127);
hw_timer2_enable();
hw_led_set_led2_src(HW_LED_SRC2_PWM3);
hw_led_enable_led2(true);
//Out of sleep mode
displayWriteCommand(ST7789_SLPOUT);
OS_DELAY_MS(10);
displayWriteCommand(ST7789_DISPON);
}
else
{
hw_led_enable_led2(false);
//Into sleep mode
displayWriteCommand(ST7789_SLPIN);
OS_DELAY_MS(10);
displayWriteCommand(ST7789_DISPOFF);
}
}

Hi SamsonLeoMarch,
According to the DA1468x datasheet, the default GPIO value is pull-down. When the device goes into sleep, the system loses all the default configurations. You should put all your configurations into the periph_init() in case you want to wake-up and have the configuration you had before the extended sleep. So, all the pins configuration should be added into the periph_init(), that should be executed by the prvSetupHardware(). With this way, when you wake up, the power manager will reconfigure the pins with the previous state. Could you please indicate if you have already done this?
Thanks, PM_Dialog
I have, yes.
I found last night that if I add pm_set_sleep_mode(pm_mode_active) to the on case, and pm_set_sleep_mode(pm_mode_extended_sleep) to the off case, the device operates as I would want. That, however, feels like a bandaid rather than a real fix.
Hi SamsonLeoMarch,
Apologies for the confusion, I have just deleted my answer, It was as mistake. Glad that you figured your issue out. If you found any post useful for other customers, please mark it as “accepted”. Could you please let me know if you have any other issues/questions?
Thanks, PM_Dialog
Is my solution the correct way to approach this?
Hi SamsonLeoMarch,
Probably the gpio was not retained the configurations before sleep. I am not aware what you have accomplish in you firmware, but I suppose, yes, this is a solution to your issue.
Thanks, PM_Dialog