summaryrefslogtreecommitdiff
path: root/src/drivers/SpiMaster.h
diff options
context:
space:
mode:
authorJF <jf@codingfield.com>2020-05-17 07:35:01 (GMT)
committerJF <jf@codingfield.com>2020-05-17 07:35:01 (GMT)
commit79131f4fe38bfd42f6df0765ffbf7f18cf5a862e (patch)
treee2770c9df4b4f3999b71a2df73716b842d74f538 /src/drivers/SpiMaster.h
parent9753967d8aa4c2d9d7af1246dcf4835c6ed21728 (diff)
Improve SPI driver (use a mutex to prevent race conditions).
Diffstat (limited to 'src/drivers/SpiMaster.h')
-rw-r--r--src/drivers/SpiMaster.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h
index 362f480..8a633b7 100644
--- a/src/drivers/SpiMaster.h
+++ b/src/drivers/SpiMaster.h
@@ -7,6 +7,8 @@
#include <task.h>
#include "BufferProvider.h"
+#include <semphr.h>
+
namespace Pinetime {
namespace Drivers {
class SpiMaster {
@@ -51,10 +53,10 @@ namespace Pinetime {
SpiMaster::SpiModule spi;
SpiMaster::Parameters params;
- volatile bool busy = false;
volatile uint32_t currentBufferAddr = 0;
volatile size_t currentBufferSize = 0;
volatile TaskHandle_t taskToNotify;
+ SemaphoreHandle_t mutex;
};
}
}