Sensorian  1.0
C API Reference Guide Library
TFT.h File Reference

TFT library header. More...

#include "bcm2835.h"

Go to the source code of this file.

Data Structures

struct  _Image
 Image type. Contains image array with height and width dimensions. More...
 

Macros

#define NOP   0x00
 
#define SWRESET   0x01
 
#define RDDID   0x04
 
#define RDDST   0x09
 
#define RDDPM   0x0A
 
#define RDDMADCTL   0x0B
 
#define RDDCOLMOD   0x0C
 
#define RDDIM   0x0D
 
#define RDDSM   0x0E
 
#define RDDSDR   0x0F
 
#define SLEEP_IN   0x10
 
#define SLEEP_OUT   0x11
 
#define PTLON   0x12
 
#define NORON   0x13
 
#define INVOFF   0x20
 
#define INVON   0x21
 
#define GAMSET   0x26
 
#define DISPOFF   0x28
 
#define DISPON   0x29
 
#define CASET   0x2A
 
#define RASET   0x2B
 
#define RAMWR   0x2C
 
#define RGBSET   0x2D
 
#define RAMRD   0x2E
 
#define PTLAR   0x30
 
#define SCRLAR   0x33
 
#define TEOFF   0x34
 
#define TEON   0x35
 
#define MADCTL   0x36
 
#define VSCSAD   0x37
 
#define IDLE_MODE_OFF   0x38
 
#define IDLE_MODE_ON   0x39
 
#define COLMOD   0x3A
 
#define RDID1   0xDA
 
#define RDID2   0xDB
 
#define RDID3   0xDC
 
#define FRMCTR1   0xB1
 
#define FRMCTR2   0xB2
 
#define FRMCTR3   0xB3
 
#define INVCTR   0xB4
 
#define DISSET5   0xB6
 
#define PWCTR1   0xC0
 
#define PWCTR2   0xC1
 
#define PWCTR3   0xC2
 
#define PWCTR4   0xC3
 
#define PWCTR5   0xC4
 
#define VMCTR1   0xC5
 
#define VMOFCTR   0xC7
 
#define WRID2   0xD1
 
#define WRID3   0xD2
 
#define NVFCTR1   0xD9
 
#define NVFCTR2   0xDE
 
#define NVFCTR3   0xDF
 
#define GMCTRP1   0xE0
 
#define GMCTRN1   0xE1
 
#define GCV   0xFC
 
#define DUMMY   0xff
 
#define MADCTL_MY   0x80
 
#define MADCTL_MX   0x40
 
#define MADCTL_MV   0x20
 
#define MADCTL_ML   0x10
 
#define MADCTL_MH   0x04
 
#define MADCTL_M1   0x00
 
#define MADCTL_M2   0b10000000
 
#define MADCTL_M3   0b01000000
 
#define MADCTL_M4   0b11000000
 
#define MADCTL_M5   0b00100000
 
#define MADCTL_M6   0b10100000
 
#define MADCTL_M7   0b01100000
 
#define MADCTL_M8   0b11100000
 
#define MADCTL_RGB   0x00
 
#define MADCTL_BGR   0x08
 
#define WIDTH   0x7F /** Display width 127 pixel. */
 
#define HEIGHT   0x9F /** Display height 159 pixel. */
 
#define RED   0xf800 /** Red color. */
 
#define GREEN   0x07e0 /** Green color. */
 
#define BLUE   0x001f /** Blue color. */
 
#define WHITE   0xffff /** White color. */
 
#define BLACK   0x0000 /** Black color. */
 
#define YELLOW   0xFFE0 /** Yellow color. */
 
#define GRAY0   0xEF7D /** Gray color. */
 
#define GRAY1   0x8410 /** Gray color. */
 
#define GRAY2   0x4208 /** Gray color. */
 
#define BLACK   0x0000 /** Black color. */
 
#define MAROON   0x8000 /** Maroon color. */
 
