LCD Library 1.2.1
LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.
/Users/fmalpartida/development/ardWorkspace/LiquidCrystal_I2C/LiquiCrystal_I2C/FastIO.cpp
#include <WProgram.h>
#include <pins_arduino.h>
#include <inttypes.h>

Go to the source code of this file.

Defines

#define ATOMIC_BLOCK(dummy)   if(true)
#define ATOMIC_RESTORESTATE
#define fio_digitalWrite_HIGH(reg, bit)   digitalWrite(bit,HIGH)
#define fio_digitalWrite_LOW(reg, bit)   digitalWrite(bit,LOW)
#define fio_digitalWrite_SWITCH(reg, bit)   digitalWrite(bit, !digitalRead(bit))
#define fio_digitalWrite_SWITCHTO(reg, bit, val)   digitalWrite(bit,val);
#define FIO_FALLBACK
#define SKIP   0x23

Typedefs

typedef uint8_t fio_bit
typedef uint8_t fio_register

Functions

int fio_digitalRead (fio_register pinRegister, fio_bit pinBit)
void fio_digitalWrite (fio_register pinRegister, fio_bit pinBit, uint8_t value)
fio_bit fio_pinToBit (uint8_t pin)
fio_register fio_pinToInputRegister (uint8_t pin)
fio_register fio_pinToOutputRegister (uint8_t pin, uint8_t initial_state=LOW)
void fio_shiftOut (fio_register dataRegister, fio_bit dataBit, fio_register clockRegister, fio_bit clockBit)
void fio_shiftOut (fio_register dataRegister, fio_bit dataBit, fio_register clockRegister, fio_bit clockBit, uint8_t value, uint8_t bitOrder)
void fio_shiftOut1 (fio_register shift1Register, fio_bit shift1Bit, uint8_t value, boolean noLatch=false)
void fio_shiftOut1 (uint8_t pin, uint8_t value, boolean noLatch=false)
void fio_shiftOut1_init (fio_register shift1Register, fio_bit shift1Bit)
void fio_shiftOut1_init (uint8_t pin)

Define Documentation

#define ATOMIC_BLOCK (   dummy)    if(true)

Definition at line 58 of file FastIO.h.

#define ATOMIC_RESTORESTATE

Definition at line 59 of file FastIO.h.

#define fio_digitalWrite_HIGH (   reg,
  bit 
)    digitalWrite(bit,HIGH)

This is where the magic happens that makes things fast. Implemented as preprocessor directives to force inlining SWITCH is fast for FIO but probably slow for FIO_FALLBACK so SWITCHTO is recommended if the value is known.

Definition at line 143 of file FastIO.h.

#define fio_digitalWrite_LOW (   reg,
  bit 
)    digitalWrite(bit,LOW)

Definition at line 144 of file FastIO.h.

#define fio_digitalWrite_SWITCH (   reg,
  bit 
)    digitalWrite(bit, !digitalRead(bit))

Definition at line 145 of file FastIO.h.

#define fio_digitalWrite_SWITCHTO (   reg,
  bit,
  val 
)    digitalWrite(bit,val);

Definition at line 146 of file FastIO.h.

#define FIO_FALLBACK

Definition at line 57 of file FastIO.h.

#define SKIP   0x23

Definition at line 42 of file FastIO.h.


Typedef Documentation

typedef uint8_t fio_bit

Definition at line 60 of file FastIO.h.

typedef uint8_t fio_register

Definition at line 61 of file FastIO.h.


Function Documentation

int fio_digitalRead ( fio_register  pinRegister,
fio_bit  pinBit 
)

direct digital read without any checks falls back to normal digitalRead if fast io is disabled

Parameters:
pinRegister[in]Register – ignored if fast io is disabled
pinBit[in]Bit – Pin if fast io is disabled
Returns:
Value read from pin

Definition at line 95 of file FastIO.cpp.

void fio_digitalWrite ( fio_register  pinRegister,
fio_bit  pinBit,
uint8_t  value 
)

direct digital write without any checks falls back to normal digitalWrite if fast io is disabled

Parameters:
pinRegister[in]Register – ignored if fast digital write is disabled
pinBit[in]Bit – Pin if fast digital write is disabled
value[in]desired output

Definition at line 76 of file FastIO.cpp.

fio_bit fio_pinToBit ( uint8_t  pin)

Find the bit which belongs to specified pin if fast digitalWrite is disabled this function returns the pin

Parameters:
pin[in]Number of a digital pin
Returns:
Bit

Definition at line 65 of file FastIO.cpp.

fio_register fio_pinToInputRegister ( uint8_t  pin)

Get the input register for specified pin. if fast digital IO is disabled this function returns NULL

Parameters:
pin[in]Number of a digital pin
Returns:
Register

Definition at line 52 of file FastIO.cpp.

fio_register fio_pinToOutputRegister ( uint8_t  pin,
uint8_t  initial_state = LOW 
)

Get the output register for specified pin. if fast digital IO is disabled this function returns NULL

Parameters:
pin[in]Number of a digital pin
Returns:
Register

Definition at line 35 of file FastIO.cpp.

void fio_shiftOut ( fio_register  dataRegister,
fio_bit  dataBit,
fio_register  clockRegister,
fio_bit  clockBit 
)

faster shift out clear using fast digital write falls back to normal digitalWrite if fastio is disabled

Parameters:
dataRegister[in]Register of data pin – ignored if fast digital write is disabled
dataBit[in]Bit of data pin – Pin if fast digital write is disabled
clockRegister[in]Register of data pin – ignored if fast digital write is disabled
clockBit[in]Bit of data pin – Pin if fast digital write is disabled

Definition at line 159 of file FastIO.cpp.

void fio_shiftOut ( fio_register  dataRegister,
fio_bit  dataBit,
fio_register  clockRegister,
fio_bit  clockBit,
uint8_t  value,
uint8_t  bitOrder 
)

faster shift out using fast digital write falls back to normal digitalWrite if fastio is disabled

Parameters:
dataRegister[in]Register of data pin – ignored if fast digital write is disabled
dataBit[in]Bit of data pin – Pin if fast digital write is disabled
clockRegister[in]Register of data pin – ignored if fast digital write is disabled
clockBit[in]Bit of data pin – Pin if fast digital write is disabled
bitOrder[in]bit order

Definition at line 108 of file FastIO.cpp.

void fio_shiftOut1 ( fio_register  shift1Register,
fio_bit  shift1Bit,
uint8_t  value,
boolean  noLatch = false 
)

one wire shift out protocol needs initialisation (fio_shiftOut1_init)

Parameters:
shift1Register[in]pins register
shift1Bit[in]pins bit
value[in]value to shift out, last byte is ignored and always shifted out LOW

Definition at line 190 of file FastIO.cpp.

void fio_shiftOut1 ( uint8_t  pin,
uint8_t  value,
boolean  noLatch = false 
)

one wire shift out protocol needs initialisation (fio_shiftOut1_init)

Parameters:
pin[in]digital pin
value[in]value to shift out, last byte is ignored and always shifted out LOW

Definition at line 264 of file FastIO.cpp.

void fio_shiftOut1_init ( fio_register  shift1Register,
fio_bit  shift1Bit 
)

initializes one wire shift out protocol Puts pin to HIGH state and delays until Capacitors are charged.

Parameters:
shift1Register[in]pins register
shift1Bit[in]pins bit

Definition at line 181 of file FastIO.cpp.

void fio_shiftOut1_init ( uint8_t  pin)

initializes one wire shift out protocol Puts pin to HIGH state and delays until Capacitors are charged.

Parameters:
pin[in]digital pin

Definition at line 176 of file FastIO.cpp.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines