merged in master and added initAccessoryDecoder method
This commit is contained in:
14
NmraDcc.cpp
14
NmraDcc.cpp
@@ -248,7 +248,7 @@ void ExternalInterruptHandler(void)
|
|||||||
DccBitVal = ( bitMicros < bitMax );
|
DccBitVal = ( bitMicros < bitMax );
|
||||||
lastMicros = actMicros;
|
lastMicros = actMicros;
|
||||||
//#ifdef debug
|
//#ifdef debug
|
||||||
if(DccBitVal) SET_TP2; else CLR_TP2;
|
if(DccBitVal) {SET_TP2} else {CLR_TP2};
|
||||||
//#endif
|
//#endif
|
||||||
sei(); // time critical is only the micros() command,so allow nested irq's
|
sei(); // time critical is only the micros() command,so allow nested irq's
|
||||||
#ifdef DCC_DEBUG
|
#ifdef DCC_DEBUG
|
||||||
@@ -939,6 +939,11 @@ void NmraDcc::pin( uint8_t ExtIntNum, uint8_t ExtIntPinNum, uint8_t EnablePullup
|
|||||||
digitalWrite(ExtIntPinNum, HIGH);
|
digitalWrite(ExtIntPinNum, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NmraDcc::initAccessoryDecoder( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, uint8_t OpsModeAddressBaseCV )
|
||||||
|
{
|
||||||
|
init(ManufacturerId, VersionId, Flags | FLAGS_DCC_ACCESSORY_DECODER, OpsModeAddressBaseCV);
|
||||||
|
}
|
||||||
|
|
||||||
void NmraDcc::init( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, uint8_t OpsModeAddressBaseCV )
|
void NmraDcc::init( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, uint8_t OpsModeAddressBaseCV )
|
||||||
{
|
{
|
||||||
// Clear all the static member variables
|
// Clear all the static member variables
|
||||||
@@ -955,15 +960,14 @@ void NmraDcc::init( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, ui
|
|||||||
DccProcState.Flags = Flags ;
|
DccProcState.Flags = Flags ;
|
||||||
DccProcState.OpsModeAddressBaseCV = OpsModeAddressBaseCV ;
|
DccProcState.OpsModeAddressBaseCV = OpsModeAddressBaseCV ;
|
||||||
|
|
||||||
|
// Set the Bits that control Multifunction or Accessory behaviour
|
||||||
|
// and if the Accessory decoder optionally handles Output Addressing
|
||||||
uint8_t cv29Mask = Flags & (CV29_ACCESSORY_DECODER | CV29_OUTPUT_ADDRESS_MODE) ; // peal off the top two bits
|
uint8_t cv29Mask = Flags & (CV29_ACCESSORY_DECODER | CV29_OUTPUT_ADDRESS_MODE) ; // peal off the top two bits
|
||||||
|
writeCV( CV_29_CONFIG, ( readCV( CV_29_CONFIG ) & ~cv29Mask ) | Flags ) ;
|
||||||
|
|
||||||
writeCV( 7, VersionId ) ;
|
writeCV( 7, VersionId ) ;
|
||||||
writeCV( 8, ManufacturerId ) ;
|
writeCV( 8, ManufacturerId ) ;
|
||||||
|
|
||||||
// Set the Bits that control Multifunction or Accessory behaviour
|
|
||||||
// and if the Accessory decoder optionally handles Output Addressing
|
|
||||||
writeCV( CV_29_CONFIG, ( readCV( CV_29_CONFIG ) & ~cv29Mask ) | cv29Mask ) ;
|
|
||||||
|
|
||||||
clearDccProcState( 0 );
|
clearDccProcState( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -190,6 +190,7 @@ class NmraDcc
|
|||||||
#define FLAGS_DCC_ACCESSORY_DECODER 0x80 // CV 29/541 bit 7
|
#define FLAGS_DCC_ACCESSORY_DECODER 0x80 // CV 29/541 bit 7
|
||||||
void pin( uint8_t ExtIntNum, uint8_t ExtIntPinNum, uint8_t EnablePullup);
|
void pin( uint8_t ExtIntNum, uint8_t ExtIntPinNum, uint8_t EnablePullup);
|
||||||
void init( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, uint8_t OpsModeAddressBaseCV );
|
void init( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, uint8_t OpsModeAddressBaseCV );
|
||||||
|
void initAccessoryDecoder( uint8_t ManufacturerId, uint8_t VersionId, uint8_t Flags, uint8_t OpsModeAddressBaseCV );
|
||||||
uint8_t process();
|
uint8_t process();
|
||||||
uint8_t getCV( uint16_t CV );
|
uint8_t getCV( uint16_t CV );
|
||||||
uint8_t setCV( uint16_t CV, uint8_t Value);
|
uint8_t setCV( uint16_t CV, uint8_t Value);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
name=NmraDcc
|
name=NmraDcc
|
||||||
version=1.2.0
|
version=1.2.1
|
||||||
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky
|
author=Alex Shepherd, Wolfgang Kuffer, Geoff Bunza, Martin Pischky
|
||||||
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
maintainer=Alex Shepherd <kiwi64ajs@gmail.com>
|
||||||
sentence=Enables NMRA DCC Communication
|
sentence=Enables NMRA DCC Communication
|
||||||
|
Reference in New Issue
Block a user