#define OLIVE   0x8400 /** Olive color. */
 
#define NAVY   0x0010 /** Navy color. */
 
#define PURPLE   0x8010 /** Purple color. */
 
#define CS_OUTPUT()   bcm2835_gpio_fsel(RPI_V2_GPIO_P1_24,BCM2835_GPIO_FSEL_OUTP);
 
#define CS_LOW()   bcm2835_gpio_write(RPI_V2_GPIO_P1_24, LOW);
 
#define CS_HIGH()   bcm2835_gpio_write(RPI_V2_GPIO_P1_24, HIGH);
 
#define DC_OUTPUT()   bcm2835_gpio_fsel(RPI_V2_GPIO_P1_22,BCM2835_GPIO_FSEL_OUTP);
 
#define DC_LOW()   bcm2835_gpio_write(RPI_V2_GPIO_P1_22, LOW);
 
#define DC_HIGH()   bcm2835_gpio_write(RPI_V2_GPIO_P1_22, HIGH);
 
#define RST_OUTPUT()   bcm2835_gpio_fsel(RPI_V2_GPIO_P1_16,BCM2835_GPIO_FSEL_OUTP);
 
#define RST_LOW()   bcm2835_gpio_write(RPI_V2_GPIO_P1_16, LOW);
 
#define RST_HIGH()   bcm2835_gpio_write(RPI_V2_GPIO_P1_16, HIGH);
 

Typedefs

typedef struct _Image Image_t
 Image type. Contains image array with height and width dimensions. More...
 

Enumerations

enum  orientation_t {
  PORTRAIT =0, PORTRAIT_REF =2, PORTRAIT_INV_REF =3, PORTRAIT_INV =5,
  LANDSCAPE =6, LANDSCAPE_INV =4, LANDSCAPE_REF =1, LANDSCAPE_INV_REF =7,
  PORTRAIT =0, PORTRAIT_REF =2, PORTRAIT_INV_REF =3, PORTRAIT_INV =5,
  LANDSCAPE =6, LANDSCAPE_INV =4, LANDSCAPE_REF =1, LANDSCAPE_INV_REF =7,
  PORTRAIT =0, PORTRAIT_REF =2, PORTRAIT_INV_REF =3, PORTRAIT_INV =5,
  LANDSCAPE =6, LANDSCAPE_INV =4, LANDSCAPE_REF =1, LANDSCAPE_INV_REF =7,
  PORTRAIT =0, PORTRAIT_REF =2, PORTRAIT_INV_REF =3, PORTRAIT_INV =5,
  LANDSCAPE =6, LANDSCAPE_INV =4, LANDSCAPE_REF =1, LANDSCAPE_INV_REF =7
}
 Orientation type. Specific orientation modes of the device. More...
 

Functions

void TFT_Initialize (void)
 This function intializes the display controller and prepares it for any subsequent operations. More...
 
void TFT_WriteCommand (unsigned char command)
 This function writes a command byte to the display controller. More...
 
void TFT_WriteData (unsigned char datab)
 This function is used to write data to the TFT controller. More...
 
void TFT_WriteDataWord (int wdata)
 This function writes a 16 bit word on the display controller registers. More...
 
void TFT_RamAdress (void)
 
void TFT_SetPixel (unsigned char x_start, unsigned char y_start, unsigned int color)
 This functions sets a specific pixel on the TFT display. More...
 
void TFT_Sleep (void)
 Puts the display in a low power mode. More...
 
void TFT_WakeUp (void)
 Wakes the display from sleep mode. More...
 
void TFT_TurnOffDisplay (void)
 Blanks out the display. More...
 
void TFT_TurnOnDisplay (void)
 This function turns on the display from idle mode. More...
 
void TFT_SetOrientation (orientation_t mode)
 Sets the display text orientation. Mirrored modes are also supported on top of portrait and landscape modes. More...
 
void TFT_InvertDisplay (void)
 Enables color inversion on the display. More...
 
