mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-24 08:36:14 +01:00
Compare commits
4 Commits
b41bb305dc
...
9b91c2117c
Author | SHA1 | Date | |
---|---|---|---|
|
9b91c2117c | ||
|
96fdbfdc89 | ||
|
183b824a5d | ||
|
50863600da |
|
@ -542,8 +542,10 @@ protected:
|
||||||
#include "IO_MCP23017.h"
|
#include "IO_MCP23017.h"
|
||||||
#include "IO_PCF8574.h"
|
#include "IO_PCF8574.h"
|
||||||
#include "IO_PCF8575.h"
|
#include "IO_PCF8575.h"
|
||||||
|
#include "IO_PCA9555.h"
|
||||||
#include "IO_duinoNodes.h"
|
#include "IO_duinoNodes.h"
|
||||||
#include "IO_EXIOExpander.h"
|
#include "IO_EXIOExpander.h"
|
||||||
|
#include "IO_trainbrains.h"
|
||||||
|
|
||||||
|
|
||||||
#endif // iodevice_h
|
#endif // iodevice_h
|
||||||
|
|
98
IO_trainbrains.h
Normal file
98
IO_trainbrains.h
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
/*
|
||||||
|
* © 2023, Chris Harlow. All rights reserved.
|
||||||
|
* © 2021, Neil McKechnie. All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of DCC++EX API
|
||||||
|
*
|
||||||
|
* This is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* It is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with CommandStation. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef io_trainbrains_h
|
||||||
|
#define io_trainbrains_h
|
||||||
|
|
||||||
|
#include "IO_GPIOBase.h"
|
||||||
|
#include "FSH.h"
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/*
|
||||||
|
* IODevice subclass for trainbrains 3-block occupancy detector.
|
||||||
|
* For details see http://trainbrains.eu
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum TrackUnoccupancy
|
||||||
|
{
|
||||||
|
TRACK_UNOCCUPANCY_UNKNOWN = 0,
|
||||||
|
TRACK_OCCUPIED = 1,
|
||||||
|
TRACK_UNOCCUPIED = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
class Trainbrains02 : public GPIOBase<uint16_t> {
|
||||||
|
public:
|
||||||
|
static void create(VPIN vpin, uint8_t nPins, I2CAddress i2cAddress) {
|
||||||
|
if (checkNoOverlap(vpin, nPins, i2cAddress)) new Trainbrains02(vpin, nPins, i2cAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Constructor
|
||||||
|
Trainbrains02(VPIN vpin, uint8_t nPins, I2CAddress i2cAddress, int interruptPin=-1)
|
||||||
|
: GPIOBase<uint16_t>((FSH *)F("Trainbrains02"), vpin, nPins, i2cAddress, interruptPin)
|
||||||
|
{
|
||||||
|
requestBlock.setRequestParams(_I2CAddress, inputBuffer, sizeof(inputBuffer),
|
||||||
|
outputBuffer, sizeof(outputBuffer));
|
||||||
|
|
||||||
|
outputBuffer[0] = (uint8_t)_I2CAddress; // strips away the mux part.
|
||||||
|
outputBuffer[1] =14;
|
||||||
|
outputBuffer[2] =1;
|
||||||
|
outputBuffer[3] =0; // This is the channel updated at each poling call
|
||||||
|
outputBuffer[4] =0;
|
||||||
|
outputBuffer[5] =0;
|
||||||
|
outputBuffer[6] =0;
|
||||||
|
outputBuffer[7] =0;
|
||||||
|
outputBuffer[8] =0;
|
||||||
|
outputBuffer[9] =0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _writeGpioPort() override {}
|
||||||
|
|
||||||
|
void _readGpioPort(bool immediate) override {
|
||||||
|
// cycle channel on device each time
|
||||||
|
outputBuffer[3]=channelInProgress+1; // 1-origin
|
||||||
|
channelInProgress++;
|
||||||
|
if(channelInProgress>=_nPins) channelInProgress=0;
|
||||||
|
|
||||||
|
if (immediate) {
|
||||||
|
_processCompletion(I2CManager.read(_I2CAddress, inputBuffer, sizeof(inputBuffer),
|
||||||
|
outputBuffer, sizeof(outputBuffer)));
|
||||||
|
} else {
|
||||||
|
// Queue new request
|
||||||
|
requestBlock.wait(); // Wait for preceding operation to complete
|
||||||
|
// Issue new request to read GPIO register
|
||||||
|
I2CManager.queueRequest(&requestBlock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function is invoked when an I/O operation on the requestBlock completes.
|
||||||
|
void _processCompletion(uint8_t status) override {
|
||||||
|
if (status != I2C_STATUS_OK) inputBuffer[6]=TRACK_UNOCCUPANCY_UNKNOWN;
|
||||||
|
if (inputBuffer[6] == TRACK_UNOCCUPIED ) _portInputState |= 0x01 <<channelInProgress;
|
||||||
|
else _portInputState &= ~(0x01 <<channelInProgress);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t channelInProgress=0;
|
||||||
|
uint8_t outputBuffer[10];
|
||||||
|
uint8_t inputBuffer[10];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
17
version.h
17
version.h
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
#include "StringFormatter.h"
|
#include "StringFormatter.h"
|
||||||
|
|
||||||
#define VERSION "5.2.9"
|
#define VERSION "5.2.10"
|
||||||
|
// 5.2.10 - Include trainbrains.eu block unoccupancy driver
|
||||||
|
// - include IO_PCA9555
|
||||||
// 5.2.9 - Bugfix LCD startup with no LCD, uses <@
|
// 5.2.9 - Bugfix LCD startup with no LCD, uses <@
|
||||||
// 5.2.9 - EXRAIL STASH feature
|
// 5.2.9 - EXRAIL STASH feature
|
||||||
// 5.2.8 - Bugfix: Do not turn off all tracks on change
|
// 5.2.8 - Bugfix: Do not turn off all tracks on change
|
||||||
|
@ -195,9 +197,18 @@
|
||||||
// TrackManager DCC & DC up to 8 Districts Architecture
|
// TrackManager DCC & DC up to 8 Districts Architecture
|
||||||
// Automatic ALIAS(name)
|
// Automatic ALIAS(name)
|
||||||
// Command Parser now accepts Underscore in Alias Names
|
// Command Parser now accepts Underscore in Alias Names
|
||||||
|
// 4.1.6 Support for new EX-MotorShield8874 Dual 5Amp Shield
|
||||||
|
// 4.1.5 Bugfix LCN number parsing
|
||||||
|
// 4.1.4 Bugfix for issue #299 TurnoutDescription NULL
|
||||||
|
// 4.1.3 Bugfix: Ethernet init order
|
||||||
|
// 4.1.2 Bugfix: Ethernet shield W5100 does not report HW or link level
|
||||||
// 4.1.1 Bugfix: preserve turnout format
|
// 4.1.1 Bugfix: preserve turnout format
|
||||||
// Bugfix: parse multiple commands in one buffer string correct
|
// Bugfix: parse multiple commands in one buffer string correctly (ex: <s><Q>)
|
||||||
// Bugfix: </> command signal status in Exrail
|
// Bugfix: </> command signal status of EX-RAIL tasks or threads
|
||||||
|
// Bugfix: EX-RAIL read long loco addr
|
||||||
|
// Bugfix: Add space character after version string 4.1.1 for JMRI parsing.
|
||||||
|
// Improved display and loop time for signals make service start to be outside the DONT_TOUCH_WIFI_CONF area
|
||||||
|
// Improve WiFi startup by making service start to be outside the DONT_TOUCH_WIFI_CONF area
|
||||||
// 4.1.0 ...
|
// 4.1.0 ...
|
||||||
//
|
//
|
||||||
// 4.0.2 EXRAIL additions:
|
// 4.0.2 EXRAIL additions:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user