Handle inverted neopixel power

This commit is contained in:
Scott Shawcroft 2021-05-19 17:29:02 -07:00
parent b78e9fcd19
commit 499a4388cf
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
4 changed files with 8 additions and 1 deletions

View File

@ -31,6 +31,7 @@
#define MICROPY_HW_NEOPIXEL (&pin_GPIO1) #define MICROPY_HW_NEOPIXEL (&pin_GPIO1)
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21) #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO21)
#define CIRCUITPY_STATUS_LED_POWER_INVERTED (1)
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)

View File

@ -44,6 +44,7 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER_INVERTED), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) },

View File

@ -991,6 +991,10 @@ void supervisor_run_background_tasks_if_tick(void);
#define CIRCUITPY_PROCESSOR_COUNT (1) #define CIRCUITPY_PROCESSOR_COUNT (1)
#endif #endif
#ifndef CIRCUITPY_STATUS_LED_POWER_INVERTED
#define CIRCUITPY_STATUS_LED_POWER_INVERTED (0)
#endif
#define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt" #define CIRCUITPY_BOOT_OUTPUT_FILE "/boot_out.txt"
#define CIRCUITPY_VERBOSE_BLE 0 #define CIRCUITPY_VERBOSE_BLE 0

View File

@ -124,7 +124,8 @@ void status_led_init() {
#ifdef CIRCUITPY_STATUS_LED_POWER #ifdef CIRCUITPY_STATUS_LED_POWER
common_hal_digitalio_digitalinout_construct(&_status_power, CIRCUITPY_STATUS_LED_POWER); common_hal_digitalio_digitalinout_construct(&_status_power, CIRCUITPY_STATUS_LED_POWER);
common_hal_digitalio_digitalinout_switch_to_output(&_status_power, true, DRIVE_MODE_PUSH_PULL); common_hal_digitalio_digitalinout_switch_to_output(&_status_power,
CIRCUITPY_STATUS_LED_POWER_INVERTED == 0, DRIVE_MODE_PUSH_PULL);
#endif #endif
#ifdef MICROPY_HW_NEOPIXEL #ifdef MICROPY_HW_NEOPIXEL