mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Merge pull request #4588 from bigdinotech/tftlib
Add Arduino/Genuino 101 support to TFT library
This commit is contained in:
commit
0e58d91c6c
@ -76,7 +76,12 @@ void Adafruit_ST7735::writecommand(uint8_t c) {
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, LOW);
|
||||||
|
#else
|
||||||
*rsport &= ~rspinmask;
|
*rsport &= ~rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
|
|
||||||
//Serial.print("C ");
|
//Serial.print("C ");
|
||||||
@ -93,7 +98,12 @@ void Adafruit_ST7735::writedata(uint8_t c) {
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, HIGH);
|
||||||
|
#else
|
||||||
*rsport |= rspinmask;
|
*rsport |= rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
|
|
||||||
//Serial.print("D ");
|
//Serial.print("D ");
|
||||||
@ -432,7 +442,12 @@ void Adafruit_ST7735::pushColor(uint16_t color) {
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, HIGH);
|
||||||
|
#else
|
||||||
*rsport |= rspinmask;
|
*rsport |= rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
|
|
||||||
if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
|
if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
|
||||||
@ -454,7 +469,12 @@ void Adafruit_ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, HIGH);
|
||||||
|
#else
|
||||||
*rsport |= rspinmask;
|
*rsport |= rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
|
|
||||||
if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
|
if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
|
||||||
@ -483,7 +503,12 @@ void Adafruit_ST7735::drawFastVLine(int16_t x, int16_t y, int16_t h,
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, HIGH);
|
||||||
|
#else
|
||||||
*rsport |= rspinmask;
|
*rsport |= rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
while (h--) {
|
while (h--) {
|
||||||
spiwrite(hi);
|
spiwrite(hi);
|
||||||
@ -510,7 +535,12 @@ void Adafruit_ST7735::drawFastHLine(int16_t x, int16_t y, int16_t w,
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, HIGH);
|
||||||
|
#else
|
||||||
*rsport |= rspinmask;
|
*rsport |= rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
while (w--) {
|
while (w--) {
|
||||||
spiwrite(hi);
|
spiwrite(hi);
|
||||||
@ -547,7 +577,12 @@ void Adafruit_ST7735::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
if (hwSPI) SPI.beginTransaction(spisettings);
|
if (hwSPI) SPI.beginTransaction(spisettings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ARDUINO_ARC__
|
||||||
|
digitalWrite(_rs, HIGH);
|
||||||
|
#else
|
||||||
*rsport |= rspinmask;
|
*rsport |= rspinmask;
|
||||||
|
#endif
|
||||||
*csport &= ~cspinmask;
|
*csport &= ~cspinmask;
|
||||||
for(y=h; y>0; y--) {
|
for(y=h; y>0; y--) {
|
||||||
for(x=w; x>0; x--) {
|
for(x=w; x>0; x--) {
|
||||||
|
@ -139,7 +139,7 @@ class Adafruit_ST7735 : public Adafruit_GFX {
|
|||||||
#ifdef SPI_HAS_TRANSACTION
|
#ifdef SPI_HAS_TRANSACTION
|
||||||
SPISettings spisettings;
|
SPISettings spisettings;
|
||||||
#endif
|
#endif
|
||||||
#if defined(ARDUINO_ARCH_SAM)
|
#if defined(ARDUINO_ARCH_SAM) || defined(__ARDUINO_ARC__)
|
||||||
volatile uint32_t *dataport, *clkport, *csport, *rsport;
|
volatile uint32_t *dataport, *clkport, *csport, *rsport;
|
||||||
uint32_t _cs, _rs, _rst, _sid, _sclk,
|
uint32_t _cs, _rs, _rst, _sid, _sclk,
|
||||||
datapinmask, clkpinmask, cspinmask, rspinmask,
|
datapinmask, clkpinmask, cspinmask, rspinmask,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef ARDUINO_ARCH_SAM
|
#if !defined(ARDUINO_ARCH_SAM) && !defined(__ARDUINO_ARC__)
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#endif
|
#endif
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user