DRAFT: Put gpio pins to separate file

This commit is contained in:
hubmartin 2021-08-02 21:37:48 +02:00
parent 514481ef7f
commit 28abeae21b
5 changed files with 32 additions and 3 deletions

View File

@ -615,6 +615,7 @@ set(INCLUDE_FILES
drivers/DebugPins.h
drivers/InternalFlash.h
drivers/Hrs3300.h
drivers/PinMap.h
drivers/Bma421.h
drivers/Bma421_C/bma4.c
drivers/Bma421_C/bma423.c

View File

@ -3,6 +3,7 @@
#include <drivers/include/nrfx_saadc.h>
#include <array>
#include <numeric>
#include <drivers/PinMap.h>
namespace Pinetime {
namespace Controllers {
@ -72,7 +73,7 @@ namespace Pinetime {
static constexpr uint8_t percentRemainingSamples = 5;
CircBuffer<percentRemainingSamples> percentRemainingBuffer {};
static constexpr uint32_t chargingPin = 12;
static constexpr uint32_t chargingPin = PINMAP_CHARGING_PIN;
static constexpr uint32_t powerPresentPin = 19;
static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7;
uint16_t voltage = 0;

View File

@ -1,6 +1,7 @@
#pragma once
#include "TwiMaster.h"
#include <drivers/PinMap.h>
namespace Pinetime {
namespace Drivers {
@ -40,7 +41,7 @@ namespace Pinetime {
private:
static constexpr uint8_t pinIrq = 28;
static constexpr uint8_t pinReset = 10;
static constexpr uint8_t pinReset = PINMAP_CST816S_RESET_PIN;
static constexpr uint8_t lastTouchId = 0x0f;
static constexpr uint8_t touchPointNumIndex = 2;
static constexpr uint8_t touchMiscIndex = 8;

25
src/drivers/PinMap.h Normal file
View File

@ -0,0 +1,25 @@
#pragma once
#ifdef WATCH_P8
// BatteryController.h
#define PINMAP_CHARGING_PIN 19
// Cst816s.h
#define PINMAP_CST816S_RESET_PIN 13
// SystemTask.h
#define PINMAP_BUTTON_PIN 17
#else
// BatteryController.h
#define PINMAP_CHARGING_PIN 12
// Cst816s.h
#define PINMAP_CST816S_RESET_PIN 10
// SystemTask.h
#define PINMAP_BUTTON_PIN 13
#endif

View File

@ -8,6 +8,7 @@
#include <heartratetask/HeartRateTask.h>
#include <components/settings/Settings.h>
#include <drivers/Bma421.h>
#include <drivers/PinMap.h>
#include <components/motion/MotionController.h>
#include "SystemMonitor.h"
@ -120,7 +121,7 @@ namespace Pinetime {
static constexpr uint8_t pinSpiMiso = 4;
static constexpr uint8_t pinSpiCsn = 25;
static constexpr uint8_t pinLcdDataCommand = 18;
static constexpr uint8_t pinButton = 13;
static constexpr uint8_t pinButton = PINMAP_BUTTON_PIN;
static constexpr uint8_t pinTouchIrq = 28;
static constexpr uint8_t pinPowerPresentIrq = 19;