Commit 89bf0ce6 authored by Bodmer's avatar Bodmer

Fix #581 plus

Update 4 bit Sprite code
Update Animate_Dial example to use italic font with minimised character set, add original jpeg graphic.
Raise to 2.1.8
parent 611ca4b2
...@@ -376,7 +376,7 @@ int16_t TFT_eSprite::getPivotY(void) ...@@ -376,7 +376,7 @@ int16_t TFT_eSprite::getPivotY(void)
#define FP_SCALE 10 #define FP_SCALE 10
bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp) bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
{ {
if ( !_created ) return false; if ( !_created || _bpp == 4) return false;
// Bounding box parameters // Bounding box parameters
int16_t min_x; int16_t min_x;
...@@ -444,8 +444,8 @@ bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp) ...@@ -444,8 +444,8 @@ bool TFT_eSprite::pushRotated(int16_t angle, int32_t transp)
*************************************************************************************x*/ *************************************************************************************x*/
bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp) bool TFT_eSprite::pushRotated(TFT_eSprite *spr, int16_t angle, int32_t transp)
{ {
if ( !_created ) return false; // Check this Sprite is created if ( !_created || _bpp == 4) return false; // Check this Sprite is created
if ( !spr->_created ) return false; // Ckeck destination Sprite is created if ( !spr->_created || spr->_bpp == 4) return false; // Ckeck destination Sprite is created
// Bounding box parameters // Bounding box parameters
int16_t min_x; int16_t min_x;
...@@ -688,9 +688,9 @@ uint8_t TFT_eSprite::readPixelValue(int32_t x, int32_t y) ...@@ -688,9 +688,9 @@ uint8_t TFT_eSprite::readPixelValue(int32_t x, int32_t y)
if (_bpp == 4) if (_bpp == 4)
{ {
if ((x & 0x01) == 0) if ((x & 0x01) == 0)
return ((_img4[((x+y*_iwidth)>>1)] & 0xF0) >> 4) & 0x0F; // even index = bits 7 .. 4 return _img4[((x+y*_iwidth)>>1)] >> 4; // even index = bits 7 .. 4
else else
return _img4[((x-1+y*_iwidth)>>1)] & 0x0F; // odd index = bits 3 .. 0. return _img4[((x+y*_iwidth)>>1)] & 0x0F; // odd index = bits 3 .. 0.
} }
return readPixel(x, y); return readPixel(x, y);
} }
...@@ -726,9 +726,9 @@ uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y) ...@@ -726,9 +726,9 @@ uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y)
{ {
uint16_t color; uint16_t color;
if ((x & 0x01) == 0) if ((x & 0x01) == 0)
color = _colorMap[((_img4[((x+y*_iwidth)>>1)] & 0xF0) >> 4) & 0x0F ]; // even index = bits 7 .. 4 color = _colorMap[_img4[((x+y*_iwidth)>>1)] >> 4]; // even index = bits 7 .. 4
else else
color = _colorMap[_img4[((x-1+y*_iwidth)>>1)] & 0x0F]; // odd index = bits 3 .. 0. color = _colorMap[_img4[((x+y*_iwidth)>>1)] & 0x0F]; // odd index = bits 3 .. 0.
return color; return color;
} }
...@@ -752,8 +752,8 @@ uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y) ...@@ -752,8 +752,8 @@ uint16_t TFT_eSprite::readPixel(int32_t x, int32_t y)
uint16_t color = (_img8[(x + y * _bitwidth)>>3] << (x & 0x7)) & 0x80; uint16_t color = (_img8[(x + y * _bitwidth)>>3] << (x & 0x7)) & 0x80;
if (color >> 7) return _tft->bitmap_fg; if (color) return _tft->bitmap_fg;
else return _tft->bitmap_bg; else return _tft->bitmap_bg;
} }
...@@ -1038,10 +1038,10 @@ void TFT_eSprite::pushColor(uint32_t color) ...@@ -1038,10 +1038,10 @@ void TFT_eSprite::pushColor(uint32_t color)
{ {
uint8_t c = (uint8_t)color & 0x0F; uint8_t c = (uint8_t)color & 0x0F;
if ((_xptr & 0x01) == 0) { if ((_xptr & 0x01) == 0) {
_img4[(_xptr + _yptr * _iwidth)>>1] = ((c << 4) & 0xF0) | (_img4[(_xptr + _yptr * _iwidth)>>1] & 0x0F); // new color is in bits 7 .. 4 _img4[(_xptr + _yptr * _iwidth)>>1] = (c << 4) | (_img4[(_xptr + _yptr * _iwidth)>>1] & 0x0F); // new color is in bits 7 .. 4
} }
else { else {
_img4[(_xptr - 1 + _yptr * _iwidth)>>1] = (_img4[(_xptr - 1 + _yptr * _iwidth)>>1] & 0xF0) | c; // new color is the low bits _img4[(_xptr + _yptr * _iwidth)>>1] = (_img4[(_xptr + _yptr * _iwidth)>>1] & 0xF0) | c; // new color is the low bits
} }
} }
...@@ -1101,9 +1101,9 @@ void TFT_eSprite::writeColor(uint16_t color) ...@@ -1101,9 +1101,9 @@ void TFT_eSprite::writeColor(uint16_t color)
{ {
uint8_t c = (uint8_t)color & 0x0F; uint8_t c = (uint8_t)color & 0x0F;
if ((_xptr & 0x01) == 0) if ((_xptr & 0x01) == 0)
_img4[(_xptr + _yptr * _iwidth)>>1] = ((c << 4) & 0xF0) | (_img4[(_xptr + _yptr * _iwidth)>>1] & 0x0F); // new color is in bits 7 .. 4 _img4[(_xptr + _yptr * _iwidth)>>1] = (c << 4) | (_img4[(_xptr + _yptr * _iwidth)>>1] & 0x0F); // new color is in bits 7 .. 4
else else
_img4[(_xptr - 1 + _yptr * _iwidth)>>1] = (_img4[(_xptr - 1 + _yptr * _iwidth)>>1] & 0xF0) | c; // new color is the low bits (x is odd) _img4[(_xptr + _yptr * _iwidth)>>1] = (_img4[(_xptr + _yptr * _iwidth)>>1] & 0xF0) | c; // new color is the low bits (x is odd)
} }
else drawPixel(_xptr, _yptr, color); else drawPixel(_xptr, _yptr, color);
...@@ -1370,13 +1370,11 @@ void TFT_eSprite::drawPixel(int32_t x, int32_t y, uint32_t color) ...@@ -1370,13 +1370,11 @@ void TFT_eSprite::drawPixel(int32_t x, int32_t y, uint32_t color)
else if (_bpp == 4) else if (_bpp == 4)
{ {
uint8_t c = color & 0x0F; uint8_t c = color & 0x0F;
int index = 0; int index = (x+y*_iwidth)>>1;;
if ((x & 0x01) == 0) { if ((x & 0x01) == 0) {
index = (x+y*_iwidth)>>1; _img4[index] = (uint8_t)((c << 4) | (_img4[index] & 0x0F));
_img4[index] = (uint8_t)(((c << 4) & 0xF0) | (_img4[index] & 0x0F));
} }
else { else {
index = (x-1+y*_iwidth)>>1;
_img4[index] = (uint8_t)(c | (_img4[index] & 0xF0)); _img4[index] = (uint8_t)(c | (_img4[index] & 0xF0));
} }
} }
...@@ -1501,7 +1499,7 @@ void TFT_eSprite::drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color) ...@@ -1501,7 +1499,7 @@ void TFT_eSprite::drawFastVLine(int32_t x, int32_t y, int32_t h, uint32_t color)
else { else {
uint8_t c = (uint8_t)color & 0xF; uint8_t c = (uint8_t)color & 0xF;
while (h--) { while (h--) {
_img4[(x - 1 + _iwidth * y)>>1] = (uint8_t) (c | (_img4[(x - 1 + _iwidth * y)>>1] & 0xF0)); // x is odd; new color goes into the low bits. _img4[(x + _iwidth * y)>>1] = (uint8_t) (c | (_img4[(x + _iwidth * y)>>1] & 0xF0)); // x is odd; new color goes into the low bits.
y++; y++;
} }
} }
......
...@@ -384,6 +384,12 @@ ...@@ -384,6 +384,12 @@
GPIOB->BSRR = D11_BSR_MASK(C) | D12_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \ GPIOB->BSRR = D11_BSR_MASK(C) | D12_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
WR_STB WR_STB
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
#define tft_Write_32C(C,D) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(D))
#define tft_Write_32D(C) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(C))
// Read a data bit // Read a data bit
#define RD_TFT_D0 (((GPIOA->IDR)&(D0_PIN_MASK))>>( 9-0)) // Read pin PA9 #define RD_TFT_D0 (((GPIOA->IDR)&(D0_PIN_MASK))>>( 9-0)) // Read pin PA9
#define RD_TFT_D1 (((GPIOC->IDR)&(D1_PIN_MASK))>>( 7-1)) // Read pin PC7 #define RD_TFT_D1 (((GPIOC->IDR)&(D1_PIN_MASK))>>( 7-1)) // Read pin PC7
...@@ -481,6 +487,12 @@ ...@@ -481,6 +487,12 @@
GPIOE->BSRR = D11_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \ GPIOE->BSRR = D11_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
WR_STB WR_STB
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
#define tft_Write_32C(C,D) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(D))
#define tft_Write_32D(C) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(C))
// Read a data bit // Read a data bit
#define RD_TFT_D0 (((GPIOF->IDR)&(D0_PIN_MASK))>>(12-0)) // Read pin PF12 #define RD_TFT_D0 (((GPIOF->IDR)&(D0_PIN_MASK))>>(12-0)) // Read pin PF12
#define RD_TFT_D1 (((GPIOD->IDR)&(D1_PIN_MASK))>>(15-1)) // Read pin PD15 #define RD_TFT_D1 (((GPIOD->IDR)&(D1_PIN_MASK))>>(15-1)) // Read pin PD15
...@@ -581,6 +593,12 @@ ...@@ -581,6 +593,12 @@
GPIOE->BSRR = D11_BSR_MASK(C) | D12_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \ GPIOE->BSRR = D11_BSR_MASK(C) | D12_BSR_MASK(C) | D13_BSR_MASK(C) | D14_BSR_MASK(C); \
WR_STB WR_STB
#define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
#define tft_Write_32C(C,D) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(D))
#define tft_Write_32D(C) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(C))
// Read a data bit // Read a data bit
#define RD_TFT_D0 (((GPIOF->IDR)&(D0_PIN_MASK))>>( 3-0)) // Read pin PF3 #define RD_TFT_D0 (((GPIOF->IDR)&(D0_PIN_MASK))>>( 3-0)) // Read pin PF3
#define RD_TFT_D1 (((GPIOD->IDR)&(D1_PIN_MASK))>>(15-1)) // Read pin PD15 #define RD_TFT_D1 (((GPIOD->IDR)&(D1_PIN_MASK))>>(15-1)) // Read pin PD15
...@@ -590,6 +608,7 @@ ...@@ -590,6 +608,7 @@
#define RD_TFT_D5 (((GPIOE->IDR)&(D5_PIN_MASK))>>(11-5)) // Read pin PE11 #define RD_TFT_D5 (((GPIOE->IDR)&(D5_PIN_MASK))>>(11-5)) // Read pin PE11
#define RD_TFT_D6 (((GPIOE->IDR)&(D6_PIN_MASK))>>( 9-6)) // Read pin PE9 #define RD_TFT_D6 (((GPIOE->IDR)&(D6_PIN_MASK))>>( 9-6)) // Read pin PE9
#define RD_TFT_D7 (((GPIOG->IDR)&(D7_PIN_MASK))>>(12-7)) // Read pin PG12 #define RD_TFT_D7 (((GPIOG->IDR)&(D7_PIN_MASK))>>(12-7)) // Read pin PG12
#endif #endif
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// Support for other STM32 boards (not optimised!) // Support for other STM32 boards (not optimised!)
...@@ -600,101 +619,134 @@ ...@@ -600,101 +619,134 @@
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask // Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D0_PIN_NAME digitalPinToPinName(TFT_D0) #define D0_PIN_NAME digitalPinToPinName(TFT_D0)
#ifndef D0_PORT
#define D0_PORT get_GPIO_Port(STM_PORT(D0_PIN_NAME))
#endif
#define D0_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D0_PIN_NAME)<<16
// Use bit set reset register
#define D0_BSR(B) D0_PORT->BSRR = (D0_PIN_MASK)>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D1_PIN_NAME digitalPinToPinName(TFT_D1) #define D1_PIN_NAME digitalPinToPinName(TFT_D1)
#ifndef D1_PORT
#define D1_PORT get_GPIO_Port(STM_PORT(D1_PIN_NAME))
#endif
#define D1_PIN_MASK STM_LL_GPIO_PIN(D1_PIN_NAME)<<16
// Use bit set reset register
#define D1_BSR(B) D1_PORT->BSRR = D1_PIN_MASK>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D2_PIN_NAME digitalPinToPinName(TFT_D2) #define D2_PIN_NAME digitalPinToPinName(TFT_D2)
#ifndef D2_PORT
#define D2_PORT get_GPIO_Port(STM_PORT(D2_PIN_NAME))
#endif
#define D2_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D2_PIN_NAME)<<16
// Use bit set reset register
#define D2_BSR(B) D2_PORT->BSRR = D2_PIN_MASK>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D3_PIN_NAME digitalPinToPinName(TFT_D3) #define D3_PIN_NAME digitalPinToPinName(TFT_D3)
#ifndef D3_PORT
#define D3_PORT get_GPIO_Port(STM_PORT(D3_PIN_NAME))
#endif
#define D3_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D3_PIN_NAME)<<16
// Use bit set reset register
#define D3_BSR(B) D3_PORT->BSRR = D3_PIN_MASK>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D4_PIN_NAME digitalPinToPinName(TFT_D4) #define D4_PIN_NAME digitalPinToPinName(TFT_D4)
#ifndef D4_PORT
#define D4_PORT get_GPIO_Port(STM_PORT(D4_PIN_NAME))
#endif
#define D4_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D4_PIN_NAME)<<16
// Use bit set reset register
#define D4_BSR(B) D4_PORT->BSRR = D4_PIN_MASK>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D5_PIN_NAME digitalPinToPinName(TFT_D5) #define D5_PIN_NAME digitalPinToPinName(TFT_D5)
#ifndef D5_PORT
#define D5_PORT get_GPIO_Port(STM_PORT(D5_PIN_NAME))
#endif
#define D5_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D5_PIN_NAME)<<16
// Use bit set reset register
#define D5_BSR(B) D5_PORT->BSRR = D5_PIN_MASK>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D6_PIN_NAME digitalPinToPinName(TFT_D6) #define D6_PIN_NAME digitalPinToPinName(TFT_D6)
#ifndef D6_PORT
#define D6_PORT get_GPIO_Port(STM_PORT(D6_PIN_NAME))
#endif
#define D6_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D6_PIN_NAME)<<16
// Use bit set reset register
#define D6_BSR(B) D6_PORT->BSRR = D6_PIN_MASK>>(B)
// Convert Arduino pin reference Dx or STM pin reference PXn to hardware port and mask
#define D7_PIN_NAME digitalPinToPinName(TFT_D7) #define D7_PIN_NAME digitalPinToPinName(TFT_D7)
#ifndef D7_PORT
#define D7_PORT get_GPIO_Port(STM_PORT(D7_PIN_NAME)) #define D0_PIN_BIT STM_LL_GPIO_PIN(D0_PIN_NAME)
#endif #define D1_PIN_BIT STM_LL_GPIO_PIN(D1_PIN_NAME)
#define D7_PIN_MASK (const uint16_t)STM_LL_GPIO_PIN(D7_PIN_NAME)<<16 #define D2_PIN_BIT STM_LL_GPIO_PIN(D2_PIN_NAME)
// Use bit set reset register #define D3_PIN_BIT STM_LL_GPIO_PIN(D3_PIN_NAME)
#define D7_BSR(B) D7_PORT->BSRR = D7_PIN_MASK>>(B) #define D4_PIN_BIT STM_LL_GPIO_PIN(D4_PIN_NAME)
#define D5_PIN_BIT STM_LL_GPIO_PIN(D5_PIN_NAME)
// Write 8 bits to TFT for any Nucleo #define D6_PIN_BIT STM_LL_GPIO_PIN(D6_PIN_NAME)
#define tft_Write_8(C) D7_BSR(((C)>>3)&0x10); D6_BSR(((C)>>2)&0x10); \ #define D7_PIN_BIT STM_LL_GPIO_PIN(D7_PIN_NAME)
D5_BSR(((C)>>1)&0x10); D4_BSR(((C)>>0)&0x10); \
WR_L; \ #define D0_PIN_PORT get_GPIO_Port(STM_PORT(D0_PIN_NAME))
D3_BSR(((C)<<1)&0x10); D2_BSR(((C)<<2)&0x10); \ #define D1_PIN_PORT get_GPIO_Port(STM_PORT(D1_PIN_NAME))
D1_BSR(((C)<<3)&0x10); D0_BSR(((C)<<4)&0x10); \ #define D2_PIN_PORT get_GPIO_Port(STM_PORT(D2_PIN_NAME))
WR_H #define D3_PIN_PORT get_GPIO_Port(STM_PORT(D3_PIN_NAME))
#define D4_PIN_PORT get_GPIO_Port(STM_PORT(D4_PIN_NAME))
#define D5_PIN_PORT get_GPIO_Port(STM_PORT(D5_PIN_NAME))
#define D6_PIN_PORT get_GPIO_Port(STM_PORT(D6_PIN_NAME))
#define D7_PIN_PORT get_GPIO_Port(STM_PORT(D7_PIN_NAME))
#define D0_PIN_MASK (const uint16_t)(1UL<<D0_PIN_BIT)
#define D1_PIN_MASK (const uint16_t)(1UL<<D1_PIN_BIT)
#define D2_PIN_MASK (const uint16_t)(1UL<<D2_PIN_BIT)
#define D3_PIN_MASK (const uint16_t)(1UL<<D3_PIN_BIT)
#define D4_PIN_MASK (const uint16_t)(1UL<<D4_PIN_BIT)
#define D5_PIN_MASK (const uint16_t)(1UL<<D5_PIN_BIT)
#define D6_PIN_MASK (const uint16_t)(1UL<<D6_PIN_BIT)
#define D7_PIN_MASK (const uint16_t)(1UL<<D7_PIN_BIT)
// Create bit set/reset mask based on LS byte of value B
#define D0_BSR_MASK(B) ((D0_PIN_MASK<<16)>>(((B)<< 4)&0x10))
#define D1_BSR_MASK(B) ((D1_PIN_MASK<<16)>>(((B)<< 3)&0x10))
#define D2_BSR_MASK(B) ((D2_PIN_MASK<<16)>>(((B)<< 2)&0x10))
#define D3_BSR_MASK(B) ((D3_PIN_MASK<<16)>>(((B)<< 1)&0x10))
#define D4_BSR_MASK(B) ((D4_PIN_MASK<<16)>>(((B)<< 0)&0x10))
#define D5_BSR_MASK(B) ((D5_PIN_MASK<<16)>>(((B)>> 1)&0x10))
#define D6_BSR_MASK(B) ((D6_PIN_MASK<<16)>>(((B)>> 2)&0x10))
#define D7_BSR_MASK(B) ((D7_PIN_MASK<<16)>>(((B)>> 3)&0x10))
// Create bit set/reset mask for top byte of 16 bit value B
#define D8_BSR_MASK(B) ((D0_PIN_MASK<<16)>>(((B)>> 4)&0x10))
#define D9_BSR_MASK(B) ((D1_PIN_MASK<<16)>>(((B)>> 5)&0x10))
#define D10_BSR_MASK(B) ((D2_PIN_MASK<<16)>>(((B)>> 6)&0x10))
#define D11_BSR_MASK(B) ((D3_PIN_MASK<<16)>>(((B)>> 7)&0x10))
#define D12_BSR_MASK(B) ((D4_PIN_MASK<<16)>>(((B)>> 8)&0x10))
#define D13_BSR_MASK(B) ((D5_PIN_MASK<<16)>>(((B)>> 9)&0x10))
#define D14_BSR_MASK(B) ((D6_PIN_MASK<<16)>>(((B)>>10)&0x10))
#define D15_BSR_MASK(B) ((D7_PIN_MASK<<16)>>(((B)>>11)&0x10))
// Write 8 bits to TFT
#define tft_Write_8(C) D0_PIN_PORT->BSRR = D0_BSR_MASK(C); \
D1_PIN_PORT->BSRR = D1_BSR_MASK(C); \
D2_PIN_PORT->BSRR = D2_BSR_MASK(C); \
D3_PIN_PORT->BSRR = D3_BSR_MASK(C); \
WR_L; \
D4_PIN_PORT->BSRR = D4_BSR_MASK(C); \
D5_PIN_PORT->BSRR = D5_BSR_MASK(C); \
D6_PIN_PORT->BSRR = D6_BSR_MASK(C); \
D7_PIN_PORT->BSRR = D7_BSR_MASK(C); \
WR_STB
// Write 16 bits to TFT // Write 16 bits to TFT
#define tft_Write_16(C) tft_Write_8((C)>>8); tft_Write_8(C) #define tft_Write_16(C) D0_PIN_PORT->BSRR = D8_BSR_MASK(C); \
D1_PIN_PORT->BSRR = D9_BSR_MASK(C); \
D2_PIN_PORT->BSRR = D10_BSR_MASK(C); \
D3_PIN_PORT->BSRR = D11_BSR_MASK(C); \
WR_L; \
D4_PIN_PORT->BSRR = D12_BSR_MASK(C); \
D5_PIN_PORT->BSRR = D13_BSR_MASK(C); \
D6_PIN_PORT->BSRR = D14_BSR_MASK(C); \
D7_PIN_PORT->BSRR = D15_BSR_MASK(C); \
WR_STB;\
D0_PIN_PORT->BSRR = D0_BSR_MASK(C); \
D1_PIN_PORT->BSRR = D1_BSR_MASK(C); \
D2_PIN_PORT->BSRR = D2_BSR_MASK(C); \
D3_PIN_PORT->BSRR = D3_BSR_MASK(C); \
WR_L; \
D4_PIN_PORT->BSRR = D4_BSR_MASK(C); \
D5_PIN_PORT->BSRR = D5_BSR_MASK(C); \
D6_PIN_PORT->BSRR = D6_BSR_MASK(C); \
D7_PIN_PORT->BSRR = D7_BSR_MASK(C); \
WR_STB
// 16 bit write with swapped bytes // 16 bit write with swapped bytes
#define tft_Write_16S(C) tft_Write_8(C); tft_Write_8((C)>>8) #define tft_Write_16S(C) D0_PIN_PORT->BSRR = D0_BSR_MASK(C); \
D1_PIN_PORT->BSRR = D1_BSR_MASK(C); \
D2_PIN_PORT->BSRR = D2_BSR_MASK(C); \
D3_PIN_PORT->BSRR = D3_BSR_MASK(C); \
WR_L; \
D4_PIN_PORT->BSRR = D4_BSR_MASK(C); \
D5_PIN_PORT->BSRR = D5_BSR_MASK(C); \
D6_PIN_PORT->BSRR = D6_BSR_MASK(C); \
D7_PIN_PORT->BSRR = D7_BSR_MASK(C); \
WR_STB; \
D0_PIN_PORT->BSRR = D8_BSR_MASK(C); \
D1_PIN_PORT->BSRR = D9_BSR_MASK(C); \
D2_PIN_PORT->BSRR = D10_BSR_MASK(C); \
D3_PIN_PORT->BSRR = D11_BSR_MASK(C); \
WR_L; \
D4_PIN_PORT->BSRR = D12_BSR_MASK(C); \
D5_PIN_PORT->BSRR = D13_BSR_MASK(C); \
D6_PIN_PORT->BSRR = D14_BSR_MASK(C); \
D7_PIN_PORT->BSRR = D15_BSR_MASK(C); \
WR_STB
#endif // End of parallel/Nucleo 64/144 selections #define tft_Write_32(C) tft_Write_16((uint16_t)((C)>>16)); tft_Write_16((uint16_t)(C))
// Write 32 bits to TFT #define tft_Write_32C(C,D) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(D))
#define tft_Write_32(C) tft_Write_16((C)>>16); tft_Write_16(C)
// Write two concatenated 16 bit values to TFT #define tft_Write_32D(C) tft_Write_16((uint16_t)(C)); tft_Write_16((uint16_t)(C))
#define tft_Write_32C(C,D) tft_Write_16(C); tft_Write_16(D)
// Write 16 bit value twice to TFT // Read a data bit
#define tft_Write_32D(C) tft_Write_16(C); tft_Write_16(C) #define RD_TFT_D0 ((((D0_PIN_PORT->IDR)&(D0_PIN_MASK))>> D0_PIN_BIT)<<0) // Read pin TFT_D0
#define RD_TFT_D1 ((((D1_PIN_PORT->IDR)&(D1_PIN_MASK))>> D1_PIN_BIT)<<1) // Read pin TFT_D1
#define RD_TFT_D2 ((((D2_PIN_PORT->IDR)&(D2_PIN_MASK))>> D2_PIN_BIT)<<2) // Read pin TFT_D2
#define RD_TFT_D3 ((((D3_PIN_PORT->IDR)&(D3_PIN_MASK))>> D3_PIN_BIT)<<3) // Read pin TFT_D3
#define RD_TFT_D4 ((((D4_PIN_PORT->IDR)&(D4_PIN_MASK))>> D4_PIN_BIT)<<4) // Read pin TFT_D4
#define RD_TFT_D5 ((((D5_PIN_PORT->IDR)&(D5_PIN_MASK))>> D5_PIN_BIT)<<5) // Read pin TFT_D5
#define RD_TFT_D6 ((((D6_PIN_PORT->IDR)&(D6_PIN_MASK))>> D6_PIN_BIT)<<6) // Read pin TFT_D6
#define RD_TFT_D7 ((((D7_PIN_PORT->IDR)&(D7_PIN_MASK))>> D7_PIN_BIT)<<7) // Read pin TFT_D7
#endif
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// Macros to write commands/pixel colour data to a SPI ILI9488 TFT // Macros to write commands/pixel colour data to a SPI ILI9488 TFT
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#ifndef _TFT_eSPIH_ #ifndef _TFT_eSPIH_
#define _TFT_eSPIH_ #define _TFT_eSPIH_
#define TFT_ESPI_VERSION "2.1.7" #define TFT_ESPI_VERSION "2.1.8"
/*************************************************************************************** /***************************************************************************************
** Section 1: Load required header files ** Section 1: Load required header files
......
...@@ -82,7 +82,7 @@ void setup() { ...@@ -82,7 +82,7 @@ void setup() {
// Load the font and create the Sprite for reporting the value // Load the font and create the Sprite for reporting the value
spr.loadFont(AA_FONT_LARGE); spr.loadFont(AA_FONT_LARGE);
spr_width = spr.textWidth("188"); spr_width = spr.textWidth("277");
spr.createSprite(spr_width, spr.fontHeight()); spr.createSprite(spr_width, spr.fontHeight());
uint16_t bg_color = tft.readPixel(120, 120); // Get colour from dial centre uint16_t bg_color = tft.readPixel(120, 120); // Get colour from dial centre
spr.fillSprite(bg_color); spr.fillSprite(bg_color);
...@@ -163,10 +163,6 @@ void plotNeedle(int16_t angle, uint16_t ms_delay) ...@@ -163,10 +163,6 @@ void plotNeedle(int16_t angle, uint16_t ms_delay)
{ {
static int16_t old_angle = -120; // Starts at -120 degrees static int16_t old_angle = -120; // Starts at -120 degrees
// Trig values for the rotation
int32_t sinra;
int32_t cosra;
// Bounding box parameters // Bounding box parameters
static int16_t min_x; static int16_t min_x;
static int16_t min_y; static int16_t min_y;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "TFT_eSPI", "name": "TFT_eSPI",
"version": "2.1.7", "version": "2.1.8",
"keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140", "keywords": "Arduino, tft, ePaper, display, STM32, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486, ST7789, RM68140",
"description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32", "description": "A TFT and ePaper SPI graphics library with optimisation for ESP8266, ESP32 and STM32",
"repository": "repository":
......
name=TFT_eSPI name=TFT_eSPI
version=2.1.7 version=2.1.8
author=Bodmer author=Bodmer
maintainer=Bodmer maintainer=Bodmer
sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32 sentence=TFT graphics library for Arduino processors with performance optimisation for STM32, ESP8266 and ESP32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment