MSPM0_ValvanoWare  1.0
ECE445L starter code
ST7735_SDC.h
Go to the documentation of this file.
1 
107 #ifndef _ST7735H_SDC_
108 #define _ST7735H_SDC_
109 #include <stdint.h>
114  none,
115  INITR_GREENTAB,
116  INITR_REDTAB, // Adafruit
117  INITR_BLACKTAB // Hiletgo
118 };
119 
123 #define ST7735_TFTWIDTH 128
127 #define ST7735_TFTHEIGHT 160
128 
132  #define ST7735_COLOR565(r, g, b) ((uint16_t)((b << 8) | (g << 3) | (r >> 3)))
136 #define ST7735_BLACK (uint16_t)0x0000
137 #define ST7735_BLUE (uint16_t)0xF800
138 #define ST7735_RED (uint16_t)0x001F
139 #define ST7735_GREEN (uint16_t)0x07E0
140 #define ST7735_CYAN (uint16_t)0xFFE0
141 #define ST7735_MAGENTA (uint16_t)0xF81F
142 #define ST7735_YELLOW (uint16_t)0x07FF
143 #define ST7735_WHITE (uint16_t)0xFFFF
144 #define ST7735_LIGHTGREY ST7735_COLOR565(228,228,228)
145 #define ST7735_GREY ST7735_COLOR565(128,128,128)
146 #define ST7735_DARKGREY ST7735_COLOR565(32,32,32)
147 #define ST7735_ORANGE ST7735_COLOR565(255,102,0)
148 #define ST7735_PURPLE ST7735_COLOR565(106,13,173)
149 
157 void ST7735_InitB(void);
158 
159 
160 
170 void ST7735_InitR(enum initRFlags option);
171 
172 
173 
187 void ST7735_DrawPixel(int16_t x, int16_t y, uint16_t color);
188 
189 
201 void ST7735_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
202 
203 
204 
216 void ST7735_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
217 
218 
226 void ST7735_FillScreen(uint16_t color);
227 
228 
229 
241 void ST7735_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
242 
243 
253 void ST7735_DrawSmallCircle(int16_t x, int16_t y, uint16_t color);
254 
255 
265 void ST7735_DrawCircle(int16_t x, int16_t y, uint16_t color);
266 
275 uint16_t ST7735_Color565(uint8_t r, uint8_t g, uint8_t b);
276 
284 uint16_t ST7735_SwapColor(uint16_t x) ;
285 
286 
308 void ST7735_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h);
309 
327 void ST7735_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
328 
329 
345  void ST7735_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
346 
347 
360 uint32_t ST7735_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor);;
361 
362 
373 void ST7735_SetCursor(uint32_t newX, uint32_t newY);
374 
384 void ST7735_OutUDec(uint32_t n);
385 
386 
398 void ST7735_OutSDec2(int32_t n, uint32_t l);
399 
410 void ST7735_OutUDec4(uint32_t n);
411 
422 void ST7735_OutUDec5(uint32_t n);
423 
434 void ST7735_OutUFix2_1(uint32_t n, int16_t textColor);
435 
446 void ST7735_OutUHex2(uint32_t n, int16_t textColor);
447 
455 void ST7735_SetRotation(uint8_t m) ;
456 
457 
458 
466 void ST7735_InvertDisplay(int i) ;
467 
468 
469 
494 void ST7735_Drawaxes(uint16_t axisColor, uint16_t bgColor, char *xLabel,
495  char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color,
496  int32_t ymax, int32_t ymin);
497 
506 void ST7735_PlotClear(int32_t ymin, int32_t ymax);
507 
508 
520 void ST7735_PlotPoint(int32_t y);
521 
522 
535 void ST7735_PlotPoint2(int32_t data1, uint16_t color1);
536 
537 
549 void ST7735PlotIncrement(void);
550 
551 
560 void ST7735_PlotLine(int32_t y);
561 
562 
574 void ST7735_PlotPoints(int32_t y1,int32_t y2);
575 
576 
587 void ST7735_PlotBar(int32_t y);
588 
589 
599 void ST7735_PlotdBfs(int32_t y);
600 
611 void ST7735_PlotNext(void);
612 
621 void ST7735_PlotNextErase(void);
622 
623 // Used in all the plots to write buffer to LCD
624 // Example 1 Voltage versus time
625 // ST7735_PlotClear(0,4095); // range from 0 to 4095
626 // ST7735_PlotPoint(data); ST7735_PlotNext(); // called 128 times
627 
628 // Example 2a Voltage versus time (N data points/pixel, time scale)
629 // ST7735_PlotClear(0,4095); // range from 0 to 4095
630 // { for(j=0;j<N;j++){
631 // ST7735_PlotPoint(data[i++]); // called N times
632 // }
633 // ST7735_PlotNext();
634 // } // called 128 times
635 
636 // Example 2b Voltage versus time (N data points/pixel, time scale)
637 // ST7735_PlotClear(0,4095); // range from 0 to 4095
638 // { for(j=0;j<N;j++){
639 // ST7735_PlotLine(data[i++]); // called N times
640 // }
641 // ST7735_PlotNext();
642 // } // called 128 times
643 
644 // Example 3 Voltage versus frequency (512 points)
645 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
646 // ST7735_PlotClear(0,1023); // clip large magnitudes
647 // {
648 // ST7735_PlotBar(mag[i++]); // called 4 times
649 // ST7735_PlotBar(mag[i++]);
650 // ST7735_PlotBar(mag[i++]);
651 // ST7735_PlotBar(mag[i++]);
652 // ST7735_PlotNext();
653 // } // called 128 times
654 
655 // Example 4 Voltage versus frequency (512 points), dB scale
656 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
657 // ST7735_PlotClear(0,511); // parameters ignored
658 // {
659 // ST7735_PlotdBfs(mag[i++]); // called 4 times
660 // ST7735_PlotdBfs(mag[i++]);
661 // ST7735_PlotdBfs(mag[i++]);
662 // ST7735_PlotdBfs(mag[i++]);
663 // ST7735_PlotNext();
664 // } // called 128 times
665 
666 
675 void ST7735_OutChar(char ch);
676 
677 
687 void ST7735_OutString(char *ptr);
688 
689 
697 void ST7735_SetTextColor(uint16_t color);
698 
705 void ST7735_InitPrintf(void);
706 
707 
727 void ST7735_sDecOut2(int32_t n);
728 
729 
730 
756 void ST7735_uBinOut6(uint32_t n);
757 
770 void ST7735_XYplotInit(char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY);
771 
781 void ST7735_XYplot(uint32_t num, int32_t bufX[], int32_t bufY[]);
782 
798 void ST7735_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
799  uint16_t color);
800 
811 void ST7735_SetX(int32_t newX);
812 
827 void ST7735_DrawLine(int32_t x1, int32_t y1,
828  int32_t x2, int32_t y2, uint32_t color);
829 
830 
831 #endif
void ST7735_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line.
void ST7735_OutUDec(uint32_t n)
Output an unsigned decimal.
void ST7735_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
Draw a character.
void ST7735_DrawLine(int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color)
draw line
void ST7735_PlotdBfs(int32_t y)
Plot one bar.
void ST7735_PlotPoint2(int32_t data1, uint16_t color1)
Plot one point with color.
void ST7735_OutSDec2(int32_t n, uint32_t l)
Output a signed decimal.
void ST7735_PlotPoint(int32_t y)
Plot one point.
void ST7735_InitR(enum initRFlags option)
Initialize ST7735R LCD.
void ST7735_InvertDisplay(int i)
invert display
uint16_t ST7735_Color565(uint8_t r, uint8_t g, uint8_t b)
RGB to color creation.
void ST7735_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line.
void ST7735_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Draws line.
void ST7735_FillScreen(uint16_t color)
Fill the screen.
void ST7735_PlotLine(int32_t y)
Plot one line.
void ST7735_PlotNextErase(void)
Move X coordinate
void ST7735_OutChar(char ch)
Output a character.
void ST7735_uBinOut6(uint32_t n)
fixed point output resolution 1/64
void ST7735_OutUHex2(uint32_t n, int16_t textColor)
Output a 2-digit hexadecimal number.
void ST7735_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
Draw a character.
void ST7735_OutString(char *ptr)
Output a string.
void ST7735_SetCursor(uint32_t newX, uint32_t newY)
Move the cursor.
void ST7735_SetTextColor(uint16_t color)
sets the text color
uint32_t ST7735_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor)
Draw a string.
void ST7735PlotIncrement(void)
Moves the plot cursor in time.
initRFlags
some flags for ST7735_InitR()
Definition: ST7735.h:209
void ST7735_DrawSmallCircle(int16_t x, int16_t y, uint16_t color)
Draw a small circle.
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.
void ST7735_DrawPixel(int16_t x, int16_t y, uint16_t color)
Color one pixel.
void ST7735_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h)
Displays a BMP image.
void ST7735_XYplotInit(char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY)
initialize XY plot
void ST7735_InitPrintf(void)
Use ST7735 LCD to output from printf.
void ST7735_SetRotation(uint8_t m)
Change rotation.
void ST7735_OutUFix2_1(uint32_t n, int16_t textColor)
Output a 2-digit fixed-point decimal.
void ST7735_sDecOut2(int32_t n)
fixed point output resolution 0.01
uint16_t ST7735_SwapColor(uint16_t x)
Swaps red and blue.
void ST7735_SetX(int32_t newX)
set X-position
void ST7735_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle.
void ST7735_PlotBar(int32_t y)
Plot one bar.
void ST7735_DrawCircle(int16_t x, int16_t y, uint16_t color)
Draw a circle.
void ST7735_OutUDec4(uint32_t n)
Output a 4-digit unsigned decimal.
void ST7735_InitB(void)
Initialize ST7735B LCD.
void ST7735_OutUDec5(uint32_t n)
Output a 5-digit unsigned decimal.
void ST7735_PlotPoints(int32_t y1, int32_t y2)
Plot two points.
void ST7735_PlotNext(void)
Move x-axis parameter.
void ST7735_XYplot(uint32_t num, int32_t bufX[], int32_t bufY[])
XY plot.
void ST7735_PlotClear(int32_t ymin, int32_t ymax)
Clear plot.