void TFT_InvertDisplayOff (void)
 Disables color inversion on the display. More...
 
void TFT_Background (int color)
 This function paints the display background a specific color. More...
 
void TFT_ShowPic (unsigned int picture[], unsigned char width, unsigned char height, unsigned int x, unsigned int y)
 This function paints an image with a specific heigh and width on the display at a specific coordinate. More...
 
void TFT_DisplayImage (Image_t *image, unsigned char x, unsigned char y)
 This function displays an image of type Image_t on screen. More...
 
unsigned int TFT_Color565 (unsigned char r, unsigned char g, unsigned char b)
 Pass 8-bit (each) R,G,B, get back 16-bit packed color. More...
 
void TFT_ASCII (char x, char y, int color, int background, char letter, char size)
 Plot an ASCII char on the display. A specific font is used. More...
 
void TFT_PrintString (char x, char y, int color, int background, char *message, char size)
 Orint a colored string at coordinates x,y with a specific font size. More...
 
void TFT_PrintInteger (char x, char y, int color, int background, int integer, char size)
 Prints an integer at coordinates x,y with a specific color on a specific background. The integer font size is deterined bu var size. More...
 

Detailed Description

TFT library header.

Author
D.Qendri
Date
30 May 2015

Definition in file TFT.h.

Macro Definition Documentation

#define BLACK   0x0000 /** Black color. */

Definition at line 120 of file TFT.h.

#define BLACK   0x0000 /** Black color. */

Definition at line 120 of file TFT.h.

#define BLUE   0x001f /** Blue color. */
Examples:
CapacitiveTouch.c.

Definition at line 113 of file TFT.h.

#define CASET   0x2A

Definition at line 42 of file TFT.h.

#define COLMOD   0x3A

Definition at line 55 of file TFT.h.

#define CS_HIGH ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_24, HIGH);

Definition at line 129 of file TFT.h.

#define CS_LOW ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_24, LOW);

Definition at line 128 of file TFT.h.

#define CS_OUTPUT ( )    bcm2835_gpio_fsel(RPI_V2_GPIO_P1_24,BCM2835_GPIO_FSEL_OUTP);

Definition at line 127 of file TFT.h.

#define DC_HIGH ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_22, HIGH);

Definition at line 133 of file TFT.h.

#define DC_LOW ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_22, LOW);

Definition at line 132 of file TFT.h.

#define DC_OUTPUT ( )    bcm2835_gpio_fsel(RPI_V2_GPIO_P1_22,BCM2835_GPIO_FSEL_OUTP);

Definition at line 131 of file TFT.h.

#define DISPOFF   0x28

Definition at line 40 of file TFT.h.

#define DISPON   0x29

Definition at line 41 of file TFT.h.

#define DISSET5   0xB6

Definition at line 64 of file TFT.h.

#define DUMMY   0xff

Definition at line 81 of file TFT.h.

#define FRMCTR1   0xB1

Definition at line 60 of file TFT.h.

#define FRMCTR2   0xB2

Definition at line 61 of file TFT.h.

#define FRMCTR3   0xB3

Definition at line 62 of file TFT.h.

#define GAMSET   0x26

Definition at line 39 of file TFT.h.

#define GCV   0xFC

Definition at line 79 of file TFT.h.

#define GMCTRN1   0xE1

Definition at line 78 of file TFT.h.

#define GMCTRP1   0xE0

Definition at line 77 of file TFT.h.

#define GRAY0   0xEF7D /** Gray color. */

Definition at line 117 of file TFT.h.

#define GRAY1   0x8410 /** Gray color. */

Definition at line 118 of file TFT.h.

#define GRAY2   0x4208 /** Gray color. */

Definition at line 119 of file TFT.h.

#define GREEN   0x07e0 /** Green color. */
Examples:
CapacitiveTouch.c.

Definition at line 112 of file TFT.h.

#define HEIGHT   0x9F /** Display height 159 pixel. */

Definition at line 108 of file TFT.h.

