Skip to content

Commit

Permalink
Fixes for PR 2046 (SPI transaction hooks)
Browse files Browse the repository at this point in the history
  • Loading branch information
mark9064 committed May 2, 2024
1 parent 8b22bcd commit 1a89910
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sim/drivers/SpiMaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void SpiMaster::OnStartedEvent() {
// 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)
// return false;
// auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
Expand Down
3 changes: 2 additions & 1 deletion sim/drivers/SpiMaster.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <cstddef>
#include <cstdint>
#include <functional>

#include <FreeRTOS.h>
//#include <semphr.h>
Expand Down Expand Up @@ -30,7 +31,7 @@ namespace Pinetime {
SpiMaster& operator=(SpiMaster&&) = delete;

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 WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize);
Expand Down

0 comments on commit 1a89910

Please sign in to comment.