PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

ks0108_Arduino.h 3.3KB

3 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. ks0108_Arduino.h - Arduino library support for ks0108 and compatable graphic LCDs
  3. Copyright (c)2008 Michael Margolis All right reserved
  4. This is the configuration file for mapping Arduino (ATmega168) pins to the ks0108 Graphics LCD library
  5. */
  6. #ifndef KS0108_CONFIG_H
  7. #define KS0108_CONFIG_H
  8. /*********************************************************/
  9. /* Configuration for assigning LCD bits to Arduino Pins */
  10. /*********************************************************/
  11. /* Arduino pins used for Commands
  12. * default assignment uses the first five analog pins
  13. */
  14. #define CSEL1 14 // CS1 Bit // swap pin assignments with CSEL2 if left/right image is reversed
  15. #define CSEL2 15 // CS2 Bit
  16. #define R_W 16 // R/W Bit
  17. #define D_I 17 // D/I Bit
  18. #define EN 18 // EN Bit
  19. //#define RES 19 // Reset Bit // uncomment this to contol LCD reset on this pin
  20. /* option: uncomment the next line if all command pins are on the same port for slight speed & code size improvement */
  21. #define LCD_CMD_PORT PORTC // Command Output Register for pins 14-19
  22. /* Arduino pins used for LCD Data
  23. * un-comment ONE of the following pin options that corresponds to the wiring of data bits 0-3
  24. */
  25. #define dataPins8to11 // bits 0-3 assigned to arduino pins 8-11, bits 4-7 assigned to arduino pins 4-7
  26. //#define dataPins14to17 //bits 0-3 assigned to arduino pins 14-17, bits 4-7 assigned to arduino pins 4-7. (note command pins must be changed)
  27. //#define dataPins0to3 // bits 0-3 assigned to arduino pins 0-3 , bits 4-7 assigned to arduino pins 4-7, this is marginally the fastest option but its only available on runtime board without hardware rs232.
  28. /* NOTE: all above options assume LCD data bits 4-7 are connected to arduino pins 4-7 */
  29. /*******************************************************/
  30. /* end of Arduino configuration */
  31. /*******************************************************/
  32. #ifndef dataPins0to3 // this is the only option on standard arduino where all data bits are on same port
  33. #define LCD_DATA_NIBBLES // if this is defined then data i/o is split into two operations
  34. #endif
  35. // these macros map pins to ports using the defines above
  36. // the following should not be changed unless you really know what your doing
  37. #ifdef dataPins0to3
  38. #define LCD_DATA_LOW_NBL D // port for low nibble: D=pins 0-3
  39. #endif
  40. #ifdef dataPins14to17
  41. #define LCD_DATA_LOW_NBL C // port for low nibble: C=pins 14-17 (using this requires reasignment of command pins)
  42. #endif
  43. #ifdef dataPins8to11 // the following is the defualt setting
  44. #define LCD_DATA_LOW_NBL B // port for low nibble, B=pins 8-11
  45. #endif
  46. #define LCD_DATA_HIGH_NBL D // port for high nibble: D=pins 4-7, B & C not available on std arduino
  47. // macros to fast write data to pins known at compile time, this is over 30 times faster than digitalWrite
  48. #define fastWriteHigh(_pin_) ( _pin_ < 8 ? PORTD |= 1 << (_pin_ & 0x07) : ( _pin_ < 14 ? PORTB |= 1 << ((_pin_ -8) & 0x07) : PORTC |= 1 << ((_pin_ -14) & 0x07) ) )
  49. #define fastWriteLow(_pin_) ( _pin_ < 8 ? PORTD &= ~(1 << (_pin_ & 0x07)) : ( _pin_ < 14 ? PORTB &= ~(1 << ((_pin_ -8) & 0x07) ) : PORTC &= ~(1 << ((_pin_ -14) & 0x07) ) ) )
  50. #endif