Skip to content

Commit 0e58d91

Browse files
committed
Merge pull request #4588 from bigdinotech/tftlib
Add Arduino/Genuino 101 support to TFT library
2 parents 5500c9b + bfd0da0 commit 0e58d91

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

libraries/TFT/src/utility/Adafruit_ST7735.cpp

+35
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ void Adafruit_ST7735::writecommand(uint8_t c) {
7676
#ifdef SPI_HAS_TRANSACTION
7777
if (hwSPI) SPI.beginTransaction(spisettings);
7878
#endif
79+
80+
#ifdef __ARDUINO_ARC__
81+
digitalWrite(_rs, LOW);
82+
#else
7983
*rsport &= ~rspinmask;
84+
#endif
8085
*csport &= ~cspinmask;
8186

8287
//Serial.print("C ");
@@ -93,7 +98,12 @@ void Adafruit_ST7735::writedata(uint8_t c) {
9398
#ifdef SPI_HAS_TRANSACTION
9499
if (hwSPI) SPI.beginTransaction(spisettings);
95100
#endif
101+
102+
#ifdef __ARDUINO_ARC__
103+
digitalWrite(_rs, HIGH);
104+
#else
96105
*rsport |= rspinmask;
106+
#endif
97107
*csport &= ~cspinmask;
98108

99109
//Serial.print("D ");
@@ -432,7 +442,12 @@ void Adafruit_ST7735::pushColor(uint16_t color) {
432442
#ifdef SPI_HAS_TRANSACTION
433443
if (hwSPI) SPI.beginTransaction(spisettings);
434444
#endif
445+
446+
#ifdef __ARDUINO_ARC__
447+
digitalWrite(_rs, HIGH);
448+
#else
435449
*rsport |= rspinmask;
450+
#endif
436451
*csport &= ~cspinmask;
437452

438453
if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
@@ -454,7 +469,12 @@ void Adafruit_ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) {
454469
#ifdef SPI_HAS_TRANSACTION
455470
if (hwSPI) SPI.beginTransaction(spisettings);
456471
#endif
472+
473+
#ifdef __ARDUINO_ARC__
474+
digitalWrite(_rs, HIGH);
475+
#else
457476
*rsport |= rspinmask;
477+
#endif
458478
*csport &= ~cspinmask;
459479

460480
if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
@@ -483,7 +503,12 @@ void Adafruit_ST7735::drawFastVLine(int16_t x, int16_t y, int16_t h,
483503
#ifdef SPI_HAS_TRANSACTION
484504
if (hwSPI) SPI.beginTransaction(spisettings);
485505
#endif
506+
507+
#ifdef __ARDUINO_ARC__
508+
digitalWrite(_rs, HIGH);
509+
#else
486510
*rsport |= rspinmask;
511+
#endif
487512
*csport &= ~cspinmask;
488513
while (h--) {
489514
spiwrite(hi);
@@ -510,7 +535,12 @@ void Adafruit_ST7735::drawFastHLine(int16_t x, int16_t y, int16_t w,
510535
#ifdef SPI_HAS_TRANSACTION
511536
if (hwSPI) SPI.beginTransaction(spisettings);
512537
#endif
538+
539+
#ifdef __ARDUINO_ARC__
540+
digitalWrite(_rs, HIGH);
541+
#else
513542
*rsport |= rspinmask;
543+
#endif
514544
*csport &= ~cspinmask;
515545
while (w--) {
516546
spiwrite(hi);
@@ -547,7 +577,12 @@ void Adafruit_ST7735::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
547577
#ifdef SPI_HAS_TRANSACTION
548578
if (hwSPI) SPI.beginTransaction(spisettings);
549579
#endif
580+
581+
#ifdef __ARDUINO_ARC__
582+
digitalWrite(_rs, HIGH);
583+
#else
550584
*rsport |= rspinmask;
585+
#endif
551586
*csport &= ~cspinmask;
552587
for(y=h; y>0; y--) {
553588
for(x=w; x>0; x--) {

libraries/TFT/src/utility/Adafruit_ST7735.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class Adafruit_ST7735 : public Adafruit_GFX {
139139
#ifdef SPI_HAS_TRANSACTION
140140
SPISettings spisettings;
141141
#endif
142-
#if defined(ARDUINO_ARCH_SAM)
142+
#if defined(ARDUINO_ARCH_SAM) || defined(__ARDUINO_ARC__)
143143
volatile uint32_t *dataport, *clkport, *csport, *rsport;
144144
uint32_t _cs, _rs, _rst, _sid, _sclk,
145145
datapinmask, clkpinmask, cspinmask, rspinmask,

libraries/TFT/src/utility/glcdfont.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifndef ARDUINO_ARCH_SAM
1+
#if !defined(ARDUINO_ARCH_SAM) && !defined(__ARDUINO_ARC__)
22
#include <avr/io.h>
33
#endif
44
#include <avr/pgmspace.h>

0 commit comments

Comments
 (0)