From 63e0c4f4efb047f4f15601f7b08640c4b589de93 Mon Sep 17 00:00:00 2001 From: Jean-François Milants Date: Mon, 23 Oct 2023 20:12:34 +0200 Subject: Application selection at build time A list of "user applications" is built at compile time. It contains all the info needed to create the application at runtime (ptr to a create() function) and to display the app in the application menu. All applications declare a TypeTrait with these information. When a new app must be loaded, DisplayApp first check if this app is a System app (in which case it creates it like it did before). If it's not a System app, it looks for the app in the list of User applications and creates it if it found it. Those changes allow to more easily add new app and to select which app must be built into the firmware. Switch to C++20 (and fix a few issues in SpiMaster.cpp and Watchdog.cpp. --- src/drivers/SpiMaster.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/drivers/SpiMaster.cpp') 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) { -- cgit v1.2.3-70-g09d2