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

Teensy compatibility issues

This commit is contained in:
Asbelos 2022-01-11 11:22:20 +00:00
parent 41cda58bef
commit 35f7ac3d77
5 changed files with 14 additions and 13 deletions

View File

@ -98,22 +98,20 @@ uint8_t I2CManagerClass::read(uint8_t address, uint8_t readBuffer[], uint8_t rea
* returned in the I2CRB as for the asynchronous version.
***************************************************************************/
void I2CManagerClass::queueRequest(I2CRB *req) {
uint8_t status;
switch (req->operation) {
case OPERATION_READ:
status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
req->status = read(req->i2cAddress, req->readBuffer, req->readLen, NULL, 0, req);
break;
case OPERATION_SEND:
status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
req->status = write(req->i2cAddress, req->writeBuffer, req->writeLen, req);
break;
case OPERATION_SEND_P:
status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
req->status = write_P(req->i2cAddress, req->writeBuffer, req->writeLen, req);
break;
case OPERATION_REQUEST:
status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
req->status = read(req->i2cAddress, req->readBuffer, req->readLen, req->writeBuffer, req->writeLen, req);
break;
}
req->status = status;
}
/***************************************************************************

View File

@ -681,7 +681,7 @@ void RMFT2::loop2() {
break;
case OPCODE_IFRANDOM: // do block on random percentage
if (random(100)>=operand) if (!skipIfBlock()) return;
if ((int16_t)random(100)>=operand) if (!skipIfBlock()) return;
break;
case OPCODE_IFRESERVE: // do block if we successfully RERSERVE

View File

@ -22,26 +22,29 @@
#include "DCCEXParser.h"
SerialManager * SerialManager::first=NULL;
SerialManager::SerialManager(HardwareSerial * myserial) {
SerialManager::SerialManager(Stream * myserial) {
serial=myserial;
next=first;
first=this;
bufferLength=0;
myserial->begin(115200);
inCommandPayload=false;
}
void SerialManager::init() {
#ifdef SERIAL3_COMMANDS
Serial3.begin(115200);
new SerialManager(&Serial3);
#endif
#ifdef SERIAL2_COMMANDS
Serial2.begin(115200);
new SerialManager(&Serial2);
#endif
#ifdef SERIAL1_COMMANDS
Serial1.begin(115200);
new SerialManager(&Serial1);
#endif
new SerialManager(&Serial);
Serial.begin(115200);
new SerialManager(&Serial);
}
void SerialManager::broadcast(RingStream * ring) {

View File

@ -37,10 +37,10 @@ public:
private:
static SerialManager * first;
SerialManager(HardwareSerial * myserial);
SerialManager(Stream * myserial);
void loop2();
void broadcast2(RingStream * ring);
HardwareSerial * serial;
Stream * serial;
SerialManager * next;
byte bufferLength;
byte buffer[COMMAND_BUFFER_SIZE];

View File

@ -3,7 +3,7 @@
#include "StringFormatter.h"
#define VERSION "3.2.0 rc10"
#define VERSION "3.2.0 rc11"
// 3.2.0 Major functional and non-functional changes.
// New HAL added for I/O (digital and analogue inputs and outputs, servos etc).
// Support for MCP23008, MCP23017 and PCF9584 I2C GPIO Extender modules.