#define IDLE_MODE_OFF   0x38

Definition at line 53 of file TFT.h.

#define IDLE_MODE_ON   0x39

Definition at line 54 of file TFT.h.

#define INVCTR   0xB4

Definition at line 63 of file TFT.h.

#define INVOFF   0x20

Definition at line 37 of file TFT.h.

#define INVON   0x21

Definition at line 38 of file TFT.h.

#define MADCTL   0x36

Definition at line 51 of file TFT.h.

#define MADCTL_BGR   0x08

Definition at line 104 of file TFT.h.

#define MADCTL_M1   0x00

Definition at line 94 of file TFT.h.

#define MADCTL_M2   0b10000000

Definition at line 95 of file TFT.h.

#define MADCTL_M3   0b01000000

Definition at line 96 of file TFT.h.

#define MADCTL_M4   0b11000000

Definition at line 97 of file TFT.h.

#define MADCTL_M5   0b00100000

Definition at line 98 of file TFT.h.

#define MADCTL_M6   0b10100000

Definition at line 99 of file TFT.h.

#define MADCTL_M7   0b01100000

Definition at line 100 of file TFT.h.

#define MADCTL_M8   0b11100000

Definition at line 101 of file TFT.h.

#define MADCTL_MH   0x04

Definition at line 89 of file TFT.h.

#define MADCTL_ML   0x10

Definition at line 88 of file TFT.h.

#define MADCTL_MV   0x20

Definition at line 87 of file TFT.h.

#define MADCTL_MX   0x40

Definition at line 86 of file TFT.h.

#define MADCTL_MY   0x80

Definition at line 85 of file TFT.h.

#define MADCTL_RGB   0x00

Definition at line 103 of file TFT.h.

#define MAROON   0x8000 /** Maroon color. */

Definition at line 121 of file TFT.h.

#define NAVY   0x0010 /** Navy color. */

Definition at line 123 of file TFT.h.

#define NOP   0x00

Definition at line 23 of file TFT.h.

#define NORON   0x13

Definition at line 36 of file TFT.h.

#define NVFCTR1   0xD9

Definition at line 74 of file TFT.h.

#define NVFCTR2   0xDE

Definition at line 75 of file TFT.h.

#define NVFCTR3   0xDF

Definition at line 76 of file TFT.h.

#define OLIVE   0x8400 /** Olive color. */

Definition at line 122 of file TFT.h.

#define PTLAR   0x30

Definition at line 47 of file TFT.h.

#define PTLON   0x12

Definition at line 35 of file TFT.h.

#define PURPLE   0x8010 /** Purple color. */

Definition at line 124 of file TFT.h.

#define PWCTR1   0xC0

Definition at line 65 of file TFT.h.

#define PWCTR2   0xC1

Definition at line 66 of file TFT.h.

#define PWCTR3   0xC2

Definition at line 67 of file TFT.h.

#define PWCTR4   0xC3

Definition at line 68 of file TFT.h.

#define PWCTR5   0xC4

Definition at line 69 of file TFT.h.

#define RAMRD   0x2E

Definition at line 46 of file TFT.h.

#define RAMWR   0x2C

Definition at line 44 of file TFT.h.

#define RASET   0x2B

Definition at line 43 of file TFT.h.

#define RDDCOLMOD   0x0C

Definition at line 29 of file TFT.h.

#define RDDID   0x04

Definition at line 25 of file TFT.h.

#define RDDIM   0x0D

Definition at line 30 of file TFT.h.

#define RDDMADCTL   0x0B

Definition at line 28 of file TFT.h.

#define RDDPM   0x0A

Definition at line 27 of file TFT.h.

#define RDDSDR   0x0F

Definition at line 32 of file TFT.h.

#define RDDSM   0x0E

Definition at line 31 of file TFT.h.

#define RDDST   0x09

Definition at line 26 of file TFT.h.

#define RDID1   0xDA

Definition at line 56 of file TFT.h.

