aikopras / AP_DCC_Decoder_Core

Core library for DCC accessory decoders that use the RS-Bus for feedback. PoM feedback messages use (instead of RailCom) the RS-Bus with address 128.
GNU General Public License v3.0
0 stars 0 forks source link

Compatibility extension with AVR DX (all items from DXCore) and MegaTiny CPU #3

Closed LaurentR59 closed 1 year ago

LaurentR59 commented 1 year ago

Hi

I suggest some minor change to map with DXCORE latest updates and MegatinyCore.

File sup_isr.cpp can be change with these lines to offer MegaTiny Support and manage NANO EVERY on classic isr mode +include alla AVR DX parts.

`

  #include <Arduino.h>

  #if defined(__AVR_MEGA__)
    // Only runs on Atmega (AVR) processors
    #if defined(__AVR_XMEGA__)
        // These are the new megaAVR 0, AVR DA DB DD (EA) processors and MegaTiny      
        #if defined (ARDUINO_AVR_NANO_EVERY) 
          // This is the Arduino Nano Every, using an Arduino megaAVR board 
          #include "sup_isr_Nano_Every.h"        
       #elif defined(MEGACOREX)
        // megaAVR 0 but not NanoEvery
       #include "sup_isr_MegaCoreX_DxCore.h"         
        #elif defined(_AVR_FAMILY) 
          //AVR DA DB DD (EA) or MegaTiny CPU Core
          #include "sup_isr_MegaCoreX_DxCore.h"                
        #endif   
    #else
      // These are the traditional ATmega processors
      // Examples are ATmega16A, 328 and 2560
      #include "sup_isr_Mega.h"
    #endif
  #else
    #if defined(MIGHTYCORE)
      // The 8535 isn't defined as __AVR_MEGA__, but works
      #include "sup_isr_Mega.h"
    #endif  
  #endif

` May be not perfect due to some limitation on Tinys (nb of timers as exemple) but should do the job respecting their specific hardwares.

CPU availability should be better anyaway, let offer more choices to cover needs.

Hope it could help :)

Laurent

aikopras commented 1 year ago

Hi Laurent

Just a quick answer; we’re just back from holidays. I’ll take a look at this within the next couple of days.

Thanks Aiko

On 14 Feb 2023, at 18:03, LaurentR59 @.***> wrote:

Hi

I suggest some minor change to map with DXCORE latest updates and MegatinyCore.

File sup_isr.cpp can be change with these lines to offer MegaTiny Support and manage NANO EVERY on classic isr mode +include alla AVR DX parts. `

include

if defined(AVR_MEGA)

// Only runs on Atmega (AVR) processors

if defined(AVR_XMEGA)

// These are the new megaAVR 0, AVR DA DB DD (EA) processors and MegaTiny

if defined (ARDUINO_AVR_NANO_EVERY)

// This is the Arduino Nano Every, using an Arduino megaAVR board

include "sup_isr_Nano_Every.h"

elif defined(MEGACOREX)

// megaAVR 0 but not NanoEvery
#include "sup_isr_MegaCoreX_DxCore.h"  

elif defined(_AVR_FAMILY)

//AVR DA DB DD (EA) or MegaTiny CPU Core
#include "sup_isr_MegaCoreX_DxCore.h"        

endif

else

// These are the traditional ATmega processors // Examples are ATmega16A, 328 and 2560

include "sup_isr_Mega.h"

endif

else

if defined(MIGHTYCORE)

// The 8535 isn't defined as AVR_MEGA, but works

include "sup_isr_Mega.h"

endif

endif

` May be not perfect due to some limitation on Tinys (nb of timers as exemple) but should do the job respecting their specific hardwares.

Hope it could help :)

Laurent

— Reply to this email directly, view it on GitHub https://github.com/aikopras/AP_DCC_Decoder_Core/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWARMTZXBLBAPP5ASYQESLWXO3HNANCNFSM6AAAAAAU32CRTY. You are receiving this because you are subscribed to this thread.

aikopras commented 1 year ago

Hi Laurent

Thanks a lot; I've included it in the source code. I haven't made a new release yet, but I'll do after I looked at the other issues. Aiko