MSPM0_ValvanoWare  1.0
ECE445L starter code
ST7735.h
Go to the documentation of this file.
1 
203 #ifndef _ST7735H_
204 #define _ST7735H_
205 #include <stdint.h>
210  none,
211  INITR_GREENTAB,
212  INITR_REDTAB,
213  INITR_BLACKTAB
214 };
215 
219 #define ST7735_TFTWIDTH 128
223 #define ST7735_TFTHEIGHT 160
224 
225 
229 #define ST7735_BLACK 0x0000
230 #define ST7735_BLUE 0xF800
231 #define ST7735_RED 0x001F
232 #define ST7735_GREEN 0x07E0
233 #define ST7735_CYAN 0xFFE0
234 #define ST7735_MAGENTA 0xF81F
235 #define ST7735_YELLOW 0x07FF
236 #define ST7735_WHITE 0xFFFF
237 #define ST7735_LIGHTGREY ST7735_Color565(228,228,228)
238 #define ST7735_DARKGREY ST7735_Color565(32,32,32)
239 #define ST7735_ORANGE ST7735_Color565(255,102,0)
240 #define ST7735_PURPLE ST7735_Color565(106,13,173)
241 
249 void ST7735_InitB(void);
250 
251 
252 
260 void ST7735_InitR(enum initRFlags option);
261 
262 
263 
277 void ST7735_DrawPixel(int16_t x, int16_t y, uint16_t color);
278 
279 
291 void ST7735_DrawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
292 
293 
294 
306 void ST7735_DrawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
307 
308 
316 void ST7735_FillScreen(uint16_t color);
317 
318 
319 
331 void ST7735_FillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
332 
333 
343 void ST7735_DrawSmallCircle(int16_t x, int16_t y, uint16_t color);
344 
345 
355 void ST7735_DrawCircle(int16_t x, int16_t y, uint16_t color);
356 
365 uint16_t ST7735_Color565(uint8_t r, uint8_t g, uint8_t b);
366 
374 uint16_t ST7735_SwapColor(uint16_t x) ;
375 
376 
398 void ST7735_DrawBitmap(int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h);
399 
417 void ST7735_DrawCharS(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
418 
419 
435  void ST7735_DrawChar(int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size);
436 
437 
450 uint32_t ST7735_DrawString(uint16_t x, uint16_t y, char *pt, int16_t textColor);;
451 
452 
463 void ST7735_SetCursor(uint32_t newX, uint32_t newY);
464 
474 void ST7735_OutUDec(uint32_t n);
475 
476 
487 void ST7735_OutUDec4(uint32_t n);
488 
499 void ST7735_OutUDec5(uint32_t n);
500 
511 void ST7735_OutUFix2_1(uint32_t n, int16_t textColor);
512 
523 void ST7735_OutUHex2(uint32_t n, int16_t textColor);
524 
532 void ST7735_SetRotation(uint8_t m) ;
533 
534 
535 
543 void ST7735_InvertDisplay(int i) ;
544 
545 
546 
571 void ST7735_Drawaxes(uint16_t axisColor, uint16_t bgColor, char *xLabel,
572  char *yLabel1, uint16_t label1Color, char *yLabel2, uint16_t label2Color,
573  int32_t ymax, int32_t ymin);
574 
583 void ST7735_PlotClear(int32_t ymin, int32_t ymax);
584 
585 
597 void ST7735_PlotPoint(int32_t y);
598 
599 
612 void ST7735_PlotPoint2(int32_t data1, uint16_t color1);
613 
614 
627 
628 
637 void ST7735_PlotLine(int32_t y);
638 
639 // *************** ST7735_PlotPoints ********************
640 // Used in the voltage versus time plot, plot two points at y1, y2
641 // It does output to display
642 // Inputs: y1 is the y coordinate of the first point plotted
643 // y2 is the y coordinate of the second point plotted
644 // Outputs: none
656 void ST7735_PlotPoints(int32_t y1,int32_t y2);
657 
658 
669 void ST7735_PlotBar(int32_t y);
670 
671 
681 void ST7735_PlotdBfs(int32_t y);
682 
693 void ST7735_PlotNext(void);
694 
704 
705 // Used in all the plots to write buffer to LCD
706 // Example 1 Voltage versus time
707 // ST7735_PlotClear(0,4095); // range from 0 to 4095
708 // ST7735_PlotPoint(data); ST7735_PlotNext(); // called 128 times
709 
710 // Example 2a Voltage versus time (N data points/pixel, time scale)
711 // ST7735_PlotClear(0,4095); // range from 0 to 4095
712 // { for(j=0;j<N;j++){
713 // ST7735_PlotPoint(data[i++]); // called N times
714 // }
715 // ST7735_PlotNext();
716 // } // called 128 times
717 
718 // Example 2b Voltage versus time (N data points/pixel, time scale)
719 // ST7735_PlotClear(0,4095); // range from 0 to 4095
720 // { for(j=0;j<N;j++){
721 // ST7735_PlotLine(data[i++]); // called N times
722 // }
723 // ST7735_PlotNext();
724 // } // called 128 times
725 
726 // Example 3 Voltage versus frequency (512 points)
727 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
728 // ST7735_PlotClear(0,1023); // clip large magnitudes
729 // {
730 // ST7735_PlotBar(mag[i++]); // called 4 times
731 // ST7735_PlotBar(mag[i++]);
732 // ST7735_PlotBar(mag[i++]);
733 // ST7735_PlotBar(mag[i++]);
734 // ST7735_PlotNext();
735 // } // called 128 times
736 
737 // Example 4 Voltage versus frequency (512 points), dB scale
738 // perform FFT to get 512 magnitudes, mag[i] (0 to 4095)
739 // ST7735_PlotClear(0,511); // parameters ignored
740 // {
741 // ST7735_PlotdBfs(mag[i++]); // called 4 times
742 // ST7735_PlotdBfs(mag[i++]);
743 // ST7735_PlotdBfs(mag[i++]);
744 // ST7735_PlotdBfs(mag[i++]);
745 // ST7735_PlotNext();
746 // } // called 128 times
747 
748 
757 void ST7735_OutChar(char ch);
758 
768 
778 void ST7735_OutString(char *ptr);
779 
780 
791 
799 void ST7735_SetTextColor(uint16_t color);
800 
809 void ST7735_InitPrintf(enum initRFlags option);
810 
811 
831 void ST7735_sDecOut2(int32_t n);
832 
833 
834 
860 void ST7735_uBinOut6(uint32_t n);
861 
874 void ST7735_XYplotInit(char *title, int32_t minX, int32_t maxX, int32_t minY, int32_t maxY);
875 
885 void ST7735_XYplot(uint32_t num, int32_t bufX[], int32_t bufY[]);
886 
902 void ST7735_Line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,
903  uint16_t color);
904 
915 void ST7735_SetX(int32_t newX);
916 
931 void ST7735_DrawLine(int32_t x1, int32_t y1,
932  int32_t x2, int32_t y2, uint32_t color);
933 #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_OutCharTransparent(char ch)
Output a character transparently.
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_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_OutStringTransparent(char *ptr)
Output a string transparently.
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_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_InitPrintf(enum initRFlags option)
use ST7735 LCD to output from printf
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.