digitalWriteFast icon indicating copy to clipboard operation
digitalWriteFast copied to clipboard

digitalWriteFast does not appear to work on AVR4809

Open paulskirk53 opened this issue 2 years ago • 5 comments

I included the library :

#include <digitalWriteFast.h>

The code snippet below toggles a Led:

void lightup()
{
  for (int i = 0; i < 10; i++)
  {
    digitalWrite(ledpin, HIGH);
    delay(500);
    digitalWrite(ledpin, LOW);
    delay(500);
  }

But the code below does not

void lightup()
{
  for (int i = 0; i < 10; i++)
  {
    digitalWriteFast(ledpin, HIGH);
    delay(500);
    digitalWriteFast(ledpin, LOW);
    delay(500);
  }

Perhaps I missed something?

paulskirk53 avatar Aug 14 '23 11:08 paulskirk53

Maybe different pin numbering scheme?

ArminJo avatar Aug 14 '23 12:08 ArminJo

Ah yes, although i've included the Arduino library, the chip architecture is different. Thanks. :)

paulskirk53 avatar Aug 14 '23 18:08 paulskirk53

But looks still like AVR on Arduino it is

microchip.com/en-us/product/atmega4809

ATmega4809 is a microcontroller featuring the 8-bit AVR® processor with hardware multiplier - running at up to 20 MHz and with up to 48 KB Flash, 6 KB SRAM and 256 bytes of EEPROM in 48-pin packages. ...

Meins321 avatar Aug 15 '23 09:08 Meins321

How do you think is ledpin mapped to hardware?

ArminJo avatar Aug 15 '23 09:08 ArminJo

looks like megacorex already has support for fast IO (digitalreadfast/ writefast) on this hardware family

https://github.com/MCUdude/MegaCoreX

paulskirk53 avatar Aug 15 '23 10:08 paulskirk53

Should be fixed now 😀

ArminJo avatar Nov 17 '24 11:11 ArminJo