RTOS_MSPM0  1.1
ECE445M 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 
129 
133 #define ST7735_BLACK 0x0000
134 #define ST7735_BLUE 0xF800
135 #define ST7735_RED 0x001F
136 #define ST7735_GREEN 0x07E0
137 #define ST7735_CYAN 0xFFE0
138 #define ST7735_MAGENTA 0xF81F
139 #define ST7735_YELLOW 0x07FF
140 #define ST7735_WHITE 0xFFFF
141 #define ST7735_LIGHTGREY ST7735_Color565(228,228,228)
142 #define ST7735_DARKGREY ST7735_Color565(32,32,32)
143 #define ST7735_ORANGE ST7735_Color565(255,102,0)
144 #define ST7735_PURPLE ST7735_Color565(106,13,173)
145 
153 void ST7735_InitB(void);
154 
155 
156 
166 void ST7735_InitR(enum initRFlags option);
167 
168 
169 
183 void ST7735_DrawPixel(int16_t x, int16_t y, uint16_t color);
184 
185 
197 void ST7735_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
198 
199 
200 
212 void ST7735_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
213 
214 
222 void ST7735_FillScreen(uint16_t color);
223 
224 
225 
237 void ST7735_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
238 
239 
249 void ST7735_DrawSmallCircle(int16_t x, int16_t y, uint16_t color);
250 
251 
261 void ST7735_DrawCircle(int16_t x, int16_t y, uint16_t color);
262 
271 uint16_t ST7735_Color565(uint8_t r, uint8_t g, uint8_t b);
272 
280 uint16_t ST7735_SwapColor(uint16_t x) ;
281 
282 
304 void ST7735_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h);
305 
323 void ST7735_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
324 
325 
341  void ST7735_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
342 
343 
356 uint32_t ST7735_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor);;
357 
358 
369 void ST7735_SetCursor(uint32_t newX, uint32_t newY);
370 
380 void ST7735_OutUDec(uint32_t n);
381 
382 
393 void ST7735_OutUDec4(uint32_t n);
394 
405 void ST7735_OutUDec5(uint32_t n);
406 
417 void ST7735_OutUFix2_1(uint32_t n, int16_t textColor);
418 
429 void ST7735_OutUHex2(uint32_t n, int16_t textColor);
430 
438 void ST7735_SetRotation(uint8_t m) ;
439 
440 
441 
449 void ST7735_InvertDisplay(int i) ;
450 
451 
452 
477 void ST7735_Drawaxes(uint16_t axisColor, uint16_t bgColor, char *xLabel,
478  char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color,
479  int32_t ymax, int32_t ymin);
480 
489 void ST7735_PlotClear(int32_t ymin, int32_t ymax);
490 
491 
503 void ST7735_PlotPoint(int32_t y);
504 
505 
518 void ST7735_PlotPoint2(int32_t data1, uint16_t color1);
519 
520 
532 void ST7735PlotIncrement(void);
533 
534 
543 void ST7735_PlotLine(int32_t y);
544 
545 // *************** ST7735_PlotPoints ********************
546 // Used in the voltage versus time plot, plot two points at y1, y2
547 // It does output to display
548 // Inputs: y1 is the y coordinate of the first point plotted
549 // y2 is the y coordinate of the second point plotted
550 // Outputs: none
562 void ST7735_PlotPoints(int32_t y1,int32_t y2);
563 
564 
575 void ST7735_PlotBar(int32_t y);
576 
577 
587 void ST7735_PlotdBfs(int32_t y);
588 
599 void ST7735_PlotNext(void);
600 
609 void ST7735_PlotNextErase(void);
610 
611 // Used in all the plots to write buffer to LCD
612 // Example 1 Voltage versus time
613 // ST7735_PlotClear(0,4095); // range from 0 to 4095
614 // ST7735_PlotPoint(data); ST7735_PlotNext(); // called 128 times
615 
616 // Example 2a Voltage versus time (N data points/pixel, time scale)
617 // ST7735_PlotClear(0,4095); // range from 0 to 4095
618 // { for(j=0;j<N;j++){
619 // ST7735_PlotPoint(data[i++]); // called N times
620 // }
621 // ST7735_PlotNext();
622 // } // called 128 times
623 
624 // Example 2b Voltage versus time (N data points/pixel, time scale)
625 // ST7735_PlotClear(0,4095); // range from 0 to 4095
626 // { for(j=0;j<N;j++){
627 // ST7735_PlotLine(data[i++]); // called N times
628 // }
629 // ST7735_PlotNext();
630 // } // called 128 times
631 
632 // Example 3 Voltage versus frequency (512 points)
633 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
634 // ST7735_PlotClear(0,1023); // clip large magnitudes
635 // {
636 // ST7735_PlotBar(mag[i++]); // called 4 times
637 // ST7735_PlotBar(mag[i++]);
638 // ST7735_PlotBar(mag[i++]);
639 // ST7735_PlotBar(mag[i++]);
640 // ST7735_PlotNext();
641 // } // called 128 times
642 
643 // Example 4 Voltage versus frequency (512 points), dB scale
644 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
645 // ST7735_PlotClear(0,511); // parameters ignored
646 // {
647 // ST7735_PlotdBfs(mag[i++]); // called 4 times
648 // ST7735_PlotdBfs(mag[i++]);
649 // ST7735_PlotdBfs(mag[i++]);
650 // ST7735_PlotdBfs(mag[i++]);
651 // ST7735_PlotNext();
652 // } // called 128 times
653 
654 
663 void ST7735_OutChar(char ch);
664 
665 
675 void ST7735_OutString(char *ptr);
676 
677 
685 void ST7735_SetTextColor(uint16_t color);
686 
693 void ST7735_InitPrintf(void);
694 
695 
715 void ST7735_sDecOut2(int32_t n);
716 
717 
718 
744 void ST7735_uBinOut6(uint32_t n);
745 
758 void ST7735_XYplotInit(char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY);
759 
769 void ST7735_XYplot(uint32_t num, int32_t bufX[], int32_t bufY[]);
770 
786 void ST7735_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
787  uint16_t color);
788 
799 void ST7735_SetX(int32_t newX);
800 
801 //------------ST7735_Message------------
802 // String draw and number output.
803 // Input: device 0 is on top, 1 is on bottom
804 // line row from top, 0 to 7 for each device
805 // pt pointer to a null terminated string to be printed
806 // value signed integer to be printed
807 void ST7735_Message(uint32_t d, uint32_t l, char *pt, int32_t value);
808 
809 
810 
811 
812 
813 #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_PlotdBfs(int32_t y)
Plot one bar.
void ST7735_PlotPoint2(int32_t data1, uint16_t color1)
Plot one point with color.
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:132
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.