| RTOS_MSPM0 1.1 ECE445M starter code

ST7735.h
Go to the documentation of this file.
1
126 #ifndef _ST7735H_
127 #define _ST7735H_
128 #include <stdint.h>
132 enum initRFlags{
133 none,
134 INITR_GREENTAB,
135 INITR_REDTAB,
136 INITR_BLACKTAB
137 };
138
142 #define ST7735_TFTWIDTH 128
146 #define ST7735_TFTHEIGHT 160
147
148
152 #define ST7735_BLACK 0x0000
153 #define ST7735_BLUE 0xF800
154 #define ST7735_RED 0x001F
155 #define ST7735_GREEN 0x07E0
156 #define ST7735_CYAN 0xFFE0
157 #define ST7735_MAGENTA 0xF81F
158 #define ST7735_YELLOW 0x07FF
159 #define ST7735_WHITE 0xFFFF
160 #define ST7735_LIGHTGREY ST7735_Color565(228,228,228)
161 #define ST7735_DARKGREY ST7735_Color565(32,32,32)
162 #define ST7735_ORANGE ST7735_Color565(255,102,0)
163 #define ST7735_PURPLE ST7735_Color565(106,13,173)
164
172 void ST7735_InitB(void);
173
174
175
183 void ST7735_InitR(enum initRFlags option);
184
185
186
200 void ST7735_DrawPixel(int16_t x, int16_t y, uint16_t color);
201
202
214 void ST7735_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
215
216
217
229 void ST7735_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
230
231
239 void ST7735_FillScreen(uint16_t color);
240
241
242
254 void ST7735_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
255
256
266 void ST7735_DrawSmallCircle(int16_t x, int16_t y, uint16_t color);
267
268
278 void ST7735_DrawCircle(int16_t x, int16_t y, uint16_t color);
279
288 uint16_t ST7735_Color565(uint8_t r, uint8_t g, uint8_t b);
289
297 uint16_t ST7735_SwapColor(uint16_t x) ;
298
299
321 void ST7735_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h);
322
340 void ST7735_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
341
342
358 void ST7735_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
359
360
373 uint32_t ST7735_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor);;
374
375
386 void ST7735_SetCursor(uint32_t newX, uint32_t newY);
387
397 void ST7735_OutUDec(uint32_t n);
398
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 // *************** ST7735_PlotPoints ********************
563 // Used in the voltage versus time plot, plot two points at y1, y2
564 // It does output to display
565 // Inputs: y1 is the y coordinate of the first point plotted
566 // y2 is the y coordinate of the second point plotted
567 // Outputs: none
579 void ST7735_PlotPoints(int32_t y1,int32_t y2);
580
581
592 void ST7735_PlotBar(int32_t y);
593
594
604 void ST7735_PlotdBfs(int32_t y);
605
616 void ST7735_PlotNext(void);
617
626 void ST7735_PlotNextErase(void);
627
628 // Used in all the plots to write buffer to LCD
629 // Example 1 Voltage versus time
630 // ST7735_PlotClear(0,4095); // range from 0 to 4095
631 // ST7735_PlotPoint(data); ST7735_PlotNext(); // called 128 times
632
633 // Example 2a Voltage versus time (N data points/pixel, time scale)
634 // ST7735_PlotClear(0,4095); // range from 0 to 4095
635 // { for(j=0;j<N;j++){
636 // ST7735_PlotPoint(data[i++]); // called N times
637 // }
638 // ST7735_PlotNext();
639 // } // called 128 times
640
641 // Example 2b Voltage versus time (N data points/pixel, time scale)
642 // ST7735_PlotClear(0,4095); // range from 0 to 4095
643 // { for(j=0;j<N;j++){
644 // ST7735_PlotLine(data[i++]); // called N times
645 // }
646 // ST7735_PlotNext();
647 // } // called 128 times
648
649 // Example 3 Voltage versus frequency (512 points)
650 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
651 // ST7735_PlotClear(0,1023); // clip large magnitudes
652 // {
653 // ST7735_PlotBar(mag[i++]); // called 4 times
654 // ST7735_PlotBar(mag[i++]);
655 // ST7735_PlotBar(mag[i++]);
656 // ST7735_PlotBar(mag[i++]);
657 // ST7735_PlotNext();
658 // } // called 128 times
659
660 // Example 4 Voltage versus frequency (512 points), dB scale
661 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
662 // ST7735_PlotClear(0,511); // parameters ignored
663 // {
664 // ST7735_PlotdBfs(mag[i++]); // called 4 times
665 // ST7735_PlotdBfs(mag[i++]);
666 // ST7735_PlotdBfs(mag[i++]);
667 // ST7735_PlotdBfs(mag[i++]);
668 // ST7735_PlotNext();
669 // } // called 128 times
670
671
680 void ST7735_OutChar(char ch);
681
690 void ST7735_OutCharTransparent(char ch);
691
701 void ST7735_OutString(char *ptr);
702
703
713 void ST7735_OutStringTransparent(char *ptr);
714
722 void ST7735_SetTextColor(uint16_t color);
723
730 void ST7735_InitPrintf(void);
731
732
752 void ST7735_sDecOut2(int32_t n);
753
754
755
781 void ST7735_uBinOut6(uint32_t n);
782
795 void ST7735_XYplotInit(char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY);
796
806 void ST7735_XYplot(uint32_t num, int32_t bufX[], int32_t bufY[]);
807
823 void ST7735_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
824 uint16_t color);
825
836 void ST7735_SetX(int32_t newX);
837
838
839 #endif
ST7735_DrawFastHLine
void ST7735_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color)
Draw a horizontal line.
ST7735_OutUDec
void ST7735_OutUDec(uint32_t n)
Output an unsigned decimal.
ST7735_OutCharTransparent
void ST7735_OutCharTransparent(char ch)
Output a character transparently.
ST7735_DrawCharS
void ST7735_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
Draw a character.
ST7735_PlotdBfs
void ST7735_PlotdBfs(int32_t y)
Plot one bar.
ST7735_PlotPoint2
void ST7735_PlotPoint2(int32_t data1, uint16_t color1)
Plot one point with color.
ST7735_PlotPoint
void ST7735_PlotPoint(int32_t y)
Plot one point.
ST7735_InitR
void ST7735_InitR(enum initRFlags option)
Initialize ST7735R LCD.
ST7735_InvertDisplay
void ST7735_InvertDisplay(int i)
invert display
ST7735_Color565
uint16_t ST7735_Color565(uint8_t r, uint8_t g, uint8_t b)
RGB to color creation.
ST7735_DrawFastVLine
void ST7735_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color)
Draw a vertical line.
ST7735_Line
void ST7735_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color)
Draws line.
ST7735_FillScreen
void ST7735_FillScreen(uint16_t color)
Fill the screen.
ST7735_PlotLine
void ST7735_PlotLine(int32_t y)
Plot one line.
ST7735_PlotNextErase
void ST7735_PlotNextErase(void)
Move X coordinate
ST7735_OutStringTransparent
void ST7735_OutStringTransparent(char *ptr)
Output a string transparently.
ST7735_OutChar
void ST7735_OutChar(char ch)
Output a character.
ST7735_uBinOut6
void ST7735_uBinOut6(uint32_t n)
fixed point output resolution 1/64
ST7735_OutUHex2
void ST7735_OutUHex2(uint32_t n, int16_t textColor)
Output a 2-digit hexadecimal number.
ST7735_DrawChar
void ST7735_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size)
Draw a character.
ST7735_OutString
void ST7735_OutString(char *ptr)
Output a string.
ST7735_SetCursor
void ST7735_SetCursor(uint32_t newX, uint32_t newY)
Move the cursor.
ST7735_SetTextColor
void ST7735_SetTextColor(uint16_t color)
sets the text color
ST7735_DrawString
uint32_t ST7735_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor)
Draw a string.
ST7735PlotIncrement
void ST7735PlotIncrement(void)
Moves the plot cursor in time.
initRFlags
initRFlags
some flags for ST7735_InitR()
Definition: ST7735.h:132
ST7735_DrawSmallCircle
void ST7735_DrawSmallCircle(int16_t x, int16_t y, uint16_t color)
Draw a small circle.
ST7735_Drawaxes
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.
ST7735_DrawPixel
void ST7735_DrawPixel(int16_t x, int16_t y, uint16_t color)
Color one pixel.
ST7735_DrawBitmap
void ST7735_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h)
Displays a BMP image.
ST7735_XYplotInit
void ST7735_XYplotInit(char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY)
initialize XY plot
ST7735_InitPrintf
void ST7735_InitPrintf(void)
use ST7735 LCD to output from printf
ST7735_SetRotation
void ST7735_SetRotation(uint8_t m)
Change rotation.
ST7735_OutUFix2_1
void ST7735_OutUFix2_1(uint32_t n, int16_t textColor)
Output a 2-digit fixed-point decimal.
ST7735_sDecOut2
void ST7735_sDecOut2(int32_t n)
fixed point output resolution 0.01
ST7735_SwapColor
uint16_t ST7735_SwapColor(uint16_t x)
Swaps red and blue.
ST7735_SetX
void ST7735_SetX(int32_t newX)
set X-position
ST7735_FillRect
void ST7735_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
Draw a filled rectangle.
ST7735_PlotBar
void ST7735_PlotBar(int32_t y)
Plot one bar.
ST7735_DrawCircle
void ST7735_DrawCircle(int16_t x, int16_t y, uint16_t color)
Draw a circle.
ST7735_OutUDec4
void ST7735_OutUDec4(uint32_t n)
Output a 4-digit unsigned decimal.
ST7735_InitB
void ST7735_InitB(void)
Initialize ST7735B LCD.
ST7735_OutUDec5
void ST7735_OutUDec5(uint32_t n)
Output a 5-digit unsigned decimal.
ST7735_PlotPoints
void ST7735_PlotPoints(int32_t y1, int32_t y2)
Plot two points.
ST7735_PlotNext
void ST7735_PlotNext(void)
Move x-axis parameter.
ST7735_XYplot
void ST7735_XYplot(uint32_t num, int32_t bufX[], int32_t bufY[])
XY plot.
ST7735_PlotClear
void ST7735_PlotClear(int32_t ymin, int32_t ymax)
Clear plot.