fix logic in pwmout_reset()
This commit is contained in:
parent
5a053f9ae5
commit
d0d10179c2
@ -71,12 +71,6 @@ uint8_t display_init_sequence[] = {
|
||||
|
||||
|
||||
void board_init(void) {
|
||||
// THIS SHOULD BE HANDLED BY espressif_board_reset_pin_number(), but it is not working.
|
||||
// TEMPORARY FIX UNTIL IT'S DIAGNOSED.
|
||||
common_hal_never_reset_pin(&pin_GPIO21);
|
||||
gpio_set_direction(21, GPIO_MODE_DEF_OUTPUT);
|
||||
gpio_set_level(21, true);
|
||||
|
||||
busio_spi_obj_t *spi = common_hal_board_create_spi(0);
|
||||
displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus;
|
||||
bus->base.type = &displayio_fourwire_type;
|
||||
@ -95,7 +89,9 @@ void board_init(void) {
|
||||
display->base.type = &displayio_display_type;
|
||||
|
||||
// workaround as board_init() is called before reset_port() in main.c
|
||||
#if CIRCUITPY_PWMIO
|
||||
pwmout_reset();
|
||||
#endif
|
||||
|
||||
common_hal_displayio_display_construct(
|
||||
display,
|
||||
|
@ -55,18 +55,14 @@ STATIC uint32_t calculate_duty_cycle(uint32_t frequency) {
|
||||
|
||||
void pwmout_reset(void) {
|
||||
for (size_t i = 0; i < LEDC_CHANNEL_MAX; i++) {
|
||||
if (reserved_channels[i] != INDEX_EMPTY) {
|
||||
if (reserved_channels[i] != INDEX_EMPTY && !never_reset_chan[i]) {
|
||||
ledc_stop(LEDC_LOW_SPEED_MODE, i, 0);
|
||||
}
|
||||
if (!never_reset_chan[i]) {
|
||||
reserved_channels[i] = INDEX_EMPTY;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < LEDC_TIMER_MAX; i++) {
|
||||
if (reserved_timer_freq[i]) {
|
||||
if (reserved_timer_freq[i] && !never_reset_tim[i]) {
|
||||
ledc_timer_rst(LEDC_LOW_SPEED_MODE, i);
|
||||
}
|
||||
if (!never_reset_tim[i]) {
|
||||
reserved_timer_freq[i] = 0;
|
||||
varfreq_timers[i] = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user