![]() |
MSPM0_ValvanoWare
1.0
ECE445L starter code
|
OLED and LCD displays. More...
Files | |
| file | Arabic.h |
| Arabic output to LCD. | |
| file | I2C.h |
| Software driver functions for I2C and MKII boosterpack. | |
| file | LCD.h |
| LCD on MKII boosterpack. | |
| file | SSD1306.h |
| Provide simple I/O functions for the SSD 1306 OLED. | |
| file | ST7735.h |
| 160 by 128 pixel LCD | |
| file | ST7735_SDC.h |
| 160 by 128 pixel LCD with SDC | |
Macros | |
| #define | LCD_BLACK 0x0000 |
| The following constants are possible colors for the LCD in RGB format. | |
| #define | LCD_BLUE 0x001F |
| #define | LCD_DARKBLUE 0x34BF |
| #define | LCD_RED 0xF800 |
| #define | LCD_GREEN 0x07E0 |
| #define | LCD_LIGHTGREEN 0x07EF |
| #define | LCD_ORANGE 0xFD60 |
| #define | LCD_CYAN 0x07FF |
| #define | LCD_MAGENTA 0xF81F |
| #define | LCD_YELLOW 0xFFE0 |
| #define | LCD_WHITE 0xFFFF |
| #define | LCD_GREY 0x8410 |
| #define | STANDARD_GALACTIC_ALPHABET 0 |
| Set STANDARD_GALACTIC_ALPHABET to 1 for Commander Keen alphabet. | |
| #define | SSD1306_BLACK 0 |
| Black is 0 or off. | |
| #define | SSD1306_WHITE 1 |
| White is 1 or on. | |
| #define | SSD1306_INVERSE 2 |
| Inverse will flip bits. | |
| #define | SSD1306_EXTERNALVCC 0x01 |
| SSD1306_EXTERNALVCC specifies External display voltage source. | |
| #define | SSD1306_SWITCHCAPVCC 0x02 |
| SSD1306_SWITCHCAPVCC specifies display voltage from 3.3V. | |
| #define | true 1 |
| true means success | |
| #define | false 0 |
| false means failure | |
| #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_COLOR565(r, g, b) ((uint16_t)((b << 8) | (g << 3) | (r >> 3))) |
| Converts r,b,g into 16 bit colors for the LCD in RGB format. | |
| #define | ST7735_BLACK (uint16_t)0x0000 |
| The following constants are possible colors for the LCD in RGB format. | |
| #define | ST7735_BLUE (uint16_t)0xF800 |
| #define | ST7735_RED (uint16_t)0x001F |
| #define | ST7735_GREEN (uint16_t)0x07E0 |
| #define | ST7735_CYAN (uint16_t)0xFFE0 |
| #define | ST7735_MAGENTA (uint16_t)0xF81F |
| #define | ST7735_YELLOW (uint16_t)0x07FF |
| #define | ST7735_WHITE (uint16_t)0xFFFF |
| #define | ST7735_LIGHTGREY ST7735_COLOR565(228,228,228) |
| #define | ST7735_GREY ST7735_COLOR565(128,128,128) |
| #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 | Arabic_t { null , alif , ayh , baa , daad , daal , dhaa , dhaal , faa , ghayh , haa , ha , jeem , kaaf , khaa , laam , meem , noon , qaaf , raa , saad , seen , sheen , ta , thaa , twe , waaw , yaa , zaa , space , dot } |
| Arabic character set. | |
| 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 | Arabic_SetCursor (uint32_t newX, uint32_t newY) |
| Move Arabic cursor. More... | |
| void | Arabic_OutChar (Arabic_t ch) |
| Output an Arabic character. More... | |
| void | Arabic_OutString (Arabic_t *ptr) |
| Output an Arabic string. More... | |
| void | I2C_Init (void) |
| Initialize I2C. More... | |
| uint8_t | I2C_Recv1 (int8_t slave) |
| Receive one byte. More... | |
| uint16_t | I2C_Recv2 (int8_t slave) |
| Receive two bytes. More... | |
| int | I2C_Send (uint8_t slave, uint8_t *pData, uint32_t count) |
| write 1 to 8 bytes to I2C. More... | |
| int | I2C_SendData (uint8_t slave, uint8_t *pData, uint32_t count) |
| send large buffer to I2C. More... | |
| int | I2C_Send1 (int8_t slave, uint8_t data) |
| Send one byte. More... | |
| int | I2C_Send2 (int8_t slave, uint8_t data1, uint8_t data2) |
| Send two bytes. More... | |
| int | I2C_Send3 (int8_t slave, uint8_t data1, uint8_t data2, uint8_t data3) |
| Send three bytes. More... | |
| void | I2C_LightSensor_Init (void) |
| Initialize OPT3001. More... | |
| uint32_t | I2C_LightSensor_Input (void) |
| Input from OPT3001. More... | |
| void | I2C_LightSensor_Start (void) |
| Start OPT3001. More... | |
| int | I2C_LightSensor_End (uint32_t *light) |
| Finish OPT3001. More... | |
| void | I2C_TempSensor_Init (void) |
| Initialize TMP006. More... | |
| void | I2C_TempSensor_Input (int32_t *sensorV, int32_t *localT) |
| Input from TMP006. More... | |
| void | I2C_TempSensor_Start (void) |
| Start TMP006. More... | |
| int | I2C_TempSensor_End (int32_t *sensorV, int32_t *localT) |
| Finish TMP006. More... | |
| void | LCD_Init (void) |
| Initialize MKII LCD. More... | |
| void | LCD_DrawPixel (int16_t x, int16_t y, uint16_t color) |
| Color one pixel. More... | |
| void | LCD_DrawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color) |
| Draw a vertical line. More... | |
| void | LCD_DrawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color) |
| Draw a horizontal line. More... | |
| void | LCD_FillScreen (uint16_t color) |
| Fill the screen. More... | |
| void | LCD_FillRect (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) |
| Draw a filled rectangle. More... | |
| uint16_t | LCD_Color565 (uint8_t r, uint8_t g, uint8_t b) |
| RGB to color creation. More... | |
| uint16_t | LCD_SwapColor (uint16_t x) |
| Swaps red and blue. More... | |
| void | LCD_DrawBitmap (int16_t x, int16_t y, const uint16_t *image, int16_t w, int16_t h) |
| Displays a BMP image. More... | |
| void | LCD_DrawCharS (int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size) |
| Draw a character. More... | |
| void | LCD_DrawChar (int16_t x, int16_t y, char c, int16_t textColor, int16_t bgColor, uint8_t size) |
| Draw a character. More... | |
| uint32_t | LCD_DrawString (uint16_t x, uint16_t y, char *pt, int16_t textColor) |
| Draw a string. More... | |
| void | LCD_SetCursor (uint32_t newX, uint32_t newY) |
| Move the cursor. More... | |
| void | LCD_OutUDec (uint32_t n, int16_t textColor) |
| Output an unsigned decimal. More... | |
| void | LCD_OutUDec4 (uint32_t n, int16_t textColor) |
| Output a 4-digit unsigned decimal. More... | |
| void | LCD_OutUDec5 (uint32_t n, int16_t textColor) |
| Output a 5-digit unsigned decimal. More... | |
| void | LCD_OutUFix2_1 (uint32_t n, int16_t textColor) |
| Output a 2-digit fixed-point decimal. More... | |
| void | LCD_OutUHex2 (uint32_t n, int16_t textColor) |
| Output a 2-digit hexadecimal number. More... | |
| void | LCD_OutChar (char ch) |
| Output a character. More... | |
| void | LCD_OutString (char *ptr) |
| Output a string. More... | |
| void | LCD_SetTextColor (uint16_t color) |
| sets the text color More... | |
| void | LCD_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 | LCD_PlotPoint (int32_t data1, uint16_t color1) |
| Plot one point. More... | |
| void | LCD_PlotIncrement (void) |
| Moves the plot cursor in time. More... | |
| int | SSD1306_Init (int vccst) |
| II2 driver for SSD1306 OLED display. More... | |
| void | SSD1306_OutBuffer (void) |
| void | SSD1306_InvertDisplay (int i) |
| Enable or disable display invert mode (white-on-black vs black-on-white). More... | |
| void | SSD1306_Dim (int dim) |
| Dim the display. More... | |
| void | SSD1306_DrawPixel (int16_t x, int16_t y, uint16_t color) |
| Set/clear/invert a single pixel. This is also invoked by the Adafruit_GFX library in generating many higher-level graphics primitives. More... | |
| void | SSD1306_DrawFastHLine (int16_t x, int16_t y, int16_t w, uint16_t color) |
| Draw a horizontal line. This is also invoked by the Adafruit_GFX library in generating many higher-level graphics primitives. More... | |
| void | SSD1306_DrawFastVLine (int16_t x, int16_t y, int16_t h, uint16_t color) |
| Draw a vertical line. This is also invoked by the Adafruit_GFX library in generating many higher-level graphics primitives. More... | |
| void | SSD1306_startscrollright (uint8_t start, uint8_t stop) |
| Activate a right-handed scroll for all or part of the display. More... | |
| void | SSD1306_startscrollleft (uint8_t start, uint8_t stop) |
| Activate a left-handed scroll for all or part of the display. More... | |
| void | SSD1306_startscrolldiagright (uint8_t start, uint8_t stop) |
| Activate a diagonal scroll for all or part of the display. More... | |
| void | SSD1306_startscrolldiagleft (uint8_t start, uint8_t stop) |
| Activate alternate diagonal scroll for all or part of the display. More... | |
| void | SSD1306_stopscroll (void) |
| Cease a previously-begun scrolling action. More... | |
| int | SSD1306_GetPixel (int16_t x, int16_t y) |
| Return color of a single pixel in display buffer. More... | |
| uint8_t * | SSD1306_getBuffer (void) |
| Get base address of display buffer for direct reading or writing. More... | |
| void | SSD1306_DrawChar (int16_t x, int16_t y, char letter, uint16_t color) |
| Draw a character. More... | |
| void | SSD1306_DrawString (int16_t x, int16_t y, char *pt, uint16_t color) |
| Draw a string. More... | |
| void | SSD1306_DrawUDec (int16_t x, int16_t y, uint16_t n, uint16_t color) |
| Draw a 3 digit integer. More... | |
| void | SSD1306_ClearBuffer (void) |
| Clear contents of display buffer (set all pixels to off). More... | |
| void | SSD1306_OutClear (void) |
| Clear the LCD by writing zeros to the entire screen and reset the cursor to (0,0) (top left corner of screen). More... | |
| void | SSD1306_DrawFullImage (const uint8_t *ptr) |
| Fill the whole screen by drawing a 128x64 bitmap image. More... | |
| void | SSD1306_DrawBMP (uint8_t xpos, uint8_t ypos, const uint8_t *ptr, uint8_t threshold, uint16_t color) |
| Draw a raw bitmap to the RAM buffer. More... | |
| void | SSD1306_SetCursor (uint16_t newX, uint16_t newY) |
| void | SSD1306_OutChar (char data) |
| Print a character to the OLED. More... | |
| void | SSD1306_OutString (char *ptr) |
| Print a string of characters to the OLED. More... | |
| void | SSD1306_OutUDec (uint16_t n) |
| Print a 16-bit unsigned number to the OLED. More... | |
| void | SSD1306_OutSDec (int16_t n) |
| Print a 16-bit signed number to the OLED. More... | |
| void | SSD1306_OutUFix1 (uint16_t n) |
| Print a 16-bit unsigned fixed-point number to the OLED. More... | |
| void | SSD1306_OutU3Fix1 (uint16_t n) |
| Print a 16-bit unsigned fixed-point number to the OLED. More... | |
| void | SSD1306_OutSFix1 (int32_t n) |
| Print a 32-bit signed fixed-point number to the OLED. More... | |
| void | SSD1306_OutHex7 (uint8_t n) |
| Print one hex digit. More... | |
| void | SSD1306_OutUHex7 (uint8_t n) |
| Print two hex digits. More... | |
| void | SSD1306_OutUHex32 (uint32_t n) |
| Print 16 hex digits. More... | |
| void | SSD1306_OutUDec16 (uint32_t n) |
| Print three decimal digits. More... | |
| void | SSD1306_OutUDec2 (uint32_t n) |
| Print two decimal digits. More... | |
| void | SSD1306_SetPlot (int32_t minX, int32_t maxX, int32_t minY, int32_t maxY, uint16_t color) |
| Initialize parameters for plotting. More... | |
| void | SSD1306_DrawPoint (int32_t x, int32_t y) |
| Set/clear/invert a single pixel. SSD1306_SetPlot initializes scaling. More... | |
| void | SSD1306_InitPrintf (void) |
| Initialize the SSD1306 for printf. More... | |
| 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 (enum initRFlags option) |
| 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_DrawLine (int32_t x1, int32_t y1, int32_t x2, int32_t y2, uint32_t color) |
| draw line More... | |
| void | ST7735_OutSDec2 (int32_t n, uint32_t l) |
| Output a signed decimal. More... | |
| void | ST7735_InitPrintf (void) |
| Use ST7735 LCD to output from printf. More... | |
OLED and LCD displays.
| 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 |
| Pin | Connection |
|---|---|
| VCC | +3.3 V |
| GND | Ground / |
| !SCL | SPI1 SCLK: PB9 |
| !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 |
| X | (NC) analog input X-axis from ADXL335 accelerometer |
| Y | (NC) analog input Y-axis from ADXL335 accelerometer |
| Z | (NC) analog input Z-axis from ADXL335 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 |
| signal | Pin | Connection |
|---|---|---|
| LED | 8 | to +3.3 V |
| SCK | 7 | SCLK to PB9 SPI1 SCLK |
| SDA | 6 | MOSI, to PB8 SPI1 PICO |
| A0 | 5 | Data/Command to PA13 (GPIO), high for data, low for command |
| RESET | 4 | to PB15 (GPIO), low to reset |
| CS | 3 | to PB6 SPI1 CS0: |
| Gnd | 2 | to ground |
| VCC | 1 | to +3.3 V |
| Pin | Function | Description |
|---|---|---|
| PA27 | GPIO | J1.8 ambient light (OPT3001) interrupt (digital) |
| PB2 | I2C1-SCL | J1.9 ambient light (OPT3001) and temperature sensor (TMP006) |
| PB3 | I2C1-SDA | J1.10 ambient light (OPT3001) and temperature sensor (TMP006) |
| PB16 | GPIO | J2.11 temperature sensor (TMP006) interrupt (digital) |
| Pin | Function | Description |
|---|---|---|
| PB9 | SPI1 SCLK | J1.7 LCD SPI clock (SPI) |
| PB6 | SPI1 CS0 | J2.13 LCD SPI CS (SPI) |
| PB8 | SPI1 PICO | J2.15 LCD SPI data (SPI) |
| PB15 | GPIO | J2.17 LCD !RST (digital) |
| PA13 | GPIO | J4.31 LCD RS (digital) |
| 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 |
| Pin | Connection |
|---|---|
| VCC | +3.3 V |
| GND | Ground / |
| !SCL | SPI1 SCLK: PB9 |
| !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 |
| X | (NC) analog input X-axis from ADXL335 accelerometer |
| Y | (NC) analog input Y-axis from ADXL335 accelerometer |
| Z | (NC) analog input Z-axis from ADXL335 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 |
| signal | Pin | Connection |
|---|---|---|
| LED | 8 | to +3.3 V |
| SCK | 7 | SCLK to PB9 SPI1 SCLK |
| SDA | 6 | MOSI, to PB8 SPI1 PICO |
| A0 | 5 | Data/Command to PA13 (GPIO), high for data, low for command |
| RESET | 4 | to PB15 (GPIO), low to reset |
| CS | 3 | to PB6 SPI1 CS0: |
| Gnd | 2 | to ground |
| VCC | 1 | to +3.3 V |
| 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 |
| void Arabic_OutChar | ( | Arabic_t | ch | ) |
Output an Arabic character.
Output one Arabic character to the LCD Position determined by Arabic_SetCursor command Color set by ST7735_SetTextColor
| ch | 8-bit Arabic character |
| void Arabic_OutString | ( | Arabic_t * | ptr | ) |
Output an Arabic string.
Output an Arabic string to the LCD Position determined by Arabic_SetCursor command Color set by ST7735_SetTextColor. The string will automatically wrap.
| ptr | pointer to null-terminated Arabic string |
| void Arabic_SetCursor | ( | uint32_t | newX, |
| uint32_t | newY | ||
| ) |
Move Arabic cursor.
Move the cursor to the desired X- and Y-position. The next character will be printed here. X=0 is the leftmost column. Y=0 is the top row. *
| none | |
| newX | new X-position of the cursor (0<=newX<=7) |
| newY | new Y-position of the cursor (0<=newY<=9) |
| void I2C_Init | ( | void | ) |
Initialize I2C.
Initialize PB2 and PB3 for I2C for 400kHz clock. Uses busy-wait synchronization
| none |
| int I2C_LightSensor_End | ( | uint32_t * | light | ) |
Finish OPT3001.
Finish a measurement using the OPT3001. Query the OPT3001 light sensor for a measurement. If no measurement is currently in progress, start one and return zero immediately. If the measurement is not yet complete, return zero immediately. If the measurement is complete, store the result in the pointer provided and return one.
| light | pointer to a place to return data |
| void I2C_LightSensor_Init | ( | void | ) |
Initialize OPT3001.
Initialize OPT3001 on MKII boosterpack. PA27 is GPIO pin for input, which corresponds with BoosterPack pins J1.8 (Light Sensor interrupt). Initialize PB2 and PB3 for I2C pins, which correspond with BoosterPack pins J1.9 (SCL) and J1.10 (SDA)
| none |
| uint32_t I2C_LightSensor_Input | ( | void | ) |
Input from OPT3001.
Query the OPT3001 light sensor for a measurement. Wait until the measurement is ready, which may take 800 ms
| none |
| void I2C_LightSensor_Start | ( | void | ) |
Start OPT3001.
Start a measurement using the OPT3001. If a measurement is currently in progress, return without starting another measurement
| none |
| uint8_t I2C_Recv1 | ( | int8_t | slave | ) |
Receive one byte.
Receive one byte from specified slave. Uses busy-wait synchronization
[send address][read data]
| slave | is slave address |
| uint16_t I2C_Recv2 | ( | int8_t | slave | ) |
Receive two bytes.
Receive two bytes from specified slave. Uses busy-wait synchronization
[send address][read data][read data]
| slave | is slave address |
| int I2C_Send | ( | uint8_t | slave, |
| uint8_t * | pData, | ||
| uint32_t | count | ||
| ) |
| int I2C_Send1 | ( | int8_t | slave, |
| uint8_t | data | ||
| ) |
Send one byte.
Send one byte to specified slave. Uses busy-wait synchronization
[send address][send data]
| slave | slave address |
| data | byte to be sent |
| int I2C_Send2 | ( | int8_t | slave, |
| uint8_t | data1, | ||
| uint8_t | data2 | ||
| ) |
Send two bytes.
Send two bytes to specified slave. Uses busy-wait synchronization
[send address][send data1][send data2]
| slave | is slave address |
| data1 | is first byte to be sent |
| data2 | is second byte to be sent |
| int I2C_Send3 | ( | int8_t | slave, |
| uint8_t | data1, | ||
| uint8_t | data2, | ||
| uint8_t | data3 | ||
| ) |
Send three bytes.
Send three bytes to specified slave. Uses busy-wait synchronization
[send address][send data1][send data2][send data3]
| slave | is slave address |
| data1 | is first byte to be sent |
| data2 | is second byte to be sent |
| data3 | is third byte to be sent |
| int I2C_SendData | ( | uint8_t | slave, |
| uint8_t * | pData, | ||
| uint32_t | count | ||
| ) |
| int I2C_TempSensor_End | ( | int32_t * | sensorV, |
| int32_t * | localT | ||
| ) |
Finish TMP006.
Finish a measurement using the OPT3001. Query the TMP006 temperature sensor for a measurement. If no measurement is currently in progress, start one and return zero immediately. If the measurement is not yet complete, return zero immediately. If the measurement is complete, store the result in the pointers provided and return one.
| sensorV | is signed pointer to store sensor voltage (units 100*nV) |
| localT | is signed pointer to store local temperature (units 100,000*C) |
| void I2C_TempSensor_Init | ( | void | ) |
Initialize TMP006.
Initialize TMP006 on MKII boosterpack. PB16 is GPIO pin for input, which corresponds with BoosterPack pins J1.8 (Light Sensor interrupt). Initialize PB2 and PB3 for I2C pins, which correspond with BoosterPack pins J1.9 (SCL) and J1.10 (SDA)
| none |
| void I2C_TempSensor_Input | ( | int32_t * | sensorV, |
| int32_t * | localT | ||
| ) |
Input from TMP006.
Query the TMP006 temperature sensor for a measurement. Wait until the measurement is ready, which may take 4 seconds
| sensorV | is signed pointer to store sensor voltage (units 100*nV) |
| localT | is signed pointer to store local temperature (units 100,000*C) |
| void I2C_TempSensor_Start | ( | void | ) |
Start TMP006.
Start a measurement using the TMP006. If a measurement is currently in progress, return without starting another measurement
| none |
| uint16_t LCD_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 LCD_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 LCD_PlotPoint() and LCD_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 LCD_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 LCD_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 LCD_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 LCD_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 LCD_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 LCD_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 LCD_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 128 y 126 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() |
| uint32_t LCD_DrawString | ( | uint16_t | x, |
| uint16_t | y, | ||
| char * | pt, | ||
| int16_t | textColor | ||
| ) |
Draw a string.
String draw function. 13 rows (0 to 12) 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 LCD_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 LCD_Color565() |
| void LCD_FillScreen | ( | uint16_t | color | ) |
Fill the screen.
Fill the screen with the given color.
Requires 33,293 bytes of transmission
| color | 16-bit color, which can be produced by LCD_Color565() |
| void LCD_Init | ( | void | ) |
Initialize MKII LCD.
Initialize Crystalfontz CFAF128128B-0145T color 128x128-pixel TFT LCD BoosterPack pins
| none |
| void LCD_OutChar | ( | char | ch | ) |
Output a character.
Output one character to the LCD Position determined by LCD_SetCursor command Color set by LCD_SetTextColor
| ch | 8-bit ASCII character |
| void LCD_OutString | ( | char * | ptr | ) |
Output a string.
Print a string of characters to the ST7735 LCD. Position determined by LCD_SetCursor command Color set by LCD_SetTextColor The string will not automatically wrap.
| ptr | pointer to NULL-terminated ASCII string |
| void LCD_OutUDec | ( | uint32_t | n, |
| int16_t | textColor | ||
| ) |
Output an unsigned decimal.
Output a 32-bit number in unsigned decimal format Position determined by LCD_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void LCD_OutUDec4 | ( | uint32_t | n, |
| int16_t | textColor | ||
| ) |
Output a 4-digit unsigned decimal.
Output a 32-bit number in unsigned 4-digit decimal format with no space before or after. Position determined by LCD_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void LCD_OutUDec5 | ( | uint32_t | n, |
| int16_t | textColor | ||
| ) |
Output a 5-digit unsigned decimal.
Output a 32-bit number in unsigned 5-digit decimal format Position determined by LCD_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void LCD_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 LCD_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void LCD_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 LCD_SetCursor command
| n | 32-bit number to be transferred |
| textColor | 16-bit color of the numbers |
| void LCD_PlotIncrement | ( | void | ) |
Moves the plot cursor in time.
Increment the plot between subsequent calls to LCD_PlotPoint(). Automatically wrap and clear the column to be printed to.
| none |
| void LCD_PlotPoint | ( | int32_t | data1, |
| uint16_t | color1 | ||
| ) |
Plot one point.
Plot a point on the chart. To plot several points in the same column, call this function repeatedly before calling LCD_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 LCD_Color565() |
| void LCD_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<=12) |
| void LCD_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 |
| uint16_t LCD_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 SSD1306_ClearBuffer | ( | void | ) |
Clear contents of display buffer (set all pixels to off).
| void SSD1306_Dim | ( | int | dim | ) |
Dim the display.
| dim | true to enable lower brightness mode, false for full brightness. |
| void SSD1306_DrawBMP | ( | uint8_t | xpos, |
| uint8_t | ypos, | ||
| const uint8_t * | ptr, | ||
| uint8_t | threshold, | ||
| uint16_t | color | ||
| ) |
Draw a raw bitmap to the RAM buffer.
| xpos | Horizontal position of bottom left corner of image, columns from the left edge. must be less than 128 0 is on the left; 126 is near the right |
| ypos | Vertical position of bottom left corner of image, rows from the top edge. must be less than 64 2 is near the top; 63 is at the bottom |
| ptr | Pointer to a 16-color BMP image. |
| threshold | Grayscale colors above this number make corresponding pixel 'on'. 0 to 14 0 is fine for ships, explosions, projectiles, and bunkers |
| color | Pixel color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERSE. |
| void SSD1306_DrawChar | ( | int16_t | x, |
| int16_t | y, | ||
| char | letter, | ||
| uint16_t | color | ||
| ) |
Draw a character.
| x | Column of display – 0 at left to (screen width - 1) at right. |
| y | Row of display – 0 at top to (screen height - 1) at bottom. |
| letter | ASCII code of character to draw. |
| color | Pixel color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERSE. |
| void SSD1306_DrawFastHLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | w, | ||
| uint16_t | color | ||
| ) |
Draw a horizontal line. This is also invoked by the Adafruit_GFX library in generating many higher-level graphics primitives.
| x | Leftmost column – 0 at left to (screen width - 1) at right. |
| y | Row of display – 0 at top to (screen height -1) at bottom. |
| w | Width of line, in pixels. |
| color | Line color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERSE. |
| void SSD1306_DrawFastVLine | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | h, | ||
| uint16_t | color | ||
| ) |
Draw a vertical line. This is also invoked by the Adafruit_GFX library in generating many higher-level graphics primitives.
| x | Column of display – 0 at left to (screen width -1) at right. |
| y | Topmost row – 0 at top to (screen height - 1) at bottom. |
| h | Height of line, in pixels. |
| color | Line color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERSE. |
| void SSD1306_DrawFullImage | ( | const uint8_t * | ptr | ) |
Fill the whole screen by drawing a 128x64 bitmap image.
| ptr | Pointer to 1024-byte image with no header or format data. |
| void SSD1306_DrawPixel | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | color | ||
| ) |
Set/clear/invert a single pixel. This is also invoked by the Adafruit_GFX library in generating many higher-level graphics primitives.
| x | Column of display – 0 at left to (screen width - 1) at right. |
| y | Row of display – 0 at top to (screen height - 1) at bottom. |
| color | Pixel color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERT. |
| void SSD1306_DrawPoint | ( | int32_t | x, |
| int32_t | y | ||
| ) |
Set/clear/invert a single pixel. SSD1306_SetPlot initializes scaling.
| x | Column of display – minX at left to maxX at right. |
| y | Row of display – maxY at top to minY at bottom. |
| void SSD1306_DrawString | ( | int16_t | x, |
| int16_t | y, | ||
| char * | pt, | ||
| uint16_t | color | ||
| ) |
Draw a string.
| x | Column of display – 0 at left to (screen width - 1) at right. |
| y | Row of display – 0 at top to (screen height - 1) at bottom. |
| pt | pointer to null-terminated ASCII string of characters to draw. |
| color | Pixel color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERSE. |
| void SSD1306_DrawUDec | ( | int16_t | x, |
| int16_t | y, | ||
| uint16_t | n, | ||
| uint16_t | color | ||
| ) |
Draw a 3 digit integer.
| x | Column of display – 0 at left to (screen width - 1) at right. |
| y | Row of display – 0 at top to (screen height - 1) at bottom. |
| n | unsigned number 0 to 999. |
| color | Pixel color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERSE. |
| uint8_t* SSD1306_getBuffer | ( | void | ) |
Get base address of display buffer for direct reading or writing.
| int SSD1306_GetPixel | ( | int16_t | x, |
| int16_t | y | ||
| ) |
Return color of a single pixel in display buffer.
| x | Column of display – 0 at left to (screen width - 1) at right. |
| y | Row of display – 0 at top to (screen height -1) at bottom. |
| int SSD1306_Init | ( | int | vccst | ) |
II2 driver for SSD1306 OLED display.
Initialize OLED
| vccst | Vcc voltage parameter, uSSD1306_EXTERNALVCC or SSD1306_SWITCHCAPVCC |
| void SSD1306_InitPrintf | ( | void | ) |
Initialize the SSD1306 for printf.
| void SSD1306_InvertDisplay | ( | int | i | ) |
Enable or disable display invert mode (white-on-black vs black-on-white).
| i | If true, switch to invert mode (black-on-white), else normal mode (white-on-black). |
| void SSD1306_OutBuffer | ( | void | ) |
Copy all of RAM image to OLED. Use this command with SSD1306_ClearBuffer, and all Draw functions
| none |
| void SSD1306_OutChar | ( | char | data | ) |
Print a character to the OLED.
Print a character to the SSD1306 OLED. The character will be printed at the current cursor position, the cursor will automatically be updated, and it will wrap to the next row or back to the top if necessary. One blank column of pixels will be printed on one side of the character for readability. Since characters are 8 pixels tall and 6 pixels wide, 12 characters fit per row, and there are six rows.
| data | character to print |
| void SSD1306_OutClear | ( | void | ) |
Clear the LCD by writing zeros to the entire screen and reset the cursor to (0,0) (top left corner of screen).
| void SSD1306_OutHex7 | ( | uint8_t | n | ) |
Print one hex digit.
Output one hex digit to the SSD1306 OLED Just one character with no leading 0x
| n | unsigned number 0-15 to print |
| void SSD1306_OutSDec | ( | int16_t | n | ) |
Print a 16-bit signed number to the OLED.
Output a 16-bit number in signed decimal format with a fixed size of six right-justified digits of output.
| n | 16-bit signed number |
| void SSD1306_OutSFix1 | ( | int32_t | n | ) |
Print a 32-bit signed fixed-point number to the OLED.
Output a 32-bit number in signed 4-digit fixed point, 0.1 resolution fixed size of six right-justified characters.
numbers -9999 to 9999 printed as "-999.9" to "999.9"
| n | 32-bit signed number |
| void SSD1306_OutString | ( | char * | ptr | ) |
Print a string of characters to the OLED.
Print a string of characters to the SSD1306 OLED. The string will automatically wrap, so padding spaces may be needed to make the output look optimal.
| ptr | pointer to NULL-terminated ASCII string |
| void SSD1306_OutU3Fix1 | ( | uint16_t | n | ) |
Print a 16-bit unsigned fixed-point number to the OLED.
Output a 16-bit number in unsigned 4-digit fixed point, 0.1 resolution fixed size of five right-justified characters.
numbers 0 to 999 printed as " 0.0" to "999.9"
| n | 16-bit unsigned number |
| void SSD1306_OutUDec | ( | uint16_t | n | ) |
Print a 16-bit unsigned number to the OLED.
Output a 16-bit number in unsigned decimal format with a fixed size of five right-justified digits of output.
| n | 16-bit unsigned number |
| void SSD1306_OutUDec16 | ( | uint32_t | n | ) |
Print three decimal digits.
Output three decimal digits to the SSD1306 OLED. Prints 4 characters with leading space
| n | unsigned number 0-999 to print |
| void SSD1306_OutUDec2 | ( | uint32_t | n | ) |
Print two decimal digits.
Output two decimal digits to the SSD1306 OLED. Prints 2 characters without leading space
| n | unsigned number 0-99 to print |
| void SSD1306_OutUFix1 | ( | uint16_t | n | ) |
Print a 16-bit unsigned fixed-point number to the OLED.
Output a 16-bit number in unsigned 3-digit fixed point, 0.1 resolution fixed size of four right-justified characters.
numbers 0 to 999 printed as " 0.0" to "99.9"
| n | 16-bit unsigned number |
| void SSD1306_OutUHex32 | ( | uint32_t | n | ) |
Print 16 hex digits.
Output 16 hex digits to the SSD1306 OLED. Prints 16 characters with leading 0x
| n | unsigned 32-bit number to print |
| void SSD1306_OutUHex7 | ( | uint8_t | n | ) |
Print two hex digits.
Output two hex digits to the SSD1306 OLED. Prints 4 characters with leading 0x
| n | unsigned number 0-255 to print |
| void SSD1306_SetCursor | ( | uint16_t | newX, |
| uint16_t | newY | ||
| ) |
Move the cursor to the desired X- and Y-position. The next character will be printed here. X=0 is the leftmost column. Y=0 is the top row.
| newX | new X-position of the cursor (0<=newX<=20) |
| newY | new Y-position of the cursor (0<=newY<=7) |
| void SSD1306_SetPlot | ( | int32_t | minX, |
| int32_t | maxX, | ||
| int32_t | minY, | ||
| int32_t | maxY, | ||
| uint16_t | color | ||
| ) |
Initialize parameters for plotting.
| minX | minimum X value |
| maxX | maxamum X value |
| minY | minimum Y value |
| maxY | maxamum Y value |
| color | Pixel color, one of: SSD1306_BLACK, SSD1306_WHITE or SSD1306_INVERT. |
| void SSD1306_startscrolldiagleft | ( | uint8_t | start, |
| uint8_t | stop | ||
| ) |
Activate alternate diagonal scroll for all or part of the display.
| start | First row. |
| stop | Last row. |
| void SSD1306_startscrolldiagright | ( | uint8_t | start, |
| uint8_t | stop | ||
| ) |
Activate a diagonal scroll for all or part of the display.
| start | First row. |
| stop | Last row. |
| void SSD1306_startscrollleft | ( | uint8_t | start, |
| uint8_t | stop | ||
| ) |
Activate a left-handed scroll for all or part of the display.
| start | First row. |
| stop | Last row. |
| void SSD1306_startscrollright | ( | uint8_t | start, |
| uint8_t | stop | ||
| ) |
Activate a right-handed scroll for all or part of the display.
| start | First row. |
| stop | Last row. |
| void SSD1306_stopscroll | ( | void | ) |
Cease a previously-begun scrolling action.
| 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_DrawLine | ( | int32_t | x1, |
| int32_t | y1, | ||
| int32_t | x2, | ||
| int32_t | y2, | ||
| uint32_t | color | ||
| ) |
draw line
Draws an arbitrary line
Inputs: (x1,y1) is the start point
(x2,y2) is the end point
x coordinates range from 0 to 127, 0 is left, 79 is right
y coordinates range from 0 to 159, 0 is top, 159 is bottom
| x1 | x-position starting point |
| y1 | y-position starting point |
| x2 | x-position end point |
| y2 | y-position end point |
| color | is 16-bit 5-6-5 R, G, B format |
| 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 |
Initialize ST7735B color 128x160-pixel TFT LCD
| none |
| void ST7735_InitPrintf | ( | enum initRFlags | option | ) |
use ST7735 LCD to output from printf
Initialize the ST7735 for printf
| option | one of none,INITR_GREENTAB,INITR_REDTAB,INITR_BLACKTAB |
| void ST7735_InitPrintf | ( | void | ) |
Use ST7735 LCD to output from printf.
Initialize the ST7735 for printf. Stream printf data to ST7735 LCD
| 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
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_OutSDec2 | ( | int32_t | n, |
| uint32_t | l | ||
| ) |
Output a signed decimal.
Output a 32-bit number in signed decimal format. x Position is 14 y position determined by line number Color is ST7735_YELLOW.
| n | is 32-bit signed number to be transferred |
| l | is line number |
| 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
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 |
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 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
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
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 |
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 |
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
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 |
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 |