Code Monkey home page Code Monkey logo

directio's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

directio's Issues

Change pin mode in work?

How do I do this using DirectIO?

pinMode(ESP_RESET_PIN, OUTPUT);
digitalWrite(ESP_RESET_PIN, LOW);
delay(50);
digitalWrite(ESP_RESET_PIN, HIGH);
delay(50);
pinMode(ESP_RESET_PIN, INPUT);

base.h has no include guards

base.h file has no include guards (#ifndef xxx #define xxx). I'm not entirely sure this will cause problems because this file doesn't have much in it. But I would add it as a precaution anyway.

Using PORT_D for one pin

Hi,

I'm using atmega328P-AU standalone (the same used in arduino nano boards) and I would like to know if its possible declare, for example,

Output<2> my_output;

as

OutputPort<PORT_D, 2> my_output;

Or, declare a output pin passing the AVR PORT name, rather than look up equivalent Arduino pin, as reference:

image

Thanks!

missing: boards/avr/micro.h

Hi
As the title says: the file boards/avr/micro.h is missing.
My workaround was creating a symbolic link to boards/avr/leonardo.h, I suppose it would contain identical code.
Thanks for the nice library and best regards.
Lukas

DirectIO does not compile under Arduino 1.6.6 AVR 1.6.9

Hi,
DirectIO no longer compiles under the new avr board definitions v1.6.9 released with IDE 1.6.6
Could you please have a look?
Here is the output for the first example:

`Arduino: 1.6.6 (Windows 8.1), Board: "Arduino/Genuino Uno"

In file included from C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/DirectIO.h:23:0,

                 from C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO\examples\direct_io\direct_io.ino:1:

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:56:22: error: field initializer is not constant

 _define_port(PORT_B, PINB, PORTB, DDRB);

                      ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:46:31: note: in definition of macro '_define_port'

         static const u16 in = IN_REG; \

                               ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:56:28: error: field initializer is not constant

 _define_port(PORT_B, PINB, PORTB, DDRB);

                            ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:47:32: note: in definition of macro '_define_port'

         static const u16 out = OUT_REG; \

                                ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:56:35: error: field initializer is not constant

 _define_port(PORT_B, PINB, PORTB, DDRB);

                                   ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:48:32: note: in definition of macro '_define_port'

         static const u16 dir = DIR_REG; \

                                ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:60:22: error: field initializer is not constant

 _define_port(PORT_C, PINC, PORTC, DDRC);

                      ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:46:31: note: in definition of macro '_define_port'

         static const u16 in = IN_REG; \

                               ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:60:28: error: field initializer is not constant

 _define_port(PORT_C, PINC, PORTC, DDRC);

                            ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:47:32: note: in definition of macro '_define_port'

         static const u16 out = OUT_REG; \

                                ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:60:35: error: field initializer is not constant

 _define_port(PORT_C, PINC, PORTC, DDRC);

                                   ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:48:32: note: in definition of macro '_define_port'

         static const u16 dir = DIR_REG; \

                                ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:64:22: error: field initializer is not constant

 _define_port(PORT_D, PIND, PORTD, DDRD);

                      ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:46:31: note: in definition of macro '_define_port'

         static const u16 in = IN_REG; \

                               ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:64:28: error: field initializer is not constant

 _define_port(PORT_D, PIND, PORTD, DDRD);

                            ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:47:32: note: in definition of macro '_define_port'

         static const u16 out = OUT_REG; \

                                ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:64:35: error: field initializer is not constant

 _define_port(PORT_D, PIND, PORTD, DDRD);

                                   ^

C:\Users\arkhi_000\Documents\Arduino\libraries\DirectIO/ports.h:48:32: note: in definition of macro '_define_port'

         static const u16 dir = DIR_REG; \

                                ^

exit status 1
Error compiling.`

ARM-based Arduinos (e.g. Arduino Due) are not supported

The current port mapping scheme doesn't work on Arduino ARM variants (currently the Due board). The Arduino ARM libraries do a lot of work per I/O transaction, some of which can be moved into initialization as is done here. Also there are clearly opportunities for inlining, which not only eliminates function call overhead but can often eliminate one branch of an if/else entirely by evaluating the condition at compile time.

Upgrade to Socket.io 2.*

Hi i really love the approach you have taken on dynamic sockets.
I noticed that it only works with Socket.IO 1.x.
Are you planning to upgrade it beyond version 2.x?
Could you point on hookups wor such an update?
I could maybe help coding (with my humble knowledge)
regards
Theo

OutputLow not implemented

Hi @mmarchetti,
When I use OutputLow syntax it shows this error message:

error: 'OutputLow' does not name a type

I check on DirecIO.h header and didn't saw any implementation of these.
I tried to implement OutputLow class based on Output, and the result was:

Original Output:
image

I don't know if is in the best implementation, but it works.

Modified OutputLow:
image

How to use in function

How would I pass a pin into a function?

#include <DirectIO.h> 

Output<2> pin;

void togglePin(Output pinObject){
  pinObject.toggle();
}

All port loop

Hi all

How to use this library ??

Want to control all port C pins on and off with loop and delay but I am not understanding how with Arduino due
` // Define a 4-bit port starting at port C2.
// This will control C2, C3, C4, C5 (pins 16-19).
OutputPort<PORT_C, 2, 4> my_port;

void setup()
{
my_port.setup();
}

void loop()
{
// Turn on C2 (pin 16), and turn off the rest.
my_port = 0x01;
} `

Thanks in advance

Teensy 3.2/3.1 support

Hello,

I am curious about what would need to be done in order for me to add Teensy 3.2/3.1 support.
I have a Teensy 3.2 I can test with, which has the same underlying hardware as the 3.1 aside from the 3.1 being 3.3v-only.

Kind regards.

OutputPin constructor, InputPin constructor and OutputPin::write not marked inline

Constructor definitions of OutputPin and InputPin classes are not marked as inline.
Definition of write method in OutputPin class is not marked inline.

This causes problems if you want to include this library in some other header file (needed if InputPin or OutputPin objects are composed into another class). Compiler complains about multiple definition errors of these symbols.

In order to fix this, please mark OutputPin class constructor definition, InputPin class constructor definition and OutputPin::write method as inline.
Specifically add "inline" keyword to lines: 185, 196 and 210 of DirectIO.h

DirectIO's use of SFR_ASM_COMPAT masks the usual register definitions

DirectIO.h defines _SFR_ASM_COMPAT, which causes register definitions to be integer addresses instead of references to the actual port (e.g. SREG defined as 0x3F instead of *(uint8_t*) 0x3F). This breaks some other uses, e.g. the ATOMIC_RESTORESTATE macro in util/atomic.h. DirectIO should restore the normal definitions at the end of its include file.

error: expected ';' before 'k'

I'm trying to use OutputPin to declare a pin as output on runtime. But I get error: expected ';' before 'k' when trying to compile. It seems like a silly syntax error but I don't see how. if I remove k I get no default constructor exists for class "OutputPin"

Below are my functions and logs

int getThmstAnlgRaw(int analogPin, u8 pwrPin){
  OutputPin(pwrPin) k;
  int reading = analogRead(analogPin);
  return reading;
}
The terminal process "C:\Users\simeon.ramjit\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

> Executing task: C:\Users\simeon.ramjit\.platformio\penv\Scripts\platformio.exe run <

Processing controllino_maxi_automation (platform: atmelavr; board: controllino_maxi_automation; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/controllino_maxi_automation.html
PLATFORM: Atmel AVR (3.0.0) > Controllino Maxi Automation
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr 5.1.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <CONTROLLINO> 3.0.5
|   |-- <SPI> 1.0
|-- <DirectIO> 1.2.0
|-- <Blynk> 0.6.7
|   |-- <Ethernet> 2.0.0
|   |   |-- <SPI> 1.0
|-- <Ethernet> 2.0.0
|   |-- <SPI> 1.0
|-- <TimerInterrupt> 1.0.2
|-- <SPI> 1.0
Building in release mode
Compiling .pio\build\controllino_maxi_automation\src\main.cpp.o
src\main.cpp: In function 'int getThmstAnlgRaw(int, u8)':
src\main.cpp:166:21: error: expected ';' before 'k'
   OutputPin(pwrPin) k;
                 ^

Colisions w/ FastLED.io

FastLED.io and DirectIO seem to conflict with multiple collisions.

Example:

In file included from C:\EE\microController\arduino-1.8.0\libraries\DirectIO/DirectIO.h:31:0,

                 from C:\EE\microController\arduino-1.6.9\projects\XXXXX.ino:73:

C:\EE\microController\arduino-1.8.0\libraries\DirectIO/include/pin.h:21:7: error: redefinition of 'class InputPin'

 class InputPin {

PlatformIO Compiler Error with direct_io_pin example

Hello,
i tried to test the Lib with Platformio and compile the Examble "direct_io_pin.ino"
My version of PlatformIO ist 3.1.0 Core 4.2.1
I use an Arduino DUE an Programming Port tis ist Atmel SAM 4.1.0

'reinterpret_cast<Pio*>(1074662912)' is not a constant expression
L
redifiniton of that thing ? But i don't kow how do fix this.
Thanks for help!

The error in the Terminal Output:

Executing task: C:\Users\admin.platformio\penv\Scripts\platformio.exe run <

Processing due (platform: atmelsam; board: due; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelsam/due.html
PLATFORM: Atmel SAM 4.1.0 > Arduino Due (Programming Port)
HARDWARE: AT91SAM3X8E 84MHz, 96KB RAM, 512KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink, stlink)
PACKAGES:

  • framework-arduino-sam 1.6.12
  • framework-cmsis 1.40500.0 (4.5.0)
  • framework-cmsis-atmel 1.2.0
  • toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
    Converting direct_io_pin.ino
    LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 11 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- 1.2.0
    Building in release mode
    Compiling .pio\build\due\src\direct_io_pin.ino.cpp.o
    Archiving .pio\build\due\libdea\libDirectIO_ID6327.a
    Compiling .pio\build\due\FrameworkArduinoVariant\variant.cpp.o
    Compiling .pio\build\due\FrameworkArduino\IPAddress.cpp.o
    Compiling .pio\build\due\FrameworkArduino\Print.cpp.o
    Compiling .pio\build\due\FrameworkArduino\Reset.cpp.o
    Compiling .pio\build\due\FrameworkArduino\RingBuffer.cpp.o
    Compiling .pio\build\due\FrameworkArduino\Stream.cpp.o
    Compiling .pio\build\due\FrameworkArduino\UARTClass.cpp.o
    In file included from C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports.h:28:0,
    from C:\Users\admin.platformio\lib\DirectIO_ID6327/DirectIO.h:23,
    from C:/Users/admin/Documents/PlatformIO/Projects/200221-182940-due/src/direct_io_pin.ino:1:
    C:\Users\admin.platformio\packages\framework-arduino-sam\system\CMSIS\Device\ATMEL/sam3xa/include/sam3x8e.h:494:21: error: 'reinterpret_cast<Pio*>(1074662912)' is not a constant expression
    #define PIOA ((Pio *)0x400E0E00U) /< \brief (PIOA ) Base Address /
    ~^~~~~~~~~~~~~~~~~~~~~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:29:36: note: in definition of macro '_define_port'
    static const u32 pio = u32(PIO);
    ^~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:40:22: note: in expansion of macro 'PIOA'
    _define_port(PORT_A, PIOA);
    ^~~~
    C:\Users\admin.platformio\packages\framework-arduino-sam\system\CMSIS\Device\ATMEL/sam3xa/include/sam3x8e.h:495:21: error: 'reinterpret_cast<Pio
    >(1074663424)' is not a constant expression
    #define PIOB ((Pio *)0x400E1000U) /
    < \brief (PIOB ) Base Address /
    ~^~~~~~~~~~~~~~~~~~~~~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:29:36: note: in definition of macro '_define_port'
    static const u32 pio = u32(PIO);
    ^~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:44:22: note: in expansion of macro 'PIOB'
    _define_port(PORT_B, PIOB);
    ^~~~
    C:\Users\admin.platformio\packages\framework-arduino-sam\system\CMSIS\Device\ATMEL/sam3xa/include/sam3x8e.h:496:21: error: 'reinterpret_cast<Pio
    >(1074663936)' is not a constant expression
    #define PIOC ((Pio *)0x400E1200U) /< \brief (PIOC ) Base Address /
    ~^~~~~~~~~~~~~~~~~~~~~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:29:36: note: in definition of macro '_define_port'
    static const u32 pio = u32(PIO);
    ^~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:48:22: note: in expansion of macro 'PIOC'
    _define_port(PORT_C, PIOC);
    ^~~~
    C:\Users\admin.platformio\packages\framework-arduino-sam\system\CMSIS\Device\ATMEL/sam3xa/include/sam3x8e.h:497:21: error: 'reinterpret_cast<Pio
    >(1074664448)' is not a constant expression
    #define PIOD ((Pio *)0x400E1400U) /
    < \brief (PIOD ) Base Address */
    ~^~~~~~~~~~~~~~~~~~~~~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:29:36: note: in definition of macro '_define_port'
    static const u32 pio = u32(PIO);
    ^~~
    C:\Users\admin.platformio\lib\DirectIO_ID6327/include/ports_sam.h:52:22: note: in expansion of macro 'PIOD'
    _define_port(PORT_D, PIOD);
    ^~~~
    *** [.pio\build\due\src\direct_io_pin.ino.cpp.o] Error 1
    ========================================================================= [FAILED] Took 4.18 seconds =========================================================================

Non first include

Hello, I have a strange problem with your library. Whenver the library isn't the first entry on the include list it throws errors.

If I have:

include DirectIO.h

include somethingElse.h (I had to remove < and > signs because github was deleting them somehow)

It's fine, but if I have it the other way around I get these errors:
ports.h:48: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
ports.h:48: error: *' cannot appear in a constant-expression ports.h:48: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:48: error:' cannot appear in a constant-expression
ports.h:48: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
ports.h:48: error: _' cannot appear in a constant-expression ports.h:52: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:52: error: *' cannot appear in a constant-expression
ports.h:52: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
ports.h:52: error:_' cannot appear in a constant-expression ports.h:52: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:52: error:
' cannot appear in a constant-expression
ports.h:56: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
ports.h:56: error: *' cannot appear in a constant-expression ports.h:56: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:56: error:' cannot appear in a constant-expression
ports.h:56: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
ports.h:56: error: _' cannot appear in a constant-expression ports.h:60: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:60: error: *' cannot appear in a constant-expression
ports.h:60: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression
ports.h:60: error:_' cannot appear in a constant-expression ports.h:60: error: a cast to a type other than an integral or enumeration type cannot appear in a constant-expression ports.h:60: error:
' cannot appear in a constant-expression

Due to my project's structure it's impossible for me to have your library as first thing included. How can I fix this?

nRF52 support: nRF52840 feather of adafruit

I checked many libraries and like your DirectIO.
It would be great to get support for these chips please.
I am tried to add support for nRF52 serie but fall in tilt looking your technical code.
I have a nRF52830 and nRF52840 to test.

I found:
`
const uint32_t g_ADigitalPinMap[] =
{
// D0 .. D13
25, // D0 is P0.25 (UART TX)
24, // D1 is P0.24 (UART RX
10, // D2 is P0.10 (NFC2)
47, // D3 is P1.15 (LED1)
42, // D4 is P1.10 (LED2)
40, // D5 is P1.08
7, // D6 is P0.07
34, // D7 is P1.02 (Button)
16, // D8 is P0.16 (NeoPixel)
26, // D9 is P0.26
27, // D10 is P0.27
6, // D11 is P0.06
8, // D12 is P0.08
41, // D13 is P1.09

// D14 .. D21 (aka A0 .. A7)
4, // D14 is P0.04 (A0)
5, // D15 is P0.05 (A1)
30, // D16 is P0.30 (A2)
28, // D17 is P0.28 (A3)
2, // D18 is P0.02 (A4)
3, // D19 is P0.03 (A5)
29, // D20 is P0.29 (A6, Battery)
31, // D21 is P0.31 (A7, ARef)

// D22 .. D23 (aka I2C pins)
12, // D22 is P0.12 (SDA)
11, // D23 is P0.11 (SCL)

// D24 .. D26 (aka SPI pins)
15, // D24 is P0.15 (SPI MISO)
13, // D25 is P0.13 (SPI MOSI)
14, // D26 is P0.14 (SPI SCK )

// QSPI pins (not exposed via any header / test point)
19, // D27 is P0.19 (QSPI CLK)
20, // D28 is P0.20 (QSPI CS)
17, // D29 is P0.17 (QSPI Data 0)
22, // D30 is P0.22 (QSPI Data 1)
23, // D31 is P0.23 (QSPI Data 2)
21, // D32 is P0.21 (QSPI Data 3)

// The remaining NFC pin
9, // D33 is P0.09 (NFC1, exposed only via test point on bottom of board)
`
...

and

`
/**

  • @brief Function for extracting port and the relative pin number from the absolute pin number.
  • @param[in,out] p_pin Pointer to the absolute pin number overriden by the pin number that is relative to the port.
  • @return Pointer to port register set.
    */
    __STATIC_INLINE NRF_GPIO_Type * nrf_gpio_pin_port_decode(uint32_t * p_pin)
    {
    NRFX_ASSERT(*p_pin < NUMBER_OF_PINS);
    #if (GPIO_COUNT == 1)
    return NRF_P0;
    #else
    if (*p_pin < P0_PIN_NUM)
    {
    return NRF_P0;
    }
    else
    {
    *p_pin = *p_pin & (P0_PIN_NUM - 1);
    return NRF_P1;
    }
    #endif
    }
    `

Kind regards.

Implementation of DirectIO in other libraries

I really like to use this DirectIO lib.
What I'm try to do is implement it in other libraries, like <LiquidCrystal.h> for example.
Replace digitalWrite() for Output<>. But I got some issues to implement this in cpp.
Anybody already did that? Create an object Class in other Class.

Thanks.

Speed up OutputPort::write()

Current OutputPort::write() code:

        void write(port_data_t value) {
            atomic {
                // read-modify-write cycle
                port_data_t v = port::port_output_read();
                port_data_t shifted = value << start_bit;
                v |= shifted & mask;
                v &= (shifted | ~mask);
                port::port_output_write(v);
            }
        }

On chips that have an output toggle feature, this can probably be sped up significantly using the clever XOR-based trick that I first saw in the RPi Pico SDK (https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_gpio/include/hardware/gpio.h#L719 )

the new code would not need "atomic", and would look something like:

        void write(port_data_t value) {
              port_data_t v = port::port_output_read();
              port_data_t shifted = value << start_bit;
              v ^= shifted;
              port::port_output_toggle(v & mask);
        }

ESP8266, ESP32 support

It would be great to get support for these chips please.

\Arduino\libraries\DirectIO/ports.h:31:20: fatal error: avr/io.h: No such file or directory
#include <avr/io.h>

Use PINx to toggle pins.

Currently DirectIO uses a read, flip, write sequence to toggle output pins.
This can be done faster by using the PINx registers (on some targets?).
See section 14.2.2 of the ATMega328 manual:

14.2.2 Toggling the Pin
Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port.

InputPin and OutputPin don't use high speed I/O

For use cases where pin numbers are not known at compile time, the InputPin and OutputPin classes are used but they are currently wrappers for digitalRead and digitalWrite and share their (slow) performance. It would be faster to cache the port address and bit mask (that digitalRead and digitalWrite currently look up everytime) at the expense of a few bytes of RAM per I/O.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.