Fixes for PR 2046 (SPI transaction hooks) (#141)

This commit is contained in:
mark9064 2024-05-03 21:40:59 +01:00 committed by GitHub
parent 5ad8c0356e
commit 1fb70a2490
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

@ -1 +1 @@
Subproject commit a6cd3679eb1219865a215d0600c9703b198f9157 Subproject commit 06c69353156559aa786e8116f2527e8de3ee2d38

View File

@ -176,7 +176,7 @@ void SpiMaster::OnStartedEvent() {
// spiBaseAddress->EVENTS_END = 0; // spiBaseAddress->EVENTS_END = 0;
//} //}
bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size) { bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& preTransactionHook) {
// if (data == nullptr) // if (data == nullptr)
// return false; // return false;
// auto ok = xSemaphoreTake(mutex, portMAX_DELAY); // auto ok = xSemaphoreTake(mutex, portMAX_DELAY);

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include <functional>
#include <FreeRTOS.h> #include <FreeRTOS.h>
//#include <semphr.h> //#include <semphr.h>
@ -30,7 +31,7 @@ namespace Pinetime {
SpiMaster& operator=(SpiMaster&&) = delete; SpiMaster& operator=(SpiMaster&&) = delete;
bool Init(); bool Init();
bool Write(uint8_t pinCsn, const uint8_t* data, size_t size); bool Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& preTransactionHook);
bool Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize); bool Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize);
bool WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize); bool WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize);