aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/SpiMaster.cpp12
-rw-r--r--src/drivers/Watchdog.cpp2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp
index 1a2fab9c..3446d639 100644
--- a/src/drivers/SpiMaster.cpp
+++ b/src/drivers/SpiMaster.cpp
@@ -131,8 +131,8 @@ void SpiMaster::OnEndEvent() {
if (s > 0) {
auto currentSize = std::min((size_t) 255, s);
PrepareTx(currentBufferAddr, currentSize);
- currentBufferAddr += currentSize;
- currentBufferSize -= currentSize;
+ currentBufferAddr = currentBufferAddr + currentSize;
+ currentBufferSize = currentBufferSize - currentSize;
spiBaseAddress->TASKS_START = 1;
} else {
@@ -153,7 +153,7 @@ void SpiMaster::OnEndEvent() {
void SpiMaster::OnStartedEvent() {
}
-void SpiMaster::PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size) {
+void SpiMaster::PrepareTx(const uint32_t bufferAddress, const size_t size) {
spiBaseAddress->TXD.PTR = bufferAddress;
spiBaseAddress->TXD.MAXCNT = size;
spiBaseAddress->TXD.LIST = 0;
@@ -163,7 +163,7 @@ void SpiMaster::PrepareTx(const volatile uint32_t bufferAddress, const volatile
spiBaseAddress->EVENTS_END = 0;
}
-void SpiMaster::PrepareRx(const volatile uint32_t bufferAddress, const volatile size_t size) {
+void SpiMaster::PrepareRx(const uint32_t bufferAddress, const size_t size) {
spiBaseAddress->TXD.PTR = 0;
spiBaseAddress->TXD.MAXCNT = 0;
spiBaseAddress->TXD.LIST = 0;
@@ -195,8 +195,8 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size) {
auto currentSize = std::min((size_t) 255, (size_t) currentBufferSize);
PrepareTx(currentBufferAddr, currentSize);
- currentBufferSize -= currentSize;
- currentBufferAddr += currentSize;
+ currentBufferSize = currentBufferSize - currentSize;
+ currentBufferAddr = currentBufferAddr + currentSize;
spiBaseAddress->TASKS_START = 1;
if (size == 1) {
diff --git a/src/drivers/Watchdog.cpp b/src/drivers/Watchdog.cpp
index 6c2c963b..eeeb6cfd 100644
--- a/src/drivers/Watchdog.cpp
+++ b/src/drivers/Watchdog.cpp
@@ -41,7 +41,7 @@ namespace {
// RRED (Reload Register Enable) is a bitfield of 8 bits. Each bit represent
// one of the eight reload registers available.
// In this case, we enable only the first one.
- NRF_WDT->RREN |= 1;
+ NRF_WDT->RREN = NRF_WDT->RREN | 1;
}
/// Returns the reset reason provided by the POWER subsystem