PinMap with namespace and constexpr
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <legacy/nrf_drv_gpiote.h>
|
||||
#include <nrfx_log.h>
|
||||
#include <task.h>
|
||||
#include "drivers/PinMap.h"
|
||||
|
||||
using namespace Pinetime::Drivers;
|
||||
|
||||
@@ -18,12 +19,12 @@ Cst816S::Cst816S(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaste
|
||||
}
|
||||
|
||||
void Cst816S::Init() {
|
||||
nrf_gpio_cfg_output(pinReset);
|
||||
nrf_gpio_pin_set(pinReset);
|
||||
nrf_gpio_cfg_output(PinMap::Cst816sReset);
|
||||
nrf_gpio_pin_set(PinMap::Cst816sReset);
|
||||
vTaskDelay(50);
|
||||
nrf_gpio_pin_clear(pinReset);
|
||||
nrf_gpio_pin_clear(PinMap::Cst816sReset);
|
||||
vTaskDelay(5);
|
||||
nrf_gpio_pin_set(pinReset);
|
||||
nrf_gpio_pin_set(PinMap::Cst816sReset);
|
||||
vTaskDelay(50);
|
||||
|
||||
// Wake the touchpanel up
|
||||
@@ -78,9 +79,9 @@ Cst816S::TouchInfos Cst816S::GetTouchInfo() {
|
||||
}
|
||||
|
||||
void Cst816S::Sleep() {
|
||||
nrf_gpio_pin_clear(pinReset);
|
||||
nrf_gpio_pin_clear(PinMap::Cst816sReset);
|
||||
vTaskDelay(5);
|
||||
nrf_gpio_pin_set(pinReset);
|
||||
nrf_gpio_pin_set(PinMap::Cst816sReset);
|
||||
vTaskDelay(50);
|
||||
static constexpr uint8_t sleepValue = 0x03;
|
||||
twiMaster.Write(twiAddress, 0xA5, &sleepValue, 1);
|
||||
|
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "TwiMaster.h"
|
||||
#include <drivers/PinMap.h>
|
||||
|
||||
namespace Pinetime {
|
||||
namespace Drivers {
|
||||
@@ -40,8 +39,6 @@ namespace Pinetime {
|
||||
void Wakeup();
|
||||
|
||||
private:
|
||||
static constexpr uint8_t pinIrq = 28;
|
||||
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;
|
||||
|
@@ -1,5 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
namespace Pinetime {
|
||||
namespace PinMap {
|
||||
#define WATCH_P8
|
||||
#ifdef WATCH_P8
|
||||
static constexpr uint8_t Charging = 19;
|
||||
static constexpr uint8_t Cst816sReset = 13;
|
||||
static constexpr uint8_t Button = 17;
|
||||
#else
|
||||
static constexpr uint8_t Charging = 12;
|
||||
static constexpr uint8_t Cst816sReset = 10;
|
||||
static constexpr uint8_t Button = 13;
|
||||
#endif
|
||||
|
||||
static constexpr uint8_t Cst816sIrq = 28;
|
||||
static constexpr uint8_t PowerPresent = 19;
|
||||
|
||||
static constexpr uint8_t Motor = 16;
|
||||
|
||||
static constexpr uint8_t LcdBacklight1 = 14;
|
||||
static constexpr uint8_t LcdBacklight2 = 22;
|
||||
static constexpr uint8_t LcdBacklight3 = 23;
|
||||
|
||||
static constexpr uint8_t SpiSck = 2;
|
||||
static constexpr uint8_t SpiMosi = 3;
|
||||
static constexpr uint8_t SpiMiso = 4;
|
||||
|
||||
static constexpr uint8_t SpiFlashCsn = 5;
|
||||
static constexpr uint8_t SpiLcdCsn = 25;
|
||||
static constexpr uint8_t LcdDataCommand = 18;
|
||||
|
||||
static constexpr uint8_t TwiScl = 7;
|
||||
static constexpr uint8_t TwiSda = 6;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef WATCH_P8
|
||||
|
||||
// BatteryController.h
|
||||
|
Reference in New Issue
Block a user