Merge pull request #5789 from adafruit/7.1.x

Merge latest changes from 7.1.x
This commit is contained in:
Dan Halbert 2021-12-28 18:12:29 -05:00 committed by GitHub
commit 8aafc734a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 3 deletions

@ -1 +1 @@
Subproject commit ca141954c0b39cc0343c63bedb64c02f307159b9 Subproject commit 0ec87891f9a28ee3c5ae3b020b60d361684f466d

View File

@ -27,6 +27,7 @@
#include "supervisor/board.h" #include "supervisor/board.h"
#include "mpconfigboard.h" #include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/include/driver/gpio.h"
void board_init(void) { void board_init(void) {
// USB // USB
@ -39,7 +40,9 @@ bool board_requests_safe_mode(void) {
} }
void reset_board(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) { void board_deinit(void) {

View File

@ -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_D5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, { 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_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_A5), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },

View File

@ -33,6 +33,7 @@
#include "shared-module/rgbmatrix/RGBMatrix.h" #include "shared-module/rgbmatrix/RGBMatrix.h"
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.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) { void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
// Choose a PWM channel based on the first RGB pin // Choose a PWM channel based on the first RGB pin
@ -58,6 +59,8 @@ void common_hal_rgbmatrix_timer_enable(void *ptr) {
void common_hal_rgbmatrix_timer_disable(void *ptr) { void common_hal_rgbmatrix_timer_disable(void *ptr) {
int8_t slice = ((intptr_t)ptr) & 0xff; int8_t slice = ((intptr_t)ptr) & 0xff;
pwm_set_enabled(slice, false); pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
} }
void common_hal_rgbmatrix_timer_free(void *ptr) { void common_hal_rgbmatrix_timer_free(void *ptr) {
@ -65,6 +68,8 @@ void common_hal_rgbmatrix_timer_free(void *ptr) {
uint8_t slice = value & 0xff; uint8_t slice = value & 0xff;
uint8_t channel = value >> 8; uint8_t channel = value >> 8;
pwm_set_enabled(slice, false); pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
pwmout_free(slice, channel); pwmout_free(slice, channel);
return; return;
} }