mirror of
https://github.com/adafruit/TFTLCD-Library.git
synced 2026-07-28 04:06:02 +00:00
Merge branch 'Due'
This commit is contained in:
+32
-9
@@ -4,8 +4,14 @@
|
||||
// Graphics library by ladyada/adafruit with init code from Rossum
|
||||
// MIT license
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
#include <include/pio.h>
|
||||
#define PROGMEM
|
||||
#define pgm_read_byte(addr) (*(const unsigned char *)(addr))
|
||||
#define pgm_read_word(addr) (*(const unsigned short *)(addr))
|
||||
#endif
|
||||
#ifdef __AVR__
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/pgmspace.h>
|
||||
#endif
|
||||
#include "pins_arduino.h"
|
||||
#include "wiring_private.h"
|
||||
@@ -91,10 +97,18 @@ Adafruit_TFTLCD::Adafruit_TFTLCD(
|
||||
#ifndef USE_ADAFRUIT_SHIELD_PINOUT
|
||||
// Convert pin numbers to registers and bitmasks
|
||||
_reset = reset;
|
||||
csPort = portOutputRegister(digitalPinToPort(cs));
|
||||
cdPort = portOutputRegister(digitalPinToPort(cd));
|
||||
wrPort = portOutputRegister(digitalPinToPort(wr));
|
||||
rdPort = portOutputRegister(digitalPinToPort(rd));
|
||||
#ifdef __AVR__
|
||||
csPort = portOutputRegister(digitalPinToPort(cs));
|
||||
cdPort = portOutputRegister(digitalPinToPort(cd));
|
||||
wrPort = portOutputRegister(digitalPinToPort(wr));
|
||||
rdPort = portOutputRegister(digitalPinToPort(rd));
|
||||
#endif
|
||||
#if defined(__SAM3X8E__)
|
||||
csPort = digitalPinToPort(cs);
|
||||
cdPort = digitalPinToPort(cd);
|
||||
wrPort = digitalPinToPort(wr);
|
||||
rdPort = digitalPinToPort(rd);
|
||||
#endif
|
||||
csPinSet = digitalPinToBitMask(cs);
|
||||
cdPinSet = digitalPinToBitMask(cd);
|
||||
wrPinSet = digitalPinToBitMask(wr);
|
||||
@@ -103,10 +117,18 @@ Adafruit_TFTLCD::Adafruit_TFTLCD(
|
||||
cdPinUnset = ~cdPinSet;
|
||||
wrPinUnset = ~wrPinSet;
|
||||
rdPinUnset = ~rdPinSet;
|
||||
*csPort |= csPinSet; // Set all control bits to HIGH (idle)
|
||||
*cdPort |= cdPinSet; // Signals are ACTIVE LOW
|
||||
*wrPort |= wrPinSet;
|
||||
*rdPort |= rdPinSet;
|
||||
#ifdef __AVR__
|
||||
*csPort |= csPinSet; // Set all control bits to HIGH (idle)
|
||||
*cdPort |= cdPinSet; // Signals are ACTIVE LOW
|
||||
*wrPort |= wrPinSet;
|
||||
*rdPort |= rdPinSet;
|
||||
#endif
|
||||
#if defined(__SAM3X8E__)
|
||||
csPort->PIO_SODR |= csPinSet; // Set all control bits to HIGH (idle)
|
||||
cdPort->PIO_SODR |= cdPinSet; // Signals are ACTIVE LOW
|
||||
wrPort->PIO_SODR |= wrPinSet;
|
||||
rdPort->PIO_SODR |= rdPinSet;
|
||||
#endif
|
||||
pinMode(cs, OUTPUT); // Enable outputs
|
||||
pinMode(cd, OUTPUT);
|
||||
pinMode(wr, OUTPUT);
|
||||
@@ -301,6 +323,7 @@ void Adafruit_TFTLCD::begin(uint16_t id) {
|
||||
void Adafruit_TFTLCD::reset(void) {
|
||||
|
||||
CS_IDLE;
|
||||
// CD_DATA;
|
||||
WR_IDLE;
|
||||
RD_IDLE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user