Skip to content

Commit

Permalink
Merge pull request arduino#4588 from bigdinotech/tftlib
Browse files Browse the repository at this point in the history
Add Arduino/Genuino 101 support to TFT library
  • Loading branch information
facchinm committed Mar 2, 2016
2 parents 5500c9b + bfd0da0 commit 0e58d91
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
35 changes: 35 additions & 0 deletions libraries/TFT/src/utility/Adafruit_ST7735.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ void Adafruit_ST7735::writecommand(uint8_t c) {
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, LOW);
#else
*rsport &= ~rspinmask;
#endif
*csport &= ~cspinmask;

//Serial.print("C ");
Expand All @@ -93,7 +98,12 @@ void Adafruit_ST7735::writedata(uint8_t c) {
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, HIGH);
#else
*rsport |= rspinmask;
#endif
*csport &= ~cspinmask;

//Serial.print("D ");
Expand Down Expand Up @@ -432,7 +442,12 @@ void Adafruit_ST7735::pushColor(uint16_t color) {
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, HIGH);
#else
*rsport |= rspinmask;
#endif
*csport &= ~cspinmask;

if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
Expand All @@ -454,7 +469,12 @@ void Adafruit_ST7735::drawPixel(int16_t x, int16_t y, uint16_t color) {
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, HIGH);
#else
*rsport |= rspinmask;
#endif
*csport &= ~cspinmask;

if (tabcolor == INITR_BLACKTAB) color = swapcolor(color);
Expand Down Expand Up @@ -483,7 +503,12 @@ void Adafruit_ST7735::drawFastVLine(int16_t x, int16_t y, int16_t h,
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, HIGH);
#else
*rsport |= rspinmask;
#endif
*csport &= ~cspinmask;
while (h--) {
spiwrite(hi);
Expand All @@ -510,7 +535,12 @@ void Adafruit_ST7735::drawFastHLine(int16_t x, int16_t y, int16_t w,
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, HIGH);
#else
*rsport |= rspinmask;
#endif
*csport &= ~cspinmask;
while (w--) {
spiwrite(hi);
Expand Down Expand Up @@ -547,7 +577,12 @@ void Adafruit_ST7735::fillRect(int16_t x, int16_t y, int16_t w, int16_t h,
#ifdef SPI_HAS_TRANSACTION
if (hwSPI) SPI.beginTransaction(spisettings);
#endif

#ifdef __ARDUINO_ARC__
digitalWrite(_rs, HIGH);
#else
*rsport |= rspinmask;
#endif
*csport &= ~cspinmask;
for(y=h; y>0; y--) {
for(x=w; x>0; x--) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/TFT/src/utility/Adafruit_ST7735.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class Adafruit_ST7735 : public Adafruit_GFX {
#ifdef SPI_HAS_TRANSACTION
SPISettings spisettings;
#endif
#if defined(ARDUINO_ARCH_SAM)
#if defined(ARDUINO_ARCH_SAM) || defined(__ARDUINO_ARC__)
volatile uint32_t *dataport, *clkport, *csport, *rsport;
uint32_t _cs, _rs, _rst, _sid, _sclk,
datapinmask, clkpinmask, cspinmask, rspinmask,
Expand Down
2 changes: 1 addition & 1 deletion libraries/TFT/src/utility/glcdfont.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef ARDUINO_ARCH_SAM
#if !defined(ARDUINO_ARCH_SAM) && !defined(__ARDUINO_ARC__)
#include <avr/io.h>
#endif
#include <avr/pgmspace.h>
Expand Down

0 comments on commit 0e58d91

Please sign in to comment.