![]() |
RTOS_MSPM0
1.1
ECE445M starter code
|
ST7735R LCD. More...
Files | |
| file | ST7735.h |
| 160 by 128 pixel LCD | |
| file | ST7735_SDC.h |
| 160 by 128 pixel LCD with SDC | |
Macros | |
| #define | ST7735_TFTWIDTH 128 |
| 128 pixels wide | |
| #define | ST7735_TFTHEIGHT 160 |
| 160 pixels tall | |
| #define | ST7735_BLACK 0x0000 |
| The following constants are possible colors for the LCD in RGB format. | |
| #define | ST7735_BLUE 0xF800 |
| #define | ST7735_RED 0x001F |
| #define | ST7735_GREEN 0x07E0 |
| #define | ST7735_CYAN 0xFFE0 |
| #define | ST7735_MAGENTA 0xF81F |
| #define | ST7735_YELLOW 0x07FF |
| #define | ST7735_WHITE 0xFFFF |
| #define | ST7735_LIGHTGREY ST7735_Color565(228,228,228) |
| #define | ST7735_DARKGREY ST7735_Color565(32,32,32) |
| #define | ST7735_ORANGE ST7735_Color565(255,102,0) |
| #define | ST7735_PURPLE ST7735_Color565(106,13,173) |
| #define | ST7735_TFTWIDTH 128 |
| 128 pixels wide | |
| #define | ST7735_TFTHEIGHT 160 |
| 160 pixels tall | |
| #define | ST7735_BLACK 0x0000 |
| The following constants are possible colors for the LCD in RGB format. | |
| #define | ST7735_BLUE 0xF800 |
| #define | ST7735_RED 0x001F |
| #define | ST7735_GREEN 0x07E0 |
| #define | ST7735_CYAN 0xFFE0 |
| #define | ST7735_MAGENTA 0xF81F |
| #define | ST7735_YELLOW 0x07FF |
| #define | ST7735_WHITE 0xFFFF |
| #define | ST7735_LIGHTGREY ST7735_Color565(228,228,228) |
| #define | ST7735_DARKGREY ST7735_Color565(32,32,32) |
| #define | ST7735_ORANGE ST7735_Color565(255,102,0) |
| #define | ST7735_PURPLE ST7735_Color565(106,13,173) |
Enumerations | |
| enum | initRFlags { none , INITR_GREENTAB , INITR_REDTAB , INITR_BLACKTAB , none , INITR_GREENTAB , INITR_REDTAB , INITR_BLACKTAB } |
| some flags for ST7735_InitR() | |
| enum | initRFlags { none , INITR_GREENTAB , INITR_REDTAB , INITR_BLACKTAB , none , INITR_GREENTAB , INITR_REDTAB , INITR_BLACKTAB } |
| some flags for ST7735_InitR() | |
Functions | |
| void | ST7735_InitB (void) |
| Initialize ST7735B LCD. More... | |
| void | ST7735_InitR (enum initRFlags option) |
| Initialize ST7735R LCD. More... | |
| void | ST7735_DrawPixel (int16_t x, int16_t y, uint16_t color) |
| Color one pixel. More... | |
| void | ST7735_DrawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color) |
| Draw a vertical line. More... | |
| void | ST7735_DrawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color) |
| Draw a horizontal line. More... | |
| void | ST7735_FillScreen (uint16_t color) |
| Fill the screen. More... | |
| void | ST7735_FillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
| Draw a filled rectangle. More... | |
| void | ST7735_DrawSmallCircle (int16_t x, int16_t y, uint16_t color) |
| Draw a small circle. More... | |
| void | ST7735_DrawCircle (int16_t x, int16_t y, uint16_t color) |
| Draw a circle. More... | |
| uint16_t | ST7735_Color565 (uint8_t r, uint8_t g, uint8_t b) |
| RGB to color creation. More... | |
| uint16_t | ST7735_SwapColor (uint16_t x) |
| Swaps red and blue. More... | |
| void | ST7735_DrawBitmap (int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h) |
| Displays a BMP image. More... | |
| void | ST7735_DrawCharS (int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size) |
| Draw a character. More... | |
| void | ST7735_DrawChar (int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size) |
| Draw a character. More... | |
| uint32_t | ST7735_DrawString (uint16_t x, uint16_t y, char *pt, int16_t textColor) |
| Draw a string. More... | |
| void | ST7735_SetCursor (uint32_t newX, uint32_t newY) |
| Move the cursor. More... | |
| void | ST7735_OutUDec (uint32_t n) |
| Output an unsigned decimal. More... | |
| void | ST7735_OutUDec4 (uint32_t n) |
| Output a 4-digit unsigned decimal. More... | |
| void | ST7735_OutUDec5 (uint32_t n) |
| Output a 5-digit unsigned decimal. More... | |
| void | ST7735_OutUFix2_1 (uint32_t n, int16_t textColor) |
| Output a 2-digit fixed-point decimal. More... | |
| void | ST7735_OutUHex2 (uint32_t n, int16_t textColor) |
| Output a 2-digit hexadecimal number. More... | |
| void | ST7735_SetRotation (uint8_t m) |
| Change rotation. More... | |
| void | ST7735_InvertDisplay (int i) |
| invert display More... | |
| void | ST7735_Drawaxes (uint16_t axisColor, uint16_t bgColor, char *xLabel, char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color, int32_t ymax, int32_t ymin) |
| Initializes a plot. More... | |
| void | ST7735_PlotClear (int32_t ymin, int32_t ymax) |
| Clear plot. More... | |
| void | ST7735_PlotPoint (int32_t y) |
| Plot one point. More... | |
| void | ST7735_PlotPoint2 (int32_t data1, uint16_t color1) |
| Plot one point with color. More... | |
| void | ST7735PlotIncrement (void) |
| Moves the plot cursor in time. More... | |
| void | ST7735_PlotLine (int32_t y) |
| Plot one line. More... | |
| void | ST7735_PlotPoints (int32_t y1, int32_t y2) |
| Plot two points. More... | |
| void | ST7735_PlotBar (int32_t y) |
| Plot one bar. More... | |
| void | ST7735_PlotdBfs (int32_t y) |
| Plot one bar. More... | |
| void | ST7735_PlotNext (void) |
| Move x-axis parameter. More... | |
| void | ST7735_PlotNextErase (void) |
| Move X coordinate More... | |
| void | ST7735_OutChar (char ch) |
| Output a character. More... | |
| void | ST7735_OutCharTransparent (char ch) |
| Output a character transparently. More... | |
| void | ST7735_OutString (char *ptr) |
| Output a string. More... | |
| void | ST7735_OutStringTransparent (char *ptr) |
| Output a string transparently. More... | |
| void | ST7735_SetTextColor (uint16_t color) |
| sets the text color More... | |
| void | ST7735_InitPrintf (void) |
| use ST7735 LCD to output from printf More... | |
| void | ST7735_sDecOut2 (int32_t n) |
| fixed point output resolution 0.01 More... | |
| void | ST7735_uBinOut6 (uint32_t n) |
| fixed point output resolution 1/64 More... | |
| void | ST7735_XYplotInit (char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY) |
| initialize XY plot More... | |
| void | ST7735_XYplot (uint32_t num, int32_t bufX[], int32_t bufY[]) |
| XY plot. More... | |
| void | ST7735_Line (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color) |
| Draws line. More... | |
| void | ST7735_SetX (int32_t newX) |
| set X-position More... | |
| void | ST7735_Message (uint32_t d, uint32_t l, char *pt, int32_t value) |
ST7735R LCD.
ST7735R_SDC LCD.
| Pin | Connection | Description |
|---|---|---|
| 10 | +3.3 | Backlight |
| 9 | nc | SPI1 MISO (used for SDC) |
| 8 | PB9 | SPI1 SCLK clock out |
| 7 | PB8 | SPI1 PICO data out |
| 6 | PB6 | SPI1 CS0=TFT_CS |
| 5 | nc | CARD_CS (used for SDC) |
| 4 | PA13 | Data/Command(GPIO), high for data, low for command |
| 3 | PB15 | RESET, low to reset, (GPIO) |
| 2 | +3.3 | VCC |
| 1 | Gnd | ground |
| Pin | Connection |
|---|---|
| VCC | +3.3 V |
| GND | Ground |
| !SCL | SPI1 SCLK: PB9 clock |
| !SDA | SPI1 PICO: PB8 MOSI SPI data from microcontroller to TFT or SDC |
| DC | GPIO PA13 TFT data/command |
| RES | GPIO PB15 TFT reset |
| CS | SPI1 CS0: PB6 TFT_CS, active low to enable TFT |
| *CS | (NC) SDC_CS, active low to enable SDC |
| MISO | (NC) MISO SPI data from SDC to microcontroller |
| SDA | (NC) I2C data for ADXL345 accelerometer |
| SCL | (NC) I2C clock for ADXL345 accelerometer |
| SDO | (NC) I2C alternate address for ADXL345 accelerometer |
| Backlight + - Light, backlight connected to +3.3 V |
| signal | Pin | Connection |
|---|---|---|
| LED- | 16 | TFT, to ground |
| LED+ | 15 | TFT, to +3.3 V |
| SD_CS | 14 | SDC, to chip select |
| MOSI | 13 | SDC, to MOSI |
| MISO | 12 | SDC, to MISO |
| SCK | 11 | SDC, to serial clock |
| CS | 10 | TFT, to PB6 SPI1 CS0 |
| SCL | 9 | TFT, to PB9 SPI1 SCLK |
| SDA | 8 | TFT, to PB8 MOSI SPI1 PICO |
| A0 | 7 | TFT, to PA13 Data/Command, high for data, low for command |
| RESET | 6 | TFT, to PB15 reset (GPIO), low to reset |
| NC | 3,4,5 | not connected |
| VCC | 2 | to +3.3 V |
| GND | 1 | to ground |
| Pin | Connection | Description |
|---|---|---|
| 10 | +3.3 | Backlight |
| 9 | PB7 | SPI1 MISO (used for SDC) |
| 8 | PB9 | SPI1 SCLK clock out |
| 7 | PB8 | SPI1 PICO data out |
| 6 | PB6 | GPIO CS0=TFT_CS |
| 5 | PB0 | CARD_CS (used for SDC) |
| 4 | PB16 | Data/Command(GPIO), high for data, low for command |
| 3 | PB15 | RESET, low to reset, (GPIO) |
| 2 | +3.3 | VCC |
| 1 | Gnd | ground |
| signal | Pin | Connection |
|---|---|---|
| LED- | 16 | TFT, to ground |
| LED+ | 15 | TFT, to +3.3 V |
| SD_CS | 14 | SDC, to PB0 chip select |
| MOSI | 13 | SDC, to PB8 MOSI |
| MISO | 12 | SDC, to PB7 MISO |
| SCK | 11 | SDC, to PB9 serial clock |
| CS | 10 | TFT, to PB6 SPI1 CS0 |
| SCL | 9 | TFT, to PB9 SPI1 SCLK |
| SDA | 8 | TFT, to PB8 MOSI SPI1 PICO |
| A0 | 7 | TFT, to PB16 Data/Command, high for data, low for command |
| RESET | 6 | TFT, to PB15 reset (GPIO), low to reset |
| NC | 3,4,5 | not connected |
| VCC | 2 | to +3.3 V |
| GND | 1 | to ground |
| uint16_t ST7735_Color565 | ( | uint8_t | r, |
| uint8_t | g, | ||
| uint8_t | b | ||
| ) |
RGB to color creation.
Pass 8-bit (each) R,G,B and get back 16-bit packed color.
| r | red value |
| g | green value |
| b | blue value |
| void ST7735_Drawaxes | ( | uint16_t | axisColor, |
| uint16_t | bgColor, | ||
| char * | xLabel, | ||
| char * | yLabel1, | ||
| uint16_t | label1Color, | ||
| char * | yLabel2, | ||
| uint16_t | label2Color, | ||
| int32_t | ymax, | ||
| int32_t | ymin | ||
| ) |
Initializes a plot.
Set up the axes, labels, and other variables to allow data to be plotted in a chart using the functions ST7735_PlotPoint() and ST7735_PlotIncrement(). If yLabel2 is empty string, no yLabel2 is printed, and yLabel1 is centered
| axisColor | 16-bit color for axes, which can be produced by LCD_Color565() |
| bgColor | 16-bit color for plot background, which can be produced by LCD_Color565() |
| xLabel | pointer to a null terminated string for x-axis (~4 character space) |
| yLabel1 | pointer to a null terminated string for top of y-axis (~3-5 character space) |
| label1Color | 16-bit color for y-axis label1, which can be produced by LCD_Color565() |
| yLabel2 | pointer to a null terminated string for bottom of y-axis (~3 character space) |
| label2Color | 16-bit color for y-axis label2, which can be produced by LCD_Color565() |
| ymax | maximum value to be printed |
| ymin | minimum value to be printed |
| void ST7735_DrawBitmap | ( | int16_t | x, |
| int16_t | y, | ||
| const uint16_t * | image, | ||
| int16_t | w, | ||
| int16_t | h | ||
| ) |
Displays a BMP image.
Displays a 16-bit color BMP image. A bitmap file that is created by a PC image processing program has a header and may be padded with dummy columns so the data have four byte alignment. This function assumes that all of that has been stripped out, and the array image[] has one 16-bit halfword for each pixel to be displayed on the screen (encoded in reverse order, which is standard for bitmap files). An array can be created in this format from a 24-bit-per-pixel .bmp file using the associated BmpConvert16.exe converter program. (x,y) is the screen location of the lower left corner of BMP image
Requires (11 + 2*w*h) bytes of transmission (assuming image fully on screen)
| x | horizontal position of the bottom left corner of the image, columns from the left edge |
| y | vertical position of the bottom left corner of the image, rows from the top edge |
| image | pointer to a 16-bit color BMP image |
| w | number of pixels wide |
| h | number of pixels tall |
| void ST7735_DrawChar | ( | int16_t | x, |
| int16_t | y, | ||
| char | c, | ||
| int16_t | textColor, | ||
| int16_t | bgColor, | ||
| uint8_t | size | ||
| ) |
Draw a character.
Advanced character draw function. This is similar to the function from Adafruit_GFX.c but adapted for this processor. However, this function only uses one call to setAddrWindow(), which allows it to run at least twice as fast.
Requires (11 + size*size*6*8) bytes of transmission (assuming image fully on screen)
| x | horizontal position of the top left corner of the character, columns from the left edge |
| y | vertical position of the top left corner of the character, rows from the top edge |
| c | character to be printed |
| textColor | 16-bit color of the character |
| bgColor | 16-bit color of the background |
| size | number of pixels per character pixel (e.g. size==2 prints each pixel of font as 2x2 square) |
| void ST7735_DrawCharS | ( | int16_t | x, |
| int16_t | y, | ||
| char | c, | ||
| int16_t | textColor, | ||
| int16_t | bgColor, | ||
| uint8_t | size | ||
| ) |
Draw a character.
Simple character draw function. This is the same function from Adafruit_GFX.c but adapted for this processor. However, each call to ST7735_DrawPixel() calls setAddrWindow(), which needs to send many extra data and commands. If the background color is the same as the text color, no background will be printed, and text can be drawn right over existing images without covering them with a box.
Requires (11 + 2*size*size)*6*8 bytes of transmission (image fully on screen; textcolor != bgColor)
| x | horizontal position of the top left corner of the character, columns from the left edge |
| y | vertical position of the top left corner of the character, rows from the top edge |
| c | character to be printed |
| textColor | 16-bit color of the character |
| bgColor | 16-bit color of the background |
| size | number of pixels per character pixel (e.g. size==2 prints each pixel of font as 2x2 square) |
| void ST7735_DrawCircle | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | color | ||
| ) |
Draw a circle.
Draw a circle (diameter of 10 pixels) at the given coordinates with the given color.
Requires (11*10+68*2)=178 bytes of transmission (assuming image on screen)
| x | horizontal position of the top left corner of the circle, columns from the left edge |
| y | vertical position of the top left corner of the circle, rows from the top edge |
| color | 16-bit color, which can be produced by ST7735_Color565() |
| void ST7735_DrawFastHLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| uint16_t | color | ||
| ) |
Draw a horizontal line.
Draw a horizontal line at the given coordinates with the given width and color. A horizontal line is parallel to the shorter side of the rectangular display
Requires (11 + 2*w) bytes of transmission (assuming image fully on screen)
| x | horizontal position of the start of the line, columns from the left edge |
| y | vertical position of the start of the line, rows from the top edge |
| w | horizontal width of the line |
| color | 16-bit color, which can be produced by LCD_Color565() |
| void ST7735_DrawFastVLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) |
Draw a vertical line.
Draw a vertical line at the given coordinates with the given height and color.
A vertical line is parallel to the longer side of the rectangular display
Requires (11 + 2*h) bytes of transmission (assuming image fully on screen)
| x | horizontal position of the start of the line, columns from the left edge |
| y | vertical position of the start of the line, rows from the top edge |
| h | vertical height of the line |
| color | 16-bit color, which can be produced by LCD_Color565() |
| void ST7735_DrawPixel | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | color | ||
| ) |
Color one pixel.
Color the pixel at the given coordinates with the given color.
Requires 13 bytes of transmission
x must be less than 128
x 0 is on the left, 126 is near the right
y must be less than 160 y 159 is near the wires, 0 is the side opposite the wires
| x | horizontal position of the pixel, columns from the left edge |
| y | vertical position of the pixel, rows from the top edge |
| color | 16-bit color, which can be produced by LCD_Color565() |
| void ST7735_DrawSmallCircle | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | color | ||
| ) |
Draw a small circle.
Draw a small circle (diameter of 6 pixels) at the given coordinates with the given color.
Requires (11*6+24*2)=114 bytes of transmission (assuming image fully on screen)
| x | horizontal position of the top left corner of the circle, columns from the left edge |
| y | vertical position of the top left corner of the circle, rows from the top edge |
| color | 16-bit color, which can be produced by ST7735_Color565() |
| uint32_t ST7735_DrawString | ( | uint16_t | x, |
| uint16_t | y, | ||
| char * | pt, | ||
| int16_t | textColor | ||
| ) |
Draw a string.
String draw function. 16 rows (0 to 15) and 21 characters (0 to 20)
Requires (11 + size*size*6*8) bytes of transmission for each character
| x | columns from the left edge (0 to 20) |
| y | rows from the top edge (0 to 12) |
| pt | pointer to a null terminated string to be printed |
| textColor | 16-bit color of the characters |
| void ST7735_FillRect | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) |
Draw a filled rectangle.
Draw a filled rectangle at the given coordinates with the given width, height, and color.
Requires (11 + 2*w*h) bytes of transmission (assuming image fully on screen)
| x | horizontal position of the top left corner of the rectangle, columns from the left edge |
| y | vertical position of the top left corner of the rectangle, rows from the top edge |
| w | horizontal width of the rectangle |
| h | vertical height of the rectangle |
| color | 16-bit color, which can be produced by ST7735_Color565() |
| void ST7735_FillScreen | ( | uint16_t | color | ) |
Fill the screen.
Fill the screen with the given color.
Requires 40,971 bytes of transmission
| color | 16-bit color, which can be produced by ST7735_Color565() |
| void ST7735_InitB | ( | void | ) |
Initialize ST7735B LCD.
Initialize ST7735B color 128x160-pixel TFT LCD
| none |
| void ST7735_InitPrintf | ( | void | ) |
use ST7735 LCD to output from printf
Initialize the ST7735 for printf
| none |
| void ST7735_InitR | ( | enum initRFlags | option | ) |
Initialize ST7735R LCD.
Initialize ST7735R color 128x160-pixel TFT LCD
| option | one of none,INITR_GREENTAB,INITR_REDTAB,INITR_BLACKTAB |
Initialize ST7735R color 128x160-pixel TFT LCD
| option | one of none,INITR_GREENTAB,INITR_REDTAB,INITR_BLACKTAB |
| void ST7735_InvertDisplay | ( | int | i | ) |
invert display
Send the command to invert all of the colors. Requires 1 byte of transmission
| i | 0 to disable inversion; non-zero to enable inversion |
| void ST7735_Line | ( | uint16_t | x1, |
| uint16_t | y1, | ||
| uint16_t | x2, | ||
| uint16_t | y2, | ||
| uint16_t | color | ||
| ) |
Draws line.
Draws one line on the ST7735 color LCD
| x1 | horizonal position |
| x2 | horizonal position |
| y1 | vertical position |
| y2 | vertical position |
| color | 16-bit color, which can be produced by ST7735_Color565() |
| void ST7735_OutChar | ( | char | ch | ) |
Output a character.
Output one character to the LCD Position determined by ST7735_SetCursor command Color set by ST7735_SetTextColor
| ch | 8-bit ASCII character |
| void ST7735_OutCharTransparent | ( | char | ch | ) |
Output a character transparently.
Output one character to the LCD Position determined by ST7735_SetCursor command Color set by ST7735_SetTextColor, background is transparent
| ch | 8-bit ASCII character |
| void ST7735_OutString | ( | char * | ptr | ) |
Output a string.
Print a string of characters to the ST7735 LCD. Position determined by ST7735_SetCursor command Color set by ST7735_SetTextColor The string will not automatically wrap.
| ptr | pointer to NULL-terminated ASCII string |
| void ST7735_OutStringTransparent | ( | char * | ptr | ) |
Output a string transparently.
Print a string of characters to the ST7735 LCD. Position determined by ST7735_SetCursor command Color set by ST7735_SetTextColor, background is transparent The string will not automatically wrap.
| ptr | pointer to NULL-terminated ASCII string |
| void ST7735_OutUDec | ( | uint32_t | n | ) |
Output an unsigned decimal.
Output a 32-bit number in unsigned decimal format. Position determined by ST7735_SetCursor command. Color set by ST7735_SetTextColor.
| n | 32-bit number to be transferred |
| void ST7735_OutUDec4 | ( | uint32_t | n | ) |
Output a 4-digit unsigned decimal.
Output a 32-bit number in unsigned 4-digit decimal format with no space before or after. Color set by ST7735_SetTextColor. Position determined by ST7735_SetCursor command
| n | 32-bit number to be transferred |
| void ST7735_OutUDec5 | ( | uint32_t | n | ) |
Output a 5-digit unsigned decimal.
Output a 32-bit number in unsigned 5-digit decimal format with no space before or after. Color set by ST7735_SetTextColor. Position determined by ST7735_SetCursor command
| n | 32-bit number to be transferred |
| void ST7735_OutUFix2_1 | ( | uint32_t | n, |
| int16_t | textColor | ||
| ) |
Output a 2-digit fixed-point decimal.
Output a 32-bit number in unsigned 3-digit fixed point, 0.1 resolution numbers 0 to 999 printed as " 0.0" to "99.9" Position determined by ST7735_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void ST7735_OutUHex2 | ( | uint32_t | n, |
| int16_t | textColor | ||
| ) |
Output a 2-digit hexadecimal number.
Output a 32-bit number in unsigned 2-digit hexadecimal format numbers 0 to 255 printed as "00," to "FF," Position determined by ST7735_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void ST7735_PlotBar | ( | int32_t | y | ) |
Plot one bar.
Used in the voltage versus time bar plot, plot one bar at y It does output to display. The units of the data are the same as the ymax and ymin values specified in the initialization function. Call ST7735_PlotIncrement() to move time.
| y | is the y coordinate of the bar plotted |
| void ST7735_PlotClear | ( | int32_t | ymin, |
| int32_t | ymax | ||
| ) |
Clear plot.
Clear the graphics buffer, set X coordinate to 0 This routine clears the display
| ymin | minimum plot value |
| ymax | maximum plot value |
| void ST7735_PlotdBfs | ( | int32_t | y | ) |
Plot one bar.
Used in the amplitude versus frequency plot, plot one bar at y It does output to display. 0 to 0.625V scaled on a log plot from min to max. Call ST7735_PlotIncrement() to move x axis.
| y | is the y ADC value of the bar plotted |
| void ST7735_PlotLine | ( | int32_t | y | ) |
Plot one line.
Used in the voltage versus time plot, plot line to new point It does output to display
| y | value to be plotted |
| void ST7735_PlotNext | ( | void | ) |
Move x-axis parameter.
Used in all the plots to step the X coordinate one pixel. ST7735_PlotIncrement will erase the new line (clearing the display as it goes). ST7735_PlotNext does not erase the new line (plots over itself as it wraps). X steps from 0 to 127, then back to 0 again It does not output to display
| none |
| void ST7735_PlotNextErase | ( | void | ) |
Move X coordinate
Used in all the plots to step the X coordinate one pixel X steps from 0 to 127, then back to 0 again It clears the vertical space into which the next pixel will be drawn
| none |
| void ST7735_PlotPoint | ( | int32_t | y | ) |
Plot one point.
Plot a point on the chart. To plot several points in the same column, call this function repeatedly before calling ST7735PlotIncrement(). The units of the data are the same as the ymax and ymin values specified in the initialization function.
| y | value to be plotted (units not specified) |
| void ST7735_PlotPoint2 | ( | int32_t | data1, |
| uint16_t | color1 | ||
| ) |
Plot one point with color.
Plot a point on the chart. To plot several points in the same column, call this function repeatedly before calling ST7735_PlotIncrement(). The units of the data are the same as the ymax and ymin values specified in the initialization function.
| data1 | value to be plotted (units not specified) |
| color1 | 16-bit color for the point, which can be produced by ST7735_Color565() |
| void ST7735_PlotPoints | ( | int32_t | y1, |
| int32_t | y2 | ||
| ) |
Plot two points.
Used in the voltage versus time plot, plot two points at y1, y2 It does output to display. The units of the data are the same as the ymax and ymin values specified in the initialization function. Call ST7735_PlotIncrement() to move time.
| y1 | is the y coordinate of the first point plotted |
| y2 | is the y coordinate of the second point plotted |
| void ST7735_sDecOut2 | ( | int32_t | n | ) |
fixed point output resolution 0.01
Outputs signed fixed point number to LCD. The format signed 32-bit with resolution 0.01. The range -99.99 to +99.99
| Parameter | LCD display | |
|---|---|---|
| 12345 | " **.**" | |
| 2345 | " 23.45" | |
| -8100 | "-81.00" | |
| -102 | " -1.02" | |
| 31 | " 0.31" | |
| -12345 | "-**.**" |
| n | signed 32-bit integer part of fixed-point number |
| void ST7735_SetCursor | ( | uint32_t | newX, |
| uint32_t | newY | ||
| ) |
Move the cursor.
Move the cursor to the desired X- and Y-position. The next character of the next unsigned decimal will be printed here. X=0 is the leftmost column. Y=0 is the top row. The cursor is used by the "Out" functions, but not the "Draw" functions
| newX | new X-position of the cursor (0<=newX<=20) |
| newY | new Y-position of the cursor (0<=newY<=15) |
| void ST7735_SetRotation | ( | uint8_t | m | ) |
Change rotation.
Change the image rotation. Requires 2 bytes of transmission
| m | new rotation value (0 to 3) |
| void ST7735_SetTextColor | ( | uint16_t | color | ) |
sets the text color
Sets the color in which the characters will be printed Background color is fixed at black
| color | 16-bit packed color |
| void ST7735_SetX | ( | int32_t | newX | ) |
set X-position
Used in all the plots to change the X coordinate to new location X exists in the range from 0 to 127, Input values less than 0 get changed to 0, Input values greater than 127 get changed to 127 It does not output to display
| newX | is the new value that the global X will be |
| uint16_t ST7735_SwapColor | ( | uint16_t | x | ) |
Swaps red and blue.
Swaps the red and blue values of the given 16-bit packed color; green is unchanged.
| x | 16-bit color in format B, G, R |
| void ST7735_uBinOut6 | ( | uint32_t | n | ) |
fixed point output resolution 1/64
unsigned 32-bit binary fixed-point with a resolution of 1/64. The full-scale range is from 0 to 999.99. If the integer part is larger than 63999, it signifies an error. The ST7735_uBinOut6 function takes an unsigned 32-bit integer part of the binary fixed-point number and outputs the fixed-point value on the LCD
| Parameter | LCD display |
|---|---|
| 0 | " 0.00" |
| 1 | " 0.01" |
| 16 | " 0.25" |
| 25 | " 0.39" |
| 125 | " 1.95" |
| 128 | " 2.00" |
| 1250 | " 19.53" |
| 7500 | "117.19" |
| 63999 | "999.99" |
| 64000 | "***.**" |
| n | unsigned 32-bit integer part of binary fixed-point number |
| void ST7735_XYplot | ( | uint32_t | num, |
| int32_t | bufX[], | ||
| int32_t | bufY[] | ||
| ) |
XY plot.
Plot an array of (x,y) data, neglect any points outside the minX maxY minY maxY bounds
| num | number of data points in the two arrays |
| bufX | array of 32-bit fixed-point data, resolution= 0.001 |
| bufY | array of 32-bit fixed-point data, resolution= 0.001 |
| void ST7735_XYplotInit | ( | char * | title, |
| int32_t | minX, | ||
| int32_t | maxX, | ||
| int32_t | minY, | ||
| int32_t | maxY | ||
| ) |
initialize XY plot
Specify the X and Y axes for an x-y scatter plot Draw the title and clear the plot area
| title | ASCII string to label the plot, null-termination |
| minX | smallest X data value allowed, resolution= 0.001 |
| maxX | largest X data value allowed, resolution= 0.001 |
| minY | smallest Y data value allowed, resolution= 0.001 |
| maxY | largest Y data value allowed, resolution= 0.001 |
| void ST7735PlotIncrement | ( | void | ) |
Moves the plot cursor in time.
Increment the plot between subsequent calls to ST7735_PlotPoint(). Automatically wrap and clear the column to be printed to. ST7735_PlotIncrement will erase the new line (clearing the display as it goes). ST7735_PlotNext does not erase the new line (plots over itself as it wraps).
| none |