avoid pwmout_reset() workaround by reordering in main(); remove unnecessary never-resets

This commit is contained in:
Dan Halbert 2022-09-12 21:32:09 -04:00
parent d0d10179c2
commit 14adfb16dd
11 changed files with 4 additions and 46 deletions

6
main.c
View File

@ -967,15 +967,15 @@ int __attribute__((used)) main(void) {
safe_mode = NO_CIRCUITPY;
}
// displays init after filesystem, since they could share the flash SPI
board_init();
// Reset everything and prep MicroPython to run boot.py.
reset_port();
// Port-independent devices, like CIRCUITPY_BLEIO_HCI.
reset_devices();
reset_board();
// displays init after filesystem, since they could share the flash SPI
board_init();
// This is first time we are running CircuitPython after a reset or power-up.
supervisor_set_run_reason(RUN_REASON_STARTUP);

View File

@ -63,9 +63,6 @@ void board_init(void) {
0, // Polarity
0); // Phase
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(

View File

@ -88,11 +88,6 @@ void board_init(void) {
displayio_display_obj_t *display = &displays[0].display;
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,
bus,
@ -123,8 +118,6 @@ void board_init(void) {
false, // SH1107_addressing
50000 // backlight pwm frequency
);
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
}
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {

View File

@ -71,9 +71,6 @@ void board_init(void) {
0, // Polarity
0); // Phase
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(

View File

@ -87,9 +87,6 @@ void board_init(void) {
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
common_hal_displayio_display_construct(
display,
bus,
@ -120,9 +117,6 @@ void board_init(void) {
false, // SH1107_addressing
50000 // backlight pwm frequency
);
common_hal_never_reset_pin(&pin_GPIO48); // backlight pin
// Debug UART
}
// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here.

View File

@ -88,9 +88,6 @@ void board_init(void) {
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
common_hal_displayio_display_construct(
display,
bus,
@ -121,8 +118,6 @@ void board_init(void) {
false, // SH1107_addressing
50000 // backlight pwm frequency
);
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
}
bool espressif_board_reset_pin_number(gpio_num_t pin_number) {

View File

@ -93,9 +93,6 @@ static void display_init(void) {
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
common_hal_displayio_display_construct(
display,
bus,
@ -126,8 +123,6 @@ static void display_init(void) {
false, // SH1107_addressing
50000 // backlight pwm frequency
);
common_hal_never_reset_pin(&pin_GPIO38); // backlight pin
}
void board_init(void) {

View File

@ -93,9 +93,6 @@ static void display_init(void) {
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
common_hal_displayio_display_construct(
display,
bus,
@ -126,8 +123,6 @@ static void display_init(void) {
false, // SH1107_addressing
50000 // backlight pwm frequency
);
common_hal_never_reset_pin(&pin_GPIO33); // backlight pin
}
void board_init(void) {

View File

@ -172,9 +172,6 @@ void board_init(void) {
0 // phase
);
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
common_hal_displayio_display_construct(

View File

@ -92,9 +92,6 @@ static void display_init(void) {
displayio_display_obj_t *display = &displays[0].display;
display->base.type = &displayio_display_type;
// workaround as board_init() is called before reset_port() in main.c
pwmout_reset();
common_hal_displayio_display_construct(
display,
bus,
@ -125,8 +122,6 @@ static void display_init(void) {
false, // SH1107_addressing
50000 // backlight pwm frequency
);
common_hal_never_reset_pin(&pin_GPIO45); // backlight pin
}

@ -1 +1 @@
Subproject commit 28804391c002f6a3ea5ce6a55aee3b191be3ecde
Subproject commit 7613e4968664c1f8f6788b9ec114373d34acbb3d