#define RDID2   0xDB

Definition at line 57 of file TFT.h.

#define RDID3   0xDC

Definition at line 58 of file TFT.h.

#define RED   0xf800 /** Red color. */
Examples:
CapacitiveTouch.c.

Definition at line 111 of file TFT.h.

#define RGBSET   0x2D

Definition at line 45 of file TFT.h.

#define RST_HIGH ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_16, HIGH);

Definition at line 137 of file TFT.h.

#define RST_LOW ( )    bcm2835_gpio_write(RPI_V2_GPIO_P1_16, LOW);

Definition at line 136 of file TFT.h.

#define RST_OUTPUT ( )    bcm2835_gpio_fsel(RPI_V2_GPIO_P1_16,BCM2835_GPIO_FSEL_OUTP);

Definition at line 135 of file TFT.h.

#define SCRLAR   0x33

Definition at line 48 of file TFT.h.

#define SLEEP_IN   0x10

Definition at line 33 of file TFT.h.

#define SLEEP_OUT   0x11

Definition at line 34 of file TFT.h.

#define SWRESET   0x01

Definition at line 24 of file TFT.h.

#define TEOFF   0x34

Definition at line 49 of file TFT.h.

#define TEON   0x35

Definition at line 50 of file TFT.h.

#define VMCTR1   0xC5

Definition at line 70 of file TFT.h.

#define VMOFCTR   0xC7

Definition at line 71 of file TFT.h.

#define VSCSAD   0x37

Definition at line 52 of file TFT.h.

#define WHITE   0xffff /** White color. */
Examples:
CapacitiveTouch.c.

Definition at line 114 of file TFT.h.

#define WIDTH   0x7F /** Display width 127 pixel. */

Definition at line 107 of file TFT.h.

#define WRID2   0xD1

Definition at line 72 of file TFT.h.

#define WRID3   0xD2

Definition at line 73 of file TFT.h.

#define YELLOW   0xFFE0 /** Yellow color. */

Definition at line 116 of file TFT.h.

Typedef Documentation

typedef struct _Image Image_t

Image type. Contains image array with height and width dimensions.

Enumeration Type Documentation

Orientation type. Specific orientation modes of the device.

Enumerator
PORTRAIT 

Portrait mode

PORTRAIT_REF 

Portrait mode reflected

PORTRAIT_INV_REF 

Portarit mode inverted and reflected

PORTRAIT_INV 

Portarit inverted

LANDSCAPE 

Landscape mode

LANDSCAPE_INV 

Landscape mode inverted

LANDSCAPE_REF 

Landscape mode reflected

LANDSCAPE_INV_REF 
PORTRAIT 

Portrait mode

PORTRAIT_REF 

Portrait mode reflected

PORTRAIT_INV_REF 

Portarit mode inverted and reflected

PORTRAIT_INV 

Portarit inverted

LANDSCAPE 

Landscape mode

LANDSCAPE_INV 

Landscape mode inverted

LANDSCAPE_REF 

Landscape mode reflected

LANDSCAPE_INV_REF 
PORTRAIT 

Portrait mode

PORTRAIT_REF 

Portrait mode reflected

PORTRAIT_INV_REF 

Portarit mode inverted and reflected

PORTRAIT_INV 

Portarit inverted

LANDSCAPE 

Landscape mode

LANDSCAPE_INV 

Landscape mode inverted

LANDSCAPE_REF 

Landscape mode reflected

LANDSCAPE_INV_REF 
PORTRAIT 

Portrait mode

PORTRAIT_REF 

Portrait mode reflected

PORTRAIT_INV_REF 

Portarit mode inverted and reflected

PORTRAIT_INV 

Portarit inverted

LANDSCAPE 

Landscape mode

LANDSCAPE_INV 

Landscape mode inverted

LANDSCAPE_REF 

Landscape mode reflected

LANDSCAPE_INV_REF 

Definition at line 143 of file TFT.h.