1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-26 17:46:14 +01:00

Update I2CManager_NonBlocking.h

Cosmetic changes
This commit is contained in:
Neil McKechnie 2023-02-16 16:41:33 +00:00
parent 8ed3bbd845
commit 6b863ea483

View File

@ -109,7 +109,7 @@ void I2CManagerClass::_setClock(unsigned long i2cClockSpeed) {
* starting the operation. * starting the operation.
***************************************************************************/ ***************************************************************************/
void I2CManagerClass::startTransaction() { void I2CManagerClass::startTransaction() {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ATOMIC_BLOCK() {
if ((state == I2C_STATE_FREE) && (queueHead != NULL)) { if ((state == I2C_STATE_FREE) && (queueHead != NULL)) {
state = I2C_STATE_ACTIVE; state = I2C_STATE_ACTIVE;
completionStatus = I2C_STATUS_OK; completionStatus = I2C_STATUS_OK;
@ -174,7 +174,7 @@ void I2CManagerClass::startTransaction() {
void I2CManagerClass::queueRequest(I2CRB *req) { void I2CManagerClass::queueRequest(I2CRB *req) {
req->status = I2C_STATUS_PENDING; req->status = I2C_STATUS_PENDING;
req->nextRequest = NULL; req->nextRequest = NULL;
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ATOMIC_BLOCK() {
if (!queueTail) if (!queueTail)
queueHead = queueTail = req; // Only item on queue queueHead = queueTail = req; // Only item on queue
else else
@ -236,7 +236,7 @@ void I2CManagerClass::setTimeout(unsigned long value) {
* may be caused by an I2C wire short for example. * may be caused by an I2C wire short for example.
***************************************************************************/ ***************************************************************************/
void I2CManagerClass::checkForTimeout() { void I2CManagerClass::checkForTimeout() {
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) { ATOMIC_BLOCK() {
I2CRB *t = queueHead; I2CRB *t = queueHead;
if (state==I2C_STATE_ACTIVE && t!=0 && t==currentRequest && _timeout > 0) { if (state==I2C_STATE_ACTIVE && t!=0 && t==currentRequest && _timeout > 0) {
// Check for timeout // Check for timeout