Skip to content

Commit

Permalink
change pin order
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteHudyma committed May 17, 2024
1 parent 0b90393 commit 91fb6b4
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 28 deletions.
2 changes: 1 addition & 1 deletion LampColorControler.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/system/behavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/system/utils/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 9 additions & 9 deletions variants/Seed_XIAO_nRF52840/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 14 additions & 14 deletions variants/Seed_XIAO_nRF52840/variant.h
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 91fb6b4

Please sign in to comment.