Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ported writeRect to write 16bpp pixmaps from PaulStoffregen/ILI9341_t3 as well as DemoSauce examples #1

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace all ILI9341_t3 -> Adafruit_ILI9341
My apologies, this was already in my tree, but I messed up copying this
over and those were missing from this PR.
  • Loading branch information
marcmerlin committed Mar 5, 2017
commit 5af7ea324c12dd08e7c2d3e8602976734529be11
14 changes: 7 additions & 7 deletions examples/DemoSauce/BaseAnimation.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
#define BASE_ANIMATION_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"

class BaseAnimation {
public:
BaseAnimation(){};

virtual void init( ILI9341_t3 tft );
virtual void init( Adafruit_ILI9341 tft );
virtual uint_fast16_t bgColor( void );
virtual void reset( ILI9341_t3 tft );
virtual void reset( Adafruit_ILI9341 tft );
virtual String title();

virtual boolean willForceTransition( void );
virtual boolean forceTransitionNow( void );

virtual void perFrame( ILI9341_t3 tft, FrameParams frameParams );
virtual void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );
};

void BaseAnimation::init( ILI9341_t3 tft ) {
void BaseAnimation::init( Adafruit_ILI9341 tft ) {
// Extend me
}

Expand All @@ -29,7 +29,7 @@ uint_fast16_t BaseAnimation::bgColor( void ) {
return 0xf81f; // Everyone loves magenta
}

void BaseAnimation::reset( ILI9341_t3 tft ) {
void BaseAnimation::reset( Adafruit_ILI9341 tft ) {
// Extend me
}

Expand All @@ -46,7 +46,7 @@ boolean BaseAnimation::forceTransitionNow( void ) {
return false; // Default: SuperTFT will transition animations automatically
}

void BaseAnimation::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void BaseAnimation::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
// Extend me
}

Expand Down
14 changes: 7 additions & 7 deletions examples/DemoSauce/BaseTransition.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
#define BASE_TRANSITION_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"

class BaseTransition {
public:
BaseTransition(){};

virtual void init( ILI9341_t3 tft );
virtual void restart( ILI9341_t3 tft, uint_fast16_t color );
virtual void perFrame( ILI9341_t3 tft, FrameParams frameParams );
virtual void init( Adafruit_ILI9341 tft );
virtual void restart( Adafruit_ILI9341 tft, uint_fast16_t color );
virtual void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );
virtual boolean isComplete();
};

