NRF5: Enable critical section (#879)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
CircularBuffer - An Arduino circular buffering library for arbitrary types.
|
CircularBuffer - An Arduino circular buffering library for arbitrary types.
|
||||||
|
|
||||||
Created by Ivo Pullens, Emmission, 2014-2016 -- www.emmission.nl
|
Created by Ivo Pullens, Emmission, 2014-2016 -- www.emmission.nl
|
||||||
@@ -88,9 +88,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline uint8_t available(void) const
|
inline uint8_t available(void) const
|
||||||
{
|
{
|
||||||
|
uint8_t ret_value;
|
||||||
MY_CRITICAL_SECTION {
|
MY_CRITICAL_SECTION {
|
||||||
return m_fill;
|
ret_value = m_fill;
|
||||||
}
|
}
|
||||||
|
return ret_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -130,9 +130,7 @@ typedef struct {
|
|||||||
} nrf_ecb_t;
|
} nrf_ecb_t;
|
||||||
|
|
||||||
#ifndef DOXYGEN
|
#ifndef DOXYGEN
|
||||||
#define MY_CRITICAL_SECTION
|
#define MY_CRITICAL_SECTION \
|
||||||
// temp. commented, to fix "CircularBuffer.h:94:2: warning: control reaches end of non-void function" error
|
|
||||||
#define __MY_CRITICAL_SECTION \
|
|
||||||
for (uint32_t __savePriMask \
|
for (uint32_t __savePriMask \
|
||||||
__attribute__((__cleanup__(__priMaskRestore))) = __get_PRIMASK(), \
|
__attribute__((__cleanup__(__priMaskRestore))) = __get_PRIMASK(), \
|
||||||
__ToDo = __disableIntsRetVal(); \
|
__ToDo = __disableIntsRetVal(); \
|
||||||
|
|||||||
Reference in New Issue
Block a user