1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-11-23 16:16:13 +01:00

Push with DIAGS

This commit is contained in:
peteGSX 2024-01-16 19:37:16 +10:00
parent 95bf5aae38
commit c2bd012164
2 changed files with 30 additions and 0 deletions

View File

@ -418,6 +418,27 @@ public:
#if !defined(I2C_USE_WIRE)
I2CRB *nextRequest; // Used by non-blocking devices for I2CRB queue management.
#endif
inline void dump() {
switch (operation & OPERATION_MASK) {
case OPERATION_READ:
DIAG(F("Read addr=%x buf=%x, len=%d"), i2cAddress, readBuffer, readLen);
break;
case OPERATION_SEND:
DIAG(F("Send addr=%x buf=%x, len=%d"), i2cAddress, writeBuffer, writeLen);
break;
case OPERATION_SEND_P:
DIAG(F("SendP addr=%x buf=%x, len=%d"), i2cAddress, writeBuffer, writeLen);
break;
case OPERATION_REQUEST:
DIAG(F("Request addr=%x rbuf=%x, rlen=%d rbuf=%x, rlen=%d"), i2cAddress, readBuffer, readLen, writeBuffer, writeLen);
break;
default:
DIAG(F("No Op... WHAT???"));
break;
}
};
};
// I2C Manager

View File

@ -146,6 +146,7 @@ uint8_t I2CManagerClass::write_P(I2CAddress address, const uint8_t buffer[], uin
uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t readSize,
const uint8_t writeBuffer[], uint8_t writeSize, I2CRB *rb)
{
DIAG(F("I2CManagerClass::read()"));
uint8_t status, muxStatus;
uint8_t nBytes = 0;
uint8_t retryCount = 0;
@ -210,6 +211,11 @@ uint8_t I2CManagerClass::read(I2CAddress address, uint8_t readBuffer[], uint8_t
* the non-blocking version.
***************************************************************************/
void I2CManagerClass::queueRequest(I2CRB *req) {
if (req==NULL) {
DIAG(F("NOOOOOOOOOOO"));
return;
}
req->dump();
switch (req->operation & OPERATION_MASK) {
case OPERATION_READ:
read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
@ -223,6 +229,9 @@ void I2CManagerClass::queueRequest(I2CRB *req) {
case OPERATION_REQUEST:
read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
break;
default:
DIAG(F("No Op... WHAT???"));
break;
}
}