void BaseTransition::init( ILI9341_t3 tft ) {
void BaseTransition::init( Adafruit_ILI9341 tft ) {
// Extend me
}

void BaseTransition::restart( ILI9341_t3 tft, uint_fast16_t color ) {
void BaseTransition::restart( Adafruit_ILI9341 tft, uint_fast16_t color ) {
// Extend me
}

void BaseTransition::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void BaseTransition::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
// Extend me
}

Expand Down
10 changes: 5 additions & 5 deletions examples/DemoSauce/Checkerboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CHECKERBOARD_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"
#include "BaseAnimation.h"

Expand All @@ -21,17 +21,17 @@ class Checkerboard : public BaseAnimation {
public:
Checkerboard() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
float _phase = 0;
uint_fast16_t _bgColor;
};

void Checkerboard::init( ILI9341_t3 tft ) {
void Checkerboard::init( Adafruit_ILI9341 tft ) {
_bgColor = tft.color565( 0xff, 0xbb, 0xbb );
}

Expand All @@ -43,7 +43,7 @@ String Checkerboard::title() {
return "Checkerboard";
}

void Checkerboard::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void Checkerboard::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
int_fast16_t w = (int_fast16_t)tft.width();
int_fast16_t h = (int_fast16_t)tft.height();

Expand Down
10 changes: 5 additions & 5 deletions examples/DemoSauce/Cube3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define CUBE_3D_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"
#include "BaseAnimation.h"

Expand All @@ -14,18 +14,18 @@ class Cube3D : public BaseAnimation {
public:
Cube3D() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
float _phase = 0;
float _audio = 0;
uint_fast16_t _bgColor;
};

void Cube3D::init( ILI9341_t3 tft ) {
void Cube3D::init( Adafruit_ILI9341 tft ) {
_bgColor = tft.color565( 0, 0, 0 );
}

Expand All @@ -37,7 +37,7 @@ String Cube3D::title() {
return "Cube3D";
}

void Cube3D::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void Cube3D::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
uint_fast16_t w = (uint_fast16_t)tft.width();
uint_fast16_t h = (uint_fast16_t)tft.height();

Expand Down
14 changes: 7 additions & 7 deletions examples/DemoSauce/Leaves.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <Arduino.h>
#include <math.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "BaseAnimation.h"


Expand All @@ -19,19 +19,19 @@ class Leaves : public BaseAnimation {
public:
Leaves() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
void _drawLeaves( ILI9341_t3 tft, boolean doErase, uint_fast8_t iter, float radius, float spin, float x, float y, uint_fast16_t solidColor, uint_fast16_t outlineColor );
void _drawLeaves( Adafruit_ILI9341 tft, boolean doErase, uint_fast8_t iter, float radius, float spin, float x, float y, uint_fast16_t solidColor, uint_fast16_t outlineColor );

float _phase = 0;
uint_fast16_t _bgColor;
};

void Leaves::init( ILI9341_t3 tft ) {
void Leaves::init( Adafruit_ILI9341 tft ) {
_bgColor = 0x780f;
}

Expand All @@ -43,7 +43,7 @@ String Leaves::title() {
return "Leaves";
}

void Leaves::_drawLeaves( ILI9341_t3 tft, boolean doErase, uint_fast8_t iter, float radius, float spin, float x, float y, uint_fast16_t solidColor, uint_fast16_t outlineColor ) {
void Leaves::_drawLeaves( Adafruit_ILI9341 tft, boolean doErase, uint_fast8_t iter, float radius, float spin, float x, float y, uint_fast16_t solidColor, uint_fast16_t outlineColor ) {
float radius_2 = radius * 0.5;
float angle = M_PI + (spin * (iter+0.7));
for( uint_fast8_t i=0; i<3; i++ ) {
Expand All @@ -60,7 +60,7 @@ void Leaves::_drawLeaves( ILI9341_t3 tft, boolean doErase, uint_fast8_t iter, fl
}
}

void Leaves::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void Leaves::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
uint_fast16_t w = tft.width();
uint_fast16_t h = tft.height();

Expand Down
10 changes: 5 additions & 5 deletions examples/DemoSauce/MagentaSquares.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define MAGENTA_SQUARES_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"
#include "BaseAnimation.h"

Expand All @@ -20,10 +20,10 @@ class MagentaSquares : public BaseAnimation {
public:
MagentaSquares() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
inline float distance2D( float w, float h );
Expand All @@ -43,7 +43,7 @@ inline float MagentaSquares::distance2D( float w, float h ) {
return sqrt( w*w + h*h );
}

void MagentaSquares::init( ILI9341_t3 tft ) {
void MagentaSquares::init( Adafruit_ILI9341 tft ) {
uint_fast16_t w = tft.width();
uint_fast16_t h = tft.height();

Expand Down Expand Up @@ -75,7 +75,7 @@ String MagentaSquares::title() {
return "MagentaSquares";
}

void MagentaSquares::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void MagentaSquares::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
//uint_fast16_t w = tft.width();
//uint_fast16_t h = tft.height();

Expand Down
10 changes: 5 additions & 5 deletions examples/DemoSauce/PlasmaCloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PLASMA_CLOUD_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"
#include "BaseAnimation.h"

Expand All @@ -23,10 +23,10 @@ class PlasmaCloud : public BaseAnimation {
public:
PlasmaCloud() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
float _phase = 0;
Expand All @@ -35,7 +35,7 @@ class PlasmaCloud : public BaseAnimation {
uint_fast16_t _bgColor;
};

void PlasmaCloud::init( ILI9341_t3 tft ) {
void PlasmaCloud::init( Adafruit_ILI9341 tft ) {
_bgColor = tft.color565( 0x77, 0, 0xcc );

float w = (float)tft.width();
Expand Down Expand Up @@ -64,7 +64,7 @@ String PlasmaCloud::title() {
return "PlasmaCloud";
}

void PlasmaCloud::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void PlasmaCloud::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
uint_fast16_t w = (int_fast16_t)tft.width();
uint_fast16_t h = (int_fast16_t)tft.height();

Expand Down
10 changes: 5 additions & 5 deletions examples/DemoSauce/PlasmaYellow.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define PLASMA_YELLOW_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"
#include "BaseAnimation.h"

Expand All @@ -16,18 +16,18 @@ class PlasmaYellow : public BaseAnimation {
public:
PlasmaYellow() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
float _phase = 0;
uint_fast8_t _ditherY = 0;
uint_fast16_t _bgColor;
};

void PlasmaYellow::init( ILI9341_t3 tft ) {
void PlasmaYellow::init( Adafruit_ILI9341 tft ) {
_bgColor = tft.color565( 0xff, 0xff, 0 );
}

Expand All @@ -39,7 +39,7 @@ String PlasmaYellow::title() {
return "PlasmaYellow";
}

void PlasmaYellow::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void PlasmaYellow::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
int_fast16_t w = (int_fast16_t)tft.width();
int_fast16_t h = (int_fast16_t)tft.height();

Expand Down
14 changes: 7 additions & 7 deletions examples/DemoSauce/Sphere3D.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define SPHERE_3D_H__

#include <Arduino.h>
#include "ILI9341_t3.h"
#include "Adafruit_ILI9341.h"
#include "MathUtil.h"
#include "BaseAnimation.h"

Expand All @@ -20,13 +20,13 @@ class Sphere3D : public BaseAnimation {
public:
Sphere3D() : BaseAnimation() {};

void init( ILI9341_t3 tft );
void init( Adafruit_ILI9341 tft );
uint_fast16_t bgColor( void );
String title();
void perFrame( ILI9341_t3 tft, FrameParams frameParams );
void perFrame( Adafruit_ILI9341 tft, FrameParams frameParams );

private:
void _drawLine( ILI9341_t3 tft, float cosTilt, float sinTilt, float x, float y, float z, uint_fast16_t w_2, uint_fast16_t h_2, uint_fast16_t color );
void _drawLine( Adafruit_ILI9341 tft, float cosTilt, float sinTilt, float x, float y, float z, uint_fast16_t w_2, uint_fast16_t h_2, uint_fast16_t color );

float _rotatePhase = 0;
uint_fast16_t _baseCircSize = 0;
Expand All @@ -36,7 +36,7 @@ class Sphere3D : public BaseAnimation {
uint_fast16_t _bgColor;
};

void Sphere3D::init( ILI9341_t3 tft ) {
void Sphere3D::init( Adafruit_ILI9341 tft ) {
uint_fast16_t w = tft.width();
uint_fast16_t h = tft.height();

Expand All @@ -55,7 +55,7 @@ String Sphere3D::title() {
return "Sphere3D";
}

void Sphere3D::_drawLine( ILI9341_t3 tft, float cosTilt, float sinTilt, float x, float y, float z, uint_fast16_t w_2, uint_fast16_t h_2, uint_fast16_t color ) {
void Sphere3D::_drawLine( Adafruit_ILI9341 tft, float cosTilt, float sinTilt, float x, float y, float z, uint_fast16_t w_2, uint_fast16_t h_2, uint_fast16_t color ) {
// Tilt!
float tempY = y;
y = tempY*cosTilt + z*sinTilt;
Expand All @@ -73,7 +73,7 @@ void Sphere3D::_drawLine( ILI9341_t3 tft, float cosTilt, float sinTilt, float x,

}

void Sphere3D::perFrame( ILI9341_t3 tft, FrameParams frameParams ) {
void Sphere3D::perFrame( Adafruit_ILI9341 tft, FrameParams frameParams ) {
uint_fast16_t w = (uint_fast16_t)tft.width();
uint_fast16_t h = (uint_fast16_t)tft.height();

Expand Down
Loading