Skip to content

Commit 6a76b60

Browse files
authored
Merge pull request #4013 from adafruit/revert-3930-jerryn_feathers2_led
Revert "UMFEATHERS2 - implement use of DotStar for status led"
2 parents 816cbe4 + a938934 commit 6a76b60

File tree

4 files changed

+7
-54
lines changed

4 files changed

+7
-54
lines changed

ports/esp32s2/boards/unexpectedmaker_feathers2/board.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "supervisor/board.h"
2828
#include "mpconfigboard.h"
2929
#include "shared-bindings/microcontroller/Pin.h"
30-
#include "components/driver/include/driver/gpio.h"
31-
#include "components/soc/include/hal/gpio_hal.h"
3230

3331
void board_init(void) {
3432
// USB
@@ -49,12 +47,6 @@ void board_init(void) {
4947
common_hal_never_reset_pin(&pin_GPIO30);
5048
common_hal_never_reset_pin(&pin_GPIO31);
5149
common_hal_never_reset_pin(&pin_GPIO32);
52-
53-
54-
// Add LDO2 to never reset list, set to output and enable
55-
common_hal_never_reset_pin(&pin_GPIO21);
56-
gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT);
57-
gpio_set_level(pin_GPIO21.number, true);
5850
}
5951

6052
bool board_requests_safe_mode(void) {

ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
#define AUTORESET_DELAY_MS 500
3636

37-
#define MICROPY_HW_APA102_MOSI (&pin_GPIO40)
38-
#define MICROPY_HW_APA102_SCK (&pin_GPIO45)
37+
// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40)
38+
// #define MICROPY_HW_APA102_SCK (&pin_GPIO45)
3939

4040
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9)
4141
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)

ports/esp32s2/common-hal/microcontroller/Pin.c

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@
3737
#ifdef MICROPY_HW_NEOPIXEL
3838
bool neopixel_in_use;
3939
#endif
40-
#ifdef MICROPY_HW_APA102_MOSI
41-
bool apa102_sck_in_use;
42-
bool apa102_mosi_in_use;
43-
#endif
4440

4541
STATIC uint32_t never_reset_pins[2];
4642
STATIC uint32_t in_use[2];
4743

44+
bool apa102_mosi_in_use;
45+
bool apa102_sck_in_use;
46+
4847
STATIC void floating_gpio_reset(gpio_num_t pin_number) {
4948
// This is the same as gpio_reset_pin(), but without the pullup.
5049
// Note that gpio_config resets the iomatrix to GPIO_FUNC as well.
@@ -87,20 +86,6 @@ void reset_pin_number(gpio_num_t pin_number) {
8786
return;
8887
}
8988
#endif
90-
#ifdef MICROPY_HW_APA102_MOSI
91-
if (pin_number == MICROPY_HW_APA102_MOSI->number ||
92-
pin_number == MICROPY_HW_APA102_SCK->number) {
93-
apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number;
94-
apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number;
95-
if (!apa102_sck_in_use && !apa102_mosi_in_use) {
96-
rgb_led_status_init();
97-
}
98-
return;
99-
}
100-
#endif
101-
102-
103-
10489
}
10590

10691
void common_hal_reset_pin(const mcu_pin_obj_t* pin) {
@@ -125,11 +110,6 @@ void reset_all_pins(void) {
125110
#ifdef MICROPY_HW_NEOPIXEL
126111
neopixel_in_use = false;
127112
#endif
128-
#ifdef MICROPY_HW_APA102_MOSI
129-
apa102_sck_in_use = false;
130-
apa102_mosi_in_use = false;
131-
#endif
132-
133113
}
134114

135115
void claim_pin(const mcu_pin_obj_t* pin) {
@@ -139,15 +119,6 @@ void claim_pin(const mcu_pin_obj_t* pin) {
139119
neopixel_in_use = true;
140120
}
141121
#endif
142-
#ifdef MICROPY_HW_APA102_MOSI
143-
if (pin == MICROPY_HW_APA102_MOSI) {
144-
apa102_mosi_in_use = true;
145-
}
146-
if (pin == MICROPY_HW_APA102_SCK) {
147-
apa102_sck_in_use = true;
148-
}
149-
#endif
150-
151122
}
152123

153124
void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
@@ -160,18 +131,10 @@ bool pin_number_is_free(gpio_num_t pin_number) {
160131
return !neopixel_in_use;
161132
}
162133
#endif
163-
#ifdef MICROPY_HW_APA102_MOSI
164-
if (pin_number == MICROPY_HW_APA102_MOSI->number) {
165-
return !apa102_mosi_in_use;
166-
}
167-
if (pin_number == MICROPY_HW_APA102_SCK->number) {
168-
return !apa102_sck_in_use;
169-
}
170-
#endif
171134

172135
uint8_t offset = pin_number / 32;
173136
uint32_t mask = 1 << (pin_number % 32);
174-
return (in_use[offset] & mask) == 0;
137+
return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0;
175138
}
176139

177140
bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {

ports/esp32s2/common-hal/microcontroller/Pin.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131

3232
#include "peripherals/pins.h"
3333

34-
#ifdef MICROPY_HW_APA102_MOSI
35-
extern bool apa102_sck_in_use;
3634
extern bool apa102_mosi_in_use;
37-
#endif
35+
extern bool apa102_sck_in_use;
3836

3937
#ifdef MICROPY_HW_NEOPIXEL
4038
extern bool neopixel_in_use;

0 commit comments

Comments
 (0)