Skip to content

Commit

Permalink
Merge pull request #5789 from adafruit/7.1.x
Browse files Browse the repository at this point in the history
Merge latest changes from 7.1.x
  • Loading branch information
dhalbert authored Dec 28, 2021
2 parents 044dcb4 + 08d09ac commit 8aafc73
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ports/espressif/boards/adafruit_feather_esp32s2/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/include/driver/gpio.h"

void board_init(void) {
// USB
Expand All @@ -39,7 +40,9 @@ bool board_requests_safe_mode(void) {
}

void reset_board(void) {

// Turn on I2C power by default.
gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT);
gpio_set_level(7, false);
}

void board_deinit(void) {
Expand Down
2 changes: 1 addition & 1 deletion ports/espressif/boards/adafruit_feather_esp32s2/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },

{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_I2C_POWER_INVERTED), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },

{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },
Expand Down
5 changes: 5 additions & 0 deletions ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "shared-module/rgbmatrix/RGBMatrix.h"

#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
#include "src/rp2_common/hardware_irq/include/hardware/irq.h"

void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
// Choose a PWM channel based on the first RGB pin
Expand All @@ -58,13 +59,17 @@ void common_hal_rgbmatrix_timer_enable(void *ptr) {
void common_hal_rgbmatrix_timer_disable(void *ptr) {
int8_t slice = ((intptr_t)ptr) & 0xff;
pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
}

void common_hal_rgbmatrix_timer_free(void *ptr) {
intptr_t value = (intptr_t)ptr;
uint8_t slice = value & 0xff;
uint8_t channel = value >> 8;
pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
pwmout_free(slice, channel);
return;
}

0 comments on commit 8aafc73

Please sign in to comment.