ArminJo / digitalWriteFast

Arduino library for faster and smaller digitalWrite(), digitalRead() and pinMode() functions using direct port manipulation for constant pin numbers.
BSD 3-Clause "New" or "Revised" License
19 stars 3 forks source link

digitalWriteFast does not appear to work on AVR4809 #1

Open paulskirk53 opened 1 year ago

paulskirk53 commented 1 year ago

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?

ArminJo commented 1 year ago

Maybe different pin numbering scheme?

paulskirk53 commented 1 year ago

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

Meins321 commented 1 year ago

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. ...

ArminJo commented 1 year ago

How do you think is ledpin mapped to hardware?

paulskirk53 commented 1 year ago

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

https://github.com/MCUdude/MegaCoreX