![]() |
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 #include <util/delay.h> 00042 00048 #ifndef __AVR__ 00049 #define FIO_FALLBACK 00050 #endif 00051 00052 // PUBLIC CONSTANTS DEFINITIONS 00053 // --------------------------------------------------------------------------- 00059 #define SKIP 0x23 00060 00061 // PUBLIC TYPE DEFINITIONS 00062 // --------------------------------------------------------------------------- 00063 typedef uint8_t fio_bit; 00064 00065 00066 #ifndef FIO_FALLBACK 00067 typedef volatile uint8_t * fio_register; 00068 #else 00069 // remove volatile to give optimizer a chance 00070 typedef uint8_t fio_register; 00071 #endif 00072 00080 fio_register fio_pinToOutputRegister(uint8_t pin, uint8_t initial_state = LOW); 00081 00089 fio_register fio_pinToInputRegister(uint8_t pin); 00090 00098 fio_bit fio_pinToBit(uint8_t pin); 00099 00100 00110 // __attribute__ ((always_inline)) /* let the optimizer decide that for now */ 00111 void fio_digitalWrite ( fio_register pinRegister, fio_bit pinBit, uint8_t value ); 00112 00119 #ifndef FIO_FALLBACK 00120 #define fio_digitalWrite_LOW(reg,bit) *reg &= ~bit 00121 #define fio_digitalWrite_HIGH(reg,bit) *reg |= bit 00122 #define fio_digitalWrite_SWITCH(reg,bit) *reg ^= bit 00123 #define fio_digitalWrite_SWITCHTO(reg,bit,val) fio_digitalWrite_SWITCH(reg,bit) 00124 #else 00125 // reg -> dummy NULL, bit -> pin 00126 #define fio_digitalWrite_HIGH(reg,bit) digitalWrite(bit,HIGH) 00127 #define fio_digitalWrite_LOW(reg,bit) digitalWrite(bit,LOW) 00128 #define fio_digitalWrite_SWITCH(reg,bit) digitalWrite(bit, !digitalRead(bit)) 00129 #define fio_digitalWrite_SWITCHTO(reg,bit,val) digitalWrite(bit,val); 00130 #endif 00131 00141 int fio_digitalRead ( fio_register pinRegister, fio_bit pinBit ); 00142 00154 void fio_shiftOut( fio_register dataRegister, fio_bit dataBit, fio_register clockRegister, 00155 fio_bit clockBit, uint8_t value, uint8_t bitOrder ); 00156 00167 void fio_shiftOut(fio_register dataRegister, fio_bit dataBit, fio_register clockRegister, fio_bit clockBit); 00168 00177 void fio_shiftOut1(fio_register shift1Register, fio_bit shift1Bit, uint8_t value, boolean noLatch = false); 00185 void fio_shiftOut1(uint8_t pin, uint8_t value, boolean noLatch = false); 00193 void fio_shiftOut1_init(fio_register shift1Register, fio_bit shift1Bit); 00200 void fio_shiftOut1_init(uint8_t pin); 00201 00202 #endif // FAST_IO_H