diff --git a/LampColorControler.ino b/LampColorControler.ino index 77e6b15..a1b0efb 100644 --- a/LampColorControler.ino +++ b/LampColorControler.ino @@ -37,7 +37,7 @@ void setup() { // set up button colors and callbacks button::init(); - if (!charger::is_usb_powered()) { + if (!charger::is_powered_on()) { startup_sequence(); } else { shutdown(); diff --git a/src/system/behavior.cpp b/src/system/behavior.cpp index e32dadc..55d07a0 100644 --- a/src/system/behavior.cpp +++ b/src/system/behavior.cpp @@ -128,6 +128,8 @@ void shutdown() { // do not power down when charger is plugged in if (!charger::is_powered_on()) { + digitalWrite(USB_33V_PWR, LOW); + // power down nrf52. // on wake up, it'll start back from the setup phase systemOff(BUTTON_PIN, 0); diff --git a/src/system/utils/constants.h b/src/system/utils/constants.h index 79fe093..31310a0 100644 --- a/src/system/utils/constants.h +++ b/src/system/utils/constants.h @@ -64,10 +64,10 @@ constexpr float batteryLow = 5; // % // pins // The button pin (one button pin to GND, the other to this pin) -#define BUTTON_PIN D4 +static constexpr uint32_t BUTTON_PIN = D6; // Pins for the led on the button -#define BUTTON_RED D5 -#define BUTTON_GREEN D7 -#define BUTTON_BLUE D6 +static constexpr uint32_t BUTTON_RED = D8; +static constexpr uint32_t BUTTON_GREEN = D4; +static constexpr uint32_t BUTTON_BLUE = D7; #endif \ No newline at end of file diff --git a/variants/Seed_XIAO_nRF52840/variant.cpp b/variants/Seed_XIAO_nRF52840/variant.cpp index 5979585..e4e1a96 100644 --- a/variants/Seed_XIAO_nRF52840/variant.cpp +++ b/variants/Seed_XIAO_nRF52840/variant.cpp @@ -5,15 +5,15 @@ #include "wiring_digital.h" const uint32_t g_ADigitalPinMap[] = { - 2, // D0 is P0.02/AIN0 (A0) - 3, // D1 is P0.03/AIN1 (A1) - 28, // D2 is P0.28/AIN4 (A2) - 29, // D3 is P0.29/AIN5 (A3) - 42, // D4 is P1.10 - 43, // D5 is P1.11 - 44, // D6 is P1.12 - 45, // D7 is P1.13 - 46, // D8 is P1.14 + 28, // AD0 is P0.28/AIN4 + 29, // AD1 is P0.29/AIN5 + 3, // AD2 is P0.03/AIN1 + 2, // AD3 is P0.02/AIN0 + 45, // D4 is P1.13 + 46, // D5 is P1.14 + 42, // D6 is P1.10 + 44, // D7 is P1.12 + 43, // D8 is P1.11 31, // D9 is P0.31/AIN7: strip brightness diff --git a/variants/Seed_XIAO_nRF52840/variant.h b/variants/Seed_XIAO_nRF52840/variant.h index e4ac270..2e1457f 100644 --- a/variants/Seed_XIAO_nRF52840/variant.h +++ b/variants/Seed_XIAO_nRF52840/variant.h @@ -1,7 +1,7 @@ -#ifndef _SEEED_XIAO_NRF52840_H_ -#define _SEEED_XIAO_NRF52840_H_ +#ifndef _SEEED_XIAO_NRF52840_SENSE_H_ +#define _SEEED_XIAO_NRF52840_SENSE_H_ -#define TARGET_SEEED_XIAO_NRF52840 +#define TARGET_SEEED_XIAO_NRF52840_SENSE /** Master clock frequency */ #define VARIANT_MCK (64000000ul) @@ -25,7 +25,8 @@ extern "C" { #define NUM_ANALOG_OUTPUTS (0) // LEDs -#define PIN_LED (LED_RED) +#define LED_BLUE (PINS_COUNT) // No connection +#define PIN_LED (PINS_COUNT) #define LED_PWR (PINS_COUNT) #define PIN_NEOPIXEL (PINS_COUNT) #define NEOPIXEL_NUM (0) @@ -35,11 +36,11 @@ extern "C" { // Buttons #define PIN_BUTTON1 (PINS_COUNT) -// Digital PINs -static const uint8_t D0 = 0; -static const uint8_t D1 = 1; -static const uint8_t D2 = 2; -static const uint8_t D3 = 3; +// Analog Digital PINs +static const uint8_t AD0 = 0; +static const uint8_t AD1 = 1; +static const uint8_t AD2 = 2; +static const uint8_t AD3 = 3; static const uint8_t D4 = 4; static const uint8_t D5 = 5; static const uint8_t D6 = 6; @@ -52,11 +53,6 @@ static const uint8_t D8 = 8; #define PIN_A2 (2) #define PIN_A3 (3) -static const uint8_t A0 = PIN_A0; -static const uint8_t A1 = PIN_A1; -static const uint8_t A2 = PIN_A2; -static const uint8_t A3 = PIN_A3; - // IO #define OUT_BRIGHTNESS (9) #define BAT21 (13) @@ -114,6 +110,10 @@ static const uint8_t SS = 7; // with analyser, this will appear 1 bit shifted to the left #define BQ25703ADevaddr 0x6B +// default address for the usb negociation component. When read +// with analyser, this will appear 1 bit shifted to the left +#define RT1715Devaddr 0x4E + #ifdef __cplusplus } #endif