mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-23 16:16:13 +01:00
Compare commits
No commits in common. "31833972cda18b72ce5d62b8111247e68f21f3cd" and "2cfcba5cb2e91fa702e67b43789b8e7c4dbc33e5" have entirely different histories.
31833972cd
...
2cfcba5cb2
|
@ -228,6 +228,7 @@ LookList* RMFT2::LookListLoader(OPCODE op1, OPCODE op2, OPCODE op3) {
|
||||||
case OPCODE_AT:
|
case OPCODE_AT:
|
||||||
case OPCODE_ATTIMEOUT2:
|
case OPCODE_ATTIMEOUT2:
|
||||||
case OPCODE_AFTER:
|
case OPCODE_AFTER:
|
||||||
|
case OPCODE_AFTEROVERLOAD:
|
||||||
case OPCODE_IF:
|
case OPCODE_IF:
|
||||||
case OPCODE_IFNOT: {
|
case OPCODE_IFNOT: {
|
||||||
int16_t pin = (int16_t)operand;
|
int16_t pin = (int16_t)operand;
|
||||||
|
|
10
I2CManager.h
10
I2CManager.h
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* © 2023, Neil McKechnie. All rights reserved.
|
* © 2023, Neil McKechnie. All rights reserved.
|
||||||
* © 2022-2024 Paul M Antoine
|
* © 2022 Paul M Antoine
|
||||||
*
|
*
|
||||||
* This file is part of CommandStation-EX
|
* This file is part of CommandStation-EX
|
||||||
*
|
*
|
||||||
|
@ -519,14 +519,14 @@ private:
|
||||||
|
|
||||||
// State is set to I2C_STATE_FREE when the interrupt handler has finished
|
// State is set to I2C_STATE_FREE when the interrupt handler has finished
|
||||||
// the current request and is ready to complete.
|
// the current request and is ready to complete.
|
||||||
uint8_t volatile state = I2C_STATE_FREE;
|
uint8_t state = I2C_STATE_FREE;
|
||||||
|
|
||||||
// CompletionStatus may be set by the interrupt handler at any time but is
|
// CompletionStatus may be set by the interrupt handler at any time but is
|
||||||
// not written to the I2CRB until the state is I2C_STATE_FREE.
|
// not written to the I2CRB until the state is I2C_STATE_FREE.
|
||||||
uint8_t volatile completionStatus = I2C_STATUS_OK;
|
uint8_t completionStatus = I2C_STATUS_OK;
|
||||||
uint8_t volatile overallStatus = I2C_STATUS_OK;
|
uint8_t overallStatus = I2C_STATUS_OK;
|
||||||
|
|
||||||
I2CRB * volatile currentRequest = NULL;
|
I2CRB * currentRequest = NULL;
|
||||||
uint8_t txCount = 0;
|
uint8_t txCount = 0;
|
||||||
uint8_t rxCount = 0;
|
uint8_t rxCount = 0;
|
||||||
uint8_t bytesToSend = 0;
|
uint8_t bytesToSend = 0;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* © 2023, Neil McKechnie
|
* © 2023, Neil McKechnie
|
||||||
* © 2022-2024, Paul M Antoine
|
* © 2022 Paul M Antoine
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This file is part of CommandStation-EX
|
* This file is part of CommandStation-EX
|
||||||
|
@ -245,8 +245,8 @@ void I2CManagerClass::checkForTimeout() {
|
||||||
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
|
||||||
uint32_t elapsed = micros() - startTime;
|
int32_t elapsed = micros() - startTime;
|
||||||
if (elapsed > _timeout) {
|
if (elapsed > (int32_t)_timeout) {
|
||||||
#ifdef DIAG_IO
|
#ifdef DIAG_IO
|
||||||
//DIAG(F("I2CManager Timeout on %s"), t->i2cAddress.toString());
|
//DIAG(F("I2CManager Timeout on %s"), t->i2cAddress.toString());
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,11 +117,11 @@ void I2CManagerClass::I2C_setClock(uint32_t i2cClockSpeed) {
|
||||||
// while (s->CR1 & I2C_CR1_STOP); // Prevents lockup by guarding further
|
// while (s->CR1 & I2C_CR1_STOP); // Prevents lockup by guarding further
|
||||||
// writes to CR1 while STOP is being executed!
|
// writes to CR1 while STOP is being executed!
|
||||||
// Should never happen, but wait for up to 500us only.
|
// Should never happen, but wait for up to 500us only.
|
||||||
uint32_t startTime = micros();
|
unsigned long startTime = micros();
|
||||||
bool timeout = false;
|
bool timeout = false;
|
||||||
while ((s->CR1 & I2C_CR1_STOP) != 0)
|
while ((s->CR1 & I2C_CR1_STOP) != 0)
|
||||||
{
|
{
|
||||||
if ((micros() - startTime) >= 500) {
|
if ((int32_t)(micros() - startTime) >= 500) {
|
||||||
timeout = true;
|
timeout = true;
|
||||||
s->CR1 &= ~I2C_CR1_STOP;
|
s->CR1 &= ~I2C_CR1_STOP;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user