updated the examples to reflect the removal of support for the two call-back functions: notifyDccAccState(), notifyDccSigState()
This commit is contained in:
@@ -1,103 +0,0 @@
|
||||
------------------------------------------------------------------------
|
||||
|
||||
OpenDCC - NmraDcc
|
||||
|
||||
Copyright (c) 2008 Alex Shepherd
|
||||
|
||||
This source file is subject of the GNU general public license 2,
|
||||
that is available at the world-wide-web at
|
||||
http:www.gnu.org/licenses/gpl.txt
|
||||
------------------------------------------------------------------------
|
||||
|
||||
file: Description NmraDcc.txt
|
||||
author:
|
||||
webpage:
|
||||
history:
|
||||
------------------------------------------------------------------------
|
||||
Call the DCC pin function to define which External Interrupt and Pin to use and also to enable the Pull-Up
|
||||
Dcc.pin(0, 2, 1);
|
||||
|
||||
Call the main DCC Init function to enable the DCC Receiver
|
||||
|
||||
Dcc.init( MAN_ID_DIY, 10, FLAGS_OUTPUT_ADDRESS_MODE | FLAGS_DCC_ACCESSORY_DECODER, 0 )
|
||||
|
||||
MAN_ID_DIY = 0x0D (CV8 defined in NmraDcc.h)
|
||||
FLAGS_OUTPUT_ADDRESS_MODE = 0x40 (CV29/541 bit 6 defined in NmraDcc.h)
|
||||
FLAGS_DCC_ACCESSORY_DECODER = 0x80 (CV 29/541 bit 7 defined in NmraDcc.h)
|
||||
------------------------------------------------------------------------
|
||||
You MUST call the NmraDcc.process() method frequently from the Arduino loop()
|
||||
function for correct library operation
|
||||
|
||||
Dcc.process();
|
||||
------------------------------------------------------------------------
|
||||
This function is called whenever a normal DCC Turnout Packet is received
|
||||
|
||||
notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State)
|
||||
|
||||
Addr = Decoder address
|
||||
BoardAddr = Address of this decoder
|
||||
OutputAddr = Address of Turnout on this decoder
|
||||
State =
|
||||
------------------------------------------------------------------------
|
||||
This function is called whenever a DCC Signal Aspect Packet is received
|
||||
|
||||
notifyDccSigState( uint16_t Addr, uint8_t OutputIndex, uint8_t State)
|
||||
|
||||
Addr = Decoder address
|
||||
OutputIndex = Address of Signal Aspect
|
||||
State =
|
||||
------------------------------------------------------------------------
|
||||
notifyDccFunc( uint16_t Addr, uint8_t FuncNum, uint8_t FuncState)
|
||||
|
||||
Addr = Decoder address
|
||||
FuncNum =
|
||||
FuncState =
|
||||
------------------------------------------------------------------------
|
||||
Perform a decoder total reset
|
||||
|
||||
notifyDccReset(uint8_t hardReset )
|
||||
|
||||
hardReset =
|
||||
------------------------------------------------------------------------
|
||||
The decoder receives a Idle packet and should do nothing
|
||||
|
||||
notifyDccIdle(void)
|
||||
------------------------------------------------------------------------
|
||||
A locomotive packet is received
|
||||
|
||||
notifyDccSpeed( uint16_t Addr, uint8_t Speed, uint8_t ForwardDir, uint8_t MaxSpeed )
|
||||
|
||||
Addr = Address received
|
||||
Speed = Requested speed
|
||||
ForwardDir = True if loco moves forward
|
||||
MaxSpeed =
|
||||
------------------------------------------------------------------------
|
||||
Checks if a CV is present in the table and is writable
|
||||
|
||||
notifyCVValid( uint16_t CV, uint8_t Writable )
|
||||
|
||||
CV = The number of the requested CV
|
||||
Writable = True is CV is writable
|
||||
------------------------------------------------------------------------
|
||||
Read a CV value from the decoder table
|
||||
|
||||
notifyCVRead( uint16_t CV)
|
||||
|
||||
CV = The number of the requested CV
|
||||
------------------------------------------------------------------------
|
||||
Write a CV with Value to the decoder table
|
||||
|
||||
notifyCVWrite( uint16_t CV, uint8_t Value)
|
||||
|
||||
CV = The number of the requested CV
|
||||
Value = Value to be written into the requested CV
|
||||
------------------------------------------------------------------------
|
||||
Check if the CV written to the table has the correct value
|
||||
|
||||
notifyCVChange( uint16_t CV, uint8_t Value)
|
||||
|
||||
CV = The number of the requested CV
|
||||
Value = Value of the changed requested CV
|
||||
------------------------------------------------------------------------
|
||||
notifyCVAck(void)
|
||||
|
@@ -471,6 +471,7 @@ extern void notifyDccFunc( uint16_t Addr, DCC_ADDR_TYPE AddrType, FN_GROUP Fu
|
||||
* Returns:
|
||||
* None
|
||||
*/
|
||||
|
||||
extern void notifyDccAccTurnoutBoard( uint16_t BoardAddr, uint8_t OutputPair, uint8_t Direction, uint8_t OutputPower ) __attribute__ ((weak));
|
||||
/*+
|
||||
* notifyDccAccTurnoutOutput() Output oriented callback for a turnout accessory decoder.
|
||||
|
@@ -1,2 +1,8 @@
|
||||
# NmraDcc
|
||||
NMRA Digital Command Control (DCC) Library
|
||||
|
||||
**Warning** as of version 1.4.4 support has been removed for the following two call-back functions, which will cause your sketch to silently stop working:
|
||||
|
||||
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State )
|
||||
extern void notifyDccSigState( uint16_t Addr, uint8_t OutputIndex, uint8_t State)
|
||||
|
||||
|
@@ -56,20 +56,7 @@ void notifyDccMsg( DCC_MSG * Msg)
|
||||
}
|
||||
#endif
|
||||
|
||||
// This function is called whenever a normal DCC Turnout Packet is received
|
||||
void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State)
|
||||
{
|
||||
Serial.print("notifyDccAccState: ") ;
|
||||
Serial.print(Addr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.print(BoardAddr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.print(OutputAddr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.println(State, HEX) ;
|
||||
}
|
||||
|
||||
// This function is called whenever a normal DCC Turnout Packet is received
|
||||
// This function is called whenever a normal DCC Turnout Packet is received and we're in Board Addressing Mode
|
||||
void notifyDccAccTurnoutBoard( uint16_t BoardAddr, uint8_t OutputPair, uint8_t Direction, uint8_t OutputPower )
|
||||
{
|
||||
Serial.print("notifyDccAccTurnoutBoard: ") ;
|
||||
@@ -82,7 +69,7 @@ void notifyDccAccTurnoutBoard( uint16_t BoardAddr, uint8_t OutputPair, uint8_t D
|
||||
Serial.println(OutputPower, HEX) ;
|
||||
}
|
||||
|
||||
// This function is called whenever a normal DCC Turnout Packet is received
|
||||
// This function is called whenever a normal DCC Turnout Packet is received and we're in Output Addressing Mode
|
||||
void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower )
|
||||
{
|
||||
Serial.print("notifyDccAccTurnoutOutput: ") ;
|
||||
@@ -94,13 +81,11 @@ void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t Output
|
||||
}
|
||||
|
||||
// This function is called whenever a DCC Signal Aspect Packet is received
|
||||
void notifyDccSigState( uint16_t Addr, uint8_t OutputIndex, uint8_t State)
|
||||
void notifyDccSigOutputState( uint16_t Addr, uint8_t State)
|
||||
{
|
||||
Serial.print("notifyDccSigState: ") ;
|
||||
Serial.print("notifyDccSigOutputState: ") ;
|
||||
Serial.print(Addr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.print(OutputIndex,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.println(State, HEX) ;
|
||||
}
|
||||
|
||||
|
@@ -134,24 +134,6 @@ void notifyCVResetFactoryDefault()
|
||||
FactoryDefaultCVIndex = sizeof(FactoryDefaultCVs)/sizeof(CVPair);
|
||||
};
|
||||
|
||||
// This function is called whenever a normal DCC Turnout Packet is received
|
||||
#define NOTITY_DCC_ACC_STATE
|
||||
#ifdef NOTITY_DCC_ACC_STATE
|
||||
void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State)
|
||||
{
|
||||
if (ShowData & S_DCC) {
|
||||
Serial.print("notifyDccAccState: ") ;
|
||||
Serial.print(Addr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.print(BoardAddr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.print(OutputAddr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.println(State, HEX) ;
|
||||
}
|
||||
}
|
||||
#endif // NOTITY_DCC_ACC_STATE
|
||||
|
||||
// This function is called whenever a normal DCC Turnout Packet is received
|
||||
#define NOTITY_DCC_ACC_TURNOUT_BOARD
|
||||
#ifdef NOTITY_DCC_ACC_TURNOUT_BOARD
|
||||
@@ -202,7 +184,7 @@ void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t Output
|
||||
// if NOTIFY_DCC_SIG_STATE and SIGNAL_DCC are defined.
|
||||
#define NOTITY_DCC_SIG_STATE
|
||||
#if defined(NOTITY_DCC_SIG_STATE) && defined(SIGNAL_DCC)
|
||||
void notifyDccSigState( uint16_t Addr, uint8_t OutputIndex, uint8_t State)
|
||||
void notifyDccSigOutputState( uint16_t Addr, uint8_t State)
|
||||
{
|
||||
#ifdef DO_SCOPE
|
||||
digitalWrite(SCOPE_PIN, HIGH);
|
||||
@@ -210,11 +192,9 @@ void notifyDccSigState( uint16_t Addr, uint8_t OutputIndex, uint8_t State)
|
||||
#endif // DO_SCOPE
|
||||
|
||||
if (ShowData & S_DCC) {
|
||||
Serial.print("notifyDccSigState: ") ;
|
||||
Serial.print("notifyDccSigOutputState: ") ;
|
||||
Serial.print(Addr,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.print(OutputIndex,DEC) ;
|
||||
Serial.print(',');
|
||||
Serial.println(State, DEC) ;
|
||||
}
|
||||
|
||||
|
@@ -370,22 +370,17 @@ void loop() //****************************************************************
|
||||
}
|
||||
}
|
||||
|
||||
extern void notifyDccAccState( uint16_t Addr, uint16_t BoardAddr, uint8_t OutputAddr, uint8_t State) {
|
||||
uint16_t Current_Decoder_Addr;
|
||||
uint8_t Bit_State;
|
||||
Current_Decoder_Addr = Dcc.getAddr();
|
||||
Bit_State = OutputAddr & 0x01;
|
||||
extern void notifyDccAccTurnoutOutput( uint16_t Addr, uint8_t Direction, uint8_t OutputPower ) {
|
||||
uint16_t Current_Decoder_Addr = Dcc.getAddr();
|
||||
|
||||
if ( Addr >= Current_Decoder_Addr && Addr < Current_Decoder_Addr+17) { //Controls Accessory_Address+16
|
||||
#ifdef DEBUG
|
||||
Serial.print("Addr = ");
|
||||
Serial.println(Addr);
|
||||
Serial.print("BoardAddr = ");
|
||||
Serial.println(BoardAddr);
|
||||
Serial.print("Bit_State = ");
|
||||
Serial.println(Bit_State);
|
||||
Serial.print("Direction = ");
|
||||
Serial.println(Direction);
|
||||
#endif
|
||||
exec_function(Addr-Current_Decoder_Addr, Bit_State );
|
||||
exec_function(Addr-Current_Decoder_Addr, Direction );
|
||||
}
|
||||
}
|
||||
void exec_function (int function, int FuncState) {
|
||||
|
11
keywords.txt
11
keywords.txt
@@ -22,12 +22,13 @@ isSetCVReady KEYWORD2
|
||||
notifyDccReset KEYWORD2
|
||||
notifyDccIdle KEYWORD2
|
||||
notifyDccSpeed KEYWORD2
|
||||
notifyDccSpeedRaw
|
||||
notifyDccSpeedRaw KEYWORD2
|
||||
notifyDccFunc KEYWORD2
|
||||
notifyDccAccState KEYWORD2
|
||||
notifyDccAccTurnoutBoard
|
||||
notifyDccAccTurnoutOutput
|
||||
notifyDccSigState KEYWORD2
|
||||
notifyDccAccTurnoutBoard KEYWORD2
|
||||
notifyDccAccTurnoutOutput KEYWORD2
|
||||
notifyDccAccBoardAddrSet KEYWORD2
|
||||
notifyDccAccOutputAddrSet KEYWORD2
|
||||
notifyDccSigOutputState KEYWORD2
|
||||
notifyDccMsg KEYWORD2
|
||||
notifyCVValid KEYWORD2
|
||||
notifyCVRead KEYWORD2
|
||||
|
@@ -3,7 +3,7 @@ version=1.4.4
|
||||
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky, Franz-Peter Müller, Sven (littleyoda)
|
||||
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
||||
sentence=Enables NMRA DCC Communication
|
||||
paragraph=This library allows you to interface to a NMRA DCC track signal and receive DCC commands. The library currently supports the AVR ATTiny84/85 & ATMega88/168/328/32u4 and Teensy 3.x using the INT0/1 Hardware Interrupt and micros() ONLY and no longer uses Timer0 Compare Match B, which makes it much more portable to other platforms
|
||||
paragraph=This library allows you to interface to a NMRA DCC track signal and receive DCC commands. The library currently supports the AVR ATTiny84/85 & ATMega88/168/328/32u4 and Teensy 3.x using the INT0/1 Hardware Interrupt and micros() ONLY and no longer uses Timer0 Compare Match B, which makes it much more portable to other platforms. ALSO BEWARE as of version 1.4.4 support for the call-back functions notifyDccAccState() and notifyDccSigState() has been removed, please check and update your sketches, as they will silently fail.
|
||||
category=Communication
|
||||
url=http://mrrwa.org/dcc-decoder-interface/
|
||||
architectures=avr,esp8266,STM32F1
|
||||
|
Reference in New Issue
Block a user