Skip to content

Commit 28abeae

Browse files
committed
DRAFT: Put gpio pins to separate file
1 parent 514481e commit 28abeae

5 files changed

Lines changed: 32 additions & 3 deletions

File tree

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ set(INCLUDE_FILES
615615
drivers/DebugPins.h
616616
drivers/InternalFlash.h
617617
drivers/Hrs3300.h
618+
drivers/PinMap.h
618619
drivers/Bma421.h
619620
drivers/Bma421_C/bma4.c
620621
drivers/Bma421_C/bma423.c

src/components/battery/BatteryController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <drivers/include/nrfx_saadc.h>
44
#include <array>
55
#include <numeric>
6+
#include <drivers/PinMap.h>
67

78
namespace Pinetime {
89
namespace Controllers {
@@ -72,7 +73,7 @@ namespace Pinetime {
7273
static constexpr uint8_t percentRemainingSamples = 5;
7374
CircBuffer<percentRemainingSamples> percentRemainingBuffer {};
7475

75-
static constexpr uint32_t chargingPin = 12;
76+
static constexpr uint32_t chargingPin = PINMAP_CHARGING_PIN;
7677
static constexpr uint32_t powerPresentPin = 19;
7778
static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7;
7879
uint16_t voltage = 0;

src/drivers/Cst816s.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "TwiMaster.h"
4+
#include <drivers/PinMap.h>
45

56
namespace Pinetime {
67
namespace Drivers {
@@ -40,7 +41,7 @@ namespace Pinetime {
4041

4142
private:
4243
static constexpr uint8_t pinIrq = 28;
43-
static constexpr uint8_t pinReset = 10;
44+
static constexpr uint8_t pinReset = PINMAP_CST816S_RESET_PIN;
4445
static constexpr uint8_t lastTouchId = 0x0f;
4546
static constexpr uint8_t touchPointNumIndex = 2;
4647
static constexpr uint8_t touchMiscIndex = 8;

src/drivers/PinMap.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
3+
#ifdef WATCH_P8
4+
5+
// BatteryController.h
6+
#define PINMAP_CHARGING_PIN 19
7+
8+
// Cst816s.h
9+
#define PINMAP_CST816S_RESET_PIN 13
10+
11+
// SystemTask.h
12+
#define PINMAP_BUTTON_PIN 17
13+
14+
#else
15+
16+
// BatteryController.h
17+
#define PINMAP_CHARGING_PIN 12
18+
19+
// Cst816s.h
20+
#define PINMAP_CST816S_RESET_PIN 10
21+
22+
// SystemTask.h
23+
#define PINMAP_BUTTON_PIN 13
24+
25+
#endif

src/systemtask/SystemTask.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <heartratetask/HeartRateTask.h>
99
#include <components/settings/Settings.h>
1010
#include <drivers/Bma421.h>
11+
#include <drivers/PinMap.h>
1112
#include <components/motion/MotionController.h>
1213

1314
#include "SystemMonitor.h"
@@ -120,7 +121,7 @@ namespace Pinetime {
120121
static constexpr uint8_t pinSpiMiso = 4;
121122
static constexpr uint8_t pinSpiCsn = 25;
122123
static constexpr uint8_t pinLcdDataCommand = 18;
123-
static constexpr uint8_t pinButton = 13;
124+
static constexpr uint8_t pinButton = PINMAP_BUTTON_PIN;
124125
static constexpr uint8_t pinTouchIrq = 28;
125126
static constexpr uint8_t pinPowerPresentIrq = 19;
126127

0 commit comments

Comments
 (0)