aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Bma421.cpp4
-rw-r--r--src/drivers/Bma421.h3
-rw-r--r--src/drivers/Cst816s.h3
-rw-r--r--src/drivers/DebugPins.cpp2
-rw-r--r--src/drivers/DebugPins.h24
-rw-r--r--src/drivers/Hrs3300.cpp1
-rw-r--r--src/drivers/SpiMaster.cpp7
-rw-r--r--src/drivers/SpiMaster.h6
-rw-r--r--src/drivers/SpiNorFlash.h1
-rw-r--r--src/drivers/St7789.h1
-rw-r--r--src/drivers/Watchdog.h3
11 files changed, 21 insertions, 34 deletions
diff --git a/src/drivers/Bma421.cpp b/src/drivers/Bma421.cpp
index 539cc8d1..84d76ab3 100644
--- a/src/drivers/Bma421.cpp
+++ b/src/drivers/Bma421.cpp
@@ -19,7 +19,7 @@ namespace {
return 0;
}
- void user_delay(uint32_t period_us, void* intf_ptr) {
+ void user_delay(uint32_t period_us, void* /*intf_ptr*/) {
nrf_delay_us(period_us);
}
}
@@ -118,6 +118,7 @@ Bma421::Values Bma421::Process() {
// X and Y axis are swapped because of the way the sensor is mounted in the PineTime
return {steps, data.y, data.x, data.z};
}
+
bool Bma421::IsOk() const {
return isOk;
}
@@ -133,6 +134,7 @@ void Bma421::SoftReset() {
nrf_delay_ms(1);
}
}
+
Bma421::DeviceTypes Bma421::DeviceType() const {
return deviceType;
}
diff --git a/src/drivers/Bma421.h b/src/drivers/Bma421.h
index ac5c707f..fb832514 100644
--- a/src/drivers/Bma421.h
+++ b/src/drivers/Bma421.h
@@ -4,15 +4,18 @@
namespace Pinetime {
namespace Drivers {
class TwiMaster;
+
class Bma421 {
public:
enum class DeviceTypes : uint8_t { Unknown, BMA421, BMA425 };
+
struct Values {
uint32_t steps;
int16_t x;
int16_t y;
int16_t z;
};
+
Bma421(TwiMaster& twiMaster, uint8_t twiAddress);
Bma421(const Bma421&) = delete;
Bma421& operator=(const Bma421&) = delete;
diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h
index 9d426c9d..c50bb733 100644
--- a/src/drivers/Cst816s.h
+++ b/src/drivers/Cst816s.h
@@ -16,6 +16,7 @@ namespace Pinetime {
DoubleTap = 0x0B,
LongPress = 0x0C
};
+
struct TouchInfos {
uint16_t x = 0;
uint16_t y = 0;
@@ -38,9 +39,11 @@ namespace Pinetime {
uint8_t GetChipId() const {
return chipId;
}
+
uint8_t GetVendorId() const {
return vendorId;
}
+
uint8_t GetFwVersion() const {
return fwVersion;
}
diff --git a/src/drivers/DebugPins.cpp b/src/drivers/DebugPins.cpp
index 4b2f0f16..6d24ca04 100644
--- a/src/drivers/DebugPins.cpp
+++ b/src/drivers/DebugPins.cpp
@@ -18,6 +18,7 @@ void debugpins_init() {
nrf_gpio_cfg_output(DebugPin4);
nrf_gpio_pin_clear(DebugPin4);
}
+
void debugpins_set(debugpins_pins pin) {
nrf_gpio_pin_set(static_cast<uint32_t>(pin));
}
@@ -33,6 +34,7 @@ void debugpins_pulse(debugpins_pins pin) {
#else
void debugpins_init() {
}
+
void debugpins_set(debugpins_pins pin) {
}
diff --git a/src/drivers/DebugPins.h b/src/drivers/DebugPins.h
deleted file mode 100644
index b30cd222..00000000
--- a/src/drivers/DebugPins.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-typedef enum {
- DebugPin0 = 27,
- DebugPin1 = 29,
- DebugPin2 = 20,
- DebugPin3 = 17,
- DebugPin4 = 11,
-} debugpins_pins;
-
-void debugpins_init();
-void debugpins_set(debugpins_pins pin);
-void debugpins_clear(debugpins_pins pin);
-void debugpins_pulse(debugpins_pins pin);
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp
index ec620af2..6c47ae28 100644
--- a/src/drivers/Hrs3300.cpp
+++ b/src/drivers/Hrs3300.cpp
@@ -13,6 +13,7 @@
#include <nrf_log.h>
using namespace Pinetime::Drivers;
+
/** Driver for the HRS3300 heart rate sensor.
* Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/drivers/hrs3300.py
*/
diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp
index 38f72fee..234884ab 100644
--- a/src/drivers/SpiMaster.cpp
+++ b/src/drivers/SpiMaster.cpp
@@ -163,10 +163,7 @@ void SpiMaster::PrepareTx(const volatile uint32_t bufferAddress, const volatile
spiBaseAddress->EVENTS_END = 0;
}
-void SpiMaster::PrepareRx(const volatile uint32_t cmdAddress,
- const volatile size_t cmdSize,
- const volatile uint32_t bufferAddress,
- const volatile size_t size) {
+void SpiMaster::PrepareRx(const volatile uint32_t bufferAddress, const volatile size_t size) {
spiBaseAddress->TXD.PTR = 0;
spiBaseAddress->TXD.MAXCNT = 0;
spiBaseAddress->TXD.LIST = 0;
@@ -234,7 +231,7 @@ bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data
while (spiBaseAddress->EVENTS_END == 0)
;
- PrepareRx((uint32_t) cmd, cmdSize, (uint32_t) data, dataSize);
+ PrepareRx((uint32_t) data, dataSize);
spiBaseAddress->TASKS_START = 1;
while (spiBaseAddress->EVENTS_END == 0)
diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h
index 5ea624f2..8b698c57 100644
--- a/src/drivers/SpiMaster.h
+++ b/src/drivers/SpiMaster.h
@@ -14,6 +14,7 @@ namespace Pinetime {
enum class BitOrder : uint8_t { Msb_Lsb, Lsb_Msb };
enum class Modes : uint8_t { Mode0, Mode1, Mode2, Mode3 };
enum class Frequencies : uint8_t { Freq8Mhz };
+
struct Parameters {
BitOrder bitOrder;
Modes mode;
@@ -45,10 +46,7 @@ namespace Pinetime {
void SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
void DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size);
- void PrepareRx(const volatile uint32_t cmdAddress,
- const volatile size_t cmdSize,
- const volatile uint32_t bufferAddress,
- const volatile size_t size);
+ void PrepareRx(const volatile uint32_t bufferAddress, const volatile size_t size);
NRF_SPIM_Type* spiBaseAddress;
uint8_t pinCsn;
diff --git a/src/drivers/SpiNorFlash.h b/src/drivers/SpiNorFlash.h
index ad4d0907..8a063fea 100644
--- a/src/drivers/SpiNorFlash.h
+++ b/src/drivers/SpiNorFlash.h
@@ -5,6 +5,7 @@
namespace Pinetime {
namespace Drivers {
class Spi;
+
class SpiNorFlash {
public:
explicit SpiNorFlash(Spi& spi);
diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h
index 8c2ac093..8a1bdfca 100644
--- a/src/drivers/St7789.h
+++ b/src/drivers/St7789.h
@@ -5,6 +5,7 @@
namespace Pinetime {
namespace Drivers {
class Spi;
+
class St7789 {
public:
explicit St7789(Spi& spi, uint8_t pinDataCommand);
diff --git a/src/drivers/Watchdog.h b/src/drivers/Watchdog.h
index 03807d61..22aa9df6 100644
--- a/src/drivers/Watchdog.h
+++ b/src/drivers/Watchdog.h
@@ -9,9 +9,11 @@ namespace Pinetime {
void Setup(uint8_t timeoutSeconds);
void Start();
void Kick();
+
ResetReasons ResetReason() const {
return resetReason;
}
+
static const char* ResetReasonToString(ResetReasons reason);
private:
@@ -23,6 +25,7 @@ namespace Pinetime {
public:
WatchdogView(const Watchdog& watchdog) : watchdog {watchdog} {
}
+
Watchdog::ResetReasons ResetReason() const {
return watchdog.ResetReason();
}