![]() |
LCD Library 1.2.0
LCD Library - LCD control class hierarchy library. Drop in replacement for the LiquidCrystal Library.
|
00001 // --------------------------------------------------------------------------- 00002 // Created by Florian Fida on 20/01/12 00003 // Copyright 2012 - Under creative commons license 3.0: 00004 // Attribution-ShareAlike CC BY-SA 00005 // http://creativecommons.org/licenses/by-sa/3.0/ 00006 // 00007 // This software is furnished "as is", without technical support, and with no 00008 // warranty, express or implied, as to its usefulness for any purpose. 00009 // --------------------------------------------------------------------------- 00010 // fio_shiftOut1 functions are based on Shif1 protocol developed by Roman Black 00011 // (http://www.romanblack.com/shift1.htm) 00012 // 00013 // Thread Safe: No 00014 // Extendable: Yes 00015 // 00016 // @file FastIO.h 00017 // This file implements basic fast IO routines. 00018 // 00019 // @brief 00020 // 00021 // @version API 1.0.0 00022 // 00023 // @author Florian Fida - 00024 // 00025 // @todo: 00026 // support chipkit: 00027 // (https://github.com/chipKIT32/chipKIT32-MAX/blob/master/hardware/pic32/ 00028 // cores/pic32/wiring_digital.c) 00029 // --------------------------------------------------------------------------- 00030 #ifndef _FAST_IO_H_ 00031 #define _FAST_IO_H_ 00032 00033 #if (ARDUINO < 100) 00034 #include <WProgram.h> 00035 #else 00036 #include <Arduino.h> 00037 #endif 00038 00039 #include <pins_arduino.h> // pleasing sanguino core 00040 #include <inttypes.h> 00041 00042 #ifdef __AVR__ 00043 #include <util/atomic.h> // for critical section management 00044 #endif 00045 00046 00052 #ifndef __AVR__ 00053 #define FIO_FALLBACK 00054 #define ATOMIC_BLOCK(dummy) if(true) 00055 #define ATOMIC_RESTORESTATE 00056 #endif 00057 00058 // PUBLIC CONSTANTS DEFINITIONS 00059 // --------------------------------------------------------------------------- 00065 #define SKIP 0x23 00066 00067 // PUBLIC TYPE DEFINITIONS 00068 // --------------------------------------------------------------------------- 00069 typedef uint8_t fio_bit; 00070 00077 #ifndef FIO_FALLBACK 00078 typedef volatile uint8_t *fio_register; 00079 #else 00080 // remove volatile to give optimizer a chance 00081 typedef uint8_t fio_register; 00082 #endif 00083 00091 fio_register fio_pinToOutputRegister(uint8_t pin, uint8_t initial_state = LOW); 00092 00100 fio_register fio_pinToInputRegister(uint8_t pin); 00101 00109 fio_bit fio_pinToBit(uint8_t pin); 00110 00111 00121 // __attribute__ ((always_inline)) /* let the optimizer decide that for now */ 00122 void fio_digitalWrite ( fio_register pinRegister, fio_bit pinBit, uint8_t value ); 00123 00130 #ifndef FIO_FALLBACK 00131 #define fio_digitalWrite_LOW(reg,bit) *reg &= ~bit 00132 #define fio_digitalWrite_HIGH(reg,bit) *reg |= bit 00133 #define fio_digitalWrite_SWITCH(reg,bit) *reg ^= bit 00134 #define fio_digitalWrite_SWITCHTO(reg,bit,val) fio_digitalWrite_SWITCH(reg,bit) 00135 #else 00136 // reg -> dummy NULL, bit -> pin 00137 #define fio_digitalWrite_HIGH(reg,bit) digitalWrite(bit,HIGH) 00138 #define fio_digitalWrite_LOW(reg,bit) digitalWrite(bit,LOW) 00139 #define fio_digitalWrite_SWITCH(reg,bit) digitalWrite(bit, !digitalRead(bit)) 00140 #define fio_digitalWrite_SWITCHTO(reg,bit,val) digitalWrite(bit,val); 00141 #endif 00142 00152 int fio_digitalRead ( fio_register pinRegister, fio_bit pinBit ); 00153 00165 void fio_shiftOut( fio_register dataRegister, fio_bit dataBit, fio_register clockRegister, 00166 fio_bit clockBit, uint8_t value, uint8_t bitOrder ); 00167 00178 void fio_shiftOut(fio_register dataRegister, fio_bit dataBit, fio_register clockRegister, fio_bit clockBit); 00179 00188 void fio_shiftOut1(fio_register shift1Register, fio_bit shift1Bit, uint8_t value, boolean noLatch = false); 00196 void fio_shiftOut1(uint8_t pin, uint8_t value, boolean noLatch = false); 00204 void fio_shiftOut1_init(fio_register shift1Register, fio_bit shift1Bit); 00211 void fio_shiftOut1_init(uint8_t pin); 00212 00213 #endif // FAST_IO_H
1.7.4