From b109908d282c10d7aa07adf2e7926e5eae9fbccf Mon Sep 17 00:00:00 2001 From: Scott Allen Date: Sat, 26 Jul 2014 20:19:17 -0400 Subject: [PATCH] Fast SPI pin changes - added defines to map ports and bits for RESET, DC and SS. - added macros to quickly control RESET, DC and SS using the internal weak pullup for high. --- MicroView.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/MicroView.h b/MicroView.h index 4b35a31..6fe37e6 100644 --- a/MicroView.h +++ b/MicroView.h @@ -24,15 +24,36 @@ #define swap(a, b) { uint8_t t = a; a = b; b = t; } +#define OLEDPWR 4 // 3.3V regulator enable + #define DC 8 +#define DCPORT PORTB +#define DCDDR DDRB +#define DCBIT 0 + #define RESET 7 -#define OLEDPWR 4 +#define RESETPORT PORTD +#define RESETDDR DDRD +#define RESETBIT 7 + +#define SSPORT PORTB +#define SSDDR DDRB +#define SSBIT 2 + +#define DCHIGH ((DCPORT |= _BV(DCBIT)), (DCDDR &= ~_BV(DCBIT))) +#define DCLOW ((DCPORT &= ~_BV(DCBIT)), (DCDDR |= _BV(DCBIT))) + +#define RESETHIGH ((RESETPORT |= _BV(RESETBIT)), (RESETDDR &= ~_BV(RESETBIT))) +#define RESETLOW ((RESETPORT &= ~_BV(RESETBIT)), (RESETDDR |= _BV(RESETBIT))) // SS, SCK, MOSI already defined by original pins_arduino.h //#define CS 10 //#define SCK 13 //#define MOSI 11 +#define SSHIGH ((SSPORT |= _BV(SSBIT)), (SSDDR &= ~_BV(SSBIT))) +#define SSLOW ((SSPORT &= ~_BV(SSBIT)), (SSDDR |= _BV(SSBIT))) + #define BLACK 0 #define WHITE 1