gueei / DShot-Arduino

DShot implementation for Arduino using bit-banging method
68 stars 25 forks source link

Support for ATMega4809 #4

Open theely opened 2 years ago

theely commented 2 years ago

The library is not compiling on ATMega4809, would it be possible to add support for it?

CAP1Sup commented 2 years ago

The issue is that the library is written using register commands and writing bits into the registers. Unfortunately, it would have to be almost completely re-written in order to work on another processor

gueei commented 2 years ago

I think it is possible, as long as it is ATMega based and 8MHz clock.. You may try to add the PORT to this part in the DShot.h file:

#if defined(__AVR_ATmega328P__)
// For UNO, PortD 0-7: i.e. D0-D7
#define DSHOT_PORT PORTD
#endif

#if defined(__AVR_ATmega8__)
// For UNO, PortD 0-7: i.e. D0-D7
#define DSHOT_PORT PORTD
// ADDON for timers
#define TIMSK1 TIMSK
#endif

#if defined(__AVR_ATmega32U4__)
// For Leonardo, PortB 4-7: i.e. D8-D11
#define DSHOT_PORT PORTB
#endif