TM STM32Fxxx HAL Libraries  v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle
TM_SSD1306_Functions

Library Functions. More...

Functions

uint8_t TM_SSD1306_Init (void)
 Initializes SSD1306 LCD. More...
 
void TM_SSD1306_UpdateScreen (void)
 Updates buffer from internal RAM to LCD. More...
 
void TM_SSD1306_ToggleInvert (void)
 Toggles pixels invertion inside internal RAM. More...
 
void TM_SSD1306_Fill (SSD1306_COLOR_t Color)
 Fills entire LCD with desired color. More...
 
void TM_SSD1306_DrawPixel (uint16_t x, uint16_t y, SSD1306_COLOR_t color)
 Draws pixel at desired location. More...
 
void TM_SSD1306_GotoXY (uint16_t x, uint16_t y)
 Sets cursor pointer to desired location for strings. More...
 
char TM_SSD1306_Putc (char ch, TM_FONT_t *Font, SSD1306_COLOR_t color)
 Puts character to internal RAM. More...
 
char TM_SSD1306_Puts (char *str, TM_FONT_t *Font, SSD1306_COLOR_t color)
 Puts string to internal RAM. More...
 
void TM_SSD1306_DrawLine (uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, SSD1306_COLOR_t c)
 Draws line on LCD. More...
 
void TM_SSD1306_DrawRectangle (uint16_t x, uint16_t y, uint16_t w, uint16_t h, SSD1306_COLOR_t c)
 Draws rectangle on LCD. More...
 
void TM_SSD1306_DrawFilledRectangle (uint16_t x, uint16_t y, uint16_t w, uint16_t h, SSD1306_COLOR_t c)
 Draws filled rectangle on LCD. More...
 
void TM_SSD1306_DrawTriangle (uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t x3, uint16_t y3, SSD1306_COLOR_t color)
 Draws triangle on LCD. More...
 
void TM_SSD1306_DrawCircle (int16_t x0, int16_t y0, int16_t r, SSD1306_COLOR_t c)
 Draws circle to STM buffer. More...
 
void TM_SSD1306_DrawFilledCircle (int16_t x0, int16_t y0, int16_t r, SSD1306_COLOR_t c)
 Draws filled circle to STM buffer. More...
 

Detailed Description

Library Functions.

Function Documentation

void TM_SSD1306_DrawCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
SSD1306_COLOR_t  c 
)

Draws circle to STM buffer.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
xX location for center of circle. Valid input is 0 to SSD1306_WIDTH - 1
yY location for center of circle. Valid input is 0 to SSD1306_HEIGHT - 1
rCircle radius in units of pixels
cColor to be used. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_DrawFilledCircle ( int16_t  x0,
int16_t  y0,
int16_t  r,
SSD1306_COLOR_t  c 
)

Draws filled circle to STM buffer.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
xX location for center of circle. Valid input is 0 to SSD1306_WIDTH - 1
yY location for center of circle. Valid input is 0 to SSD1306_HEIGHT - 1
rCircle radius in units of pixels
cColor to be used. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_DrawFilledRectangle ( uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h,
SSD1306_COLOR_t  c 
)

Draws filled rectangle on LCD.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
xTop left X start point. Valid input is 0 to SSD1306_WIDTH - 1
yTop left Y start point. Valid input is 0 to SSD1306_HEIGHT - 1
wRectangle width in units of pixels
hRectangle height in units of pixels
cColor to be used. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_DrawLine ( uint16_t  x0,
uint16_t  y0,
uint16_t  x1,
uint16_t  y1,
SSD1306_COLOR_t  c 
)

Draws line on LCD.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
x0Line X start point. Valid input is 0 to SSD1306_WIDTH - 1
y0Line Y start point. Valid input is 0 to SSD1306_HEIGHT - 1
x1Line X end point. Valid input is 0 to SSD1306_WIDTH - 1
y1Line Y end point. Valid input is 0 to SSD1306_HEIGHT - 1
cColor to be used. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_DrawPixel ( uint16_t  x,
uint16_t  y,
SSD1306_COLOR_t  color 
)

Draws pixel at desired location.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
xX location. This parameter can be a value between 0 and SSD1306_WIDTH - 1
yY location. This parameter can be a value between 0 and SSD1306_HEIGHT - 1
colorColor to be used for screen fill. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_DrawRectangle ( uint16_t  x,
uint16_t  y,
uint16_t  w,
uint16_t  h,
SSD1306_COLOR_t  c 
)

Draws rectangle on LCD.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
xTop left X start point. Valid input is 0 to SSD1306_WIDTH - 1
yTop left Y start point. Valid input is 0 to SSD1306_HEIGHT - 1
wRectangle width in units of pixels
hRectangle height in units of pixels
cColor to be used. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_DrawTriangle ( uint16_t  x1,
uint16_t  y1,
uint16_t  x2,
uint16_t  y2,
uint16_t  x3,
uint16_t  y3,
SSD1306_COLOR_t  color 
)

Draws triangle on LCD.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
x1First coordinate X location. Valid input is 0 to SSD1306_WIDTH - 1
y1First coordinate Y location. Valid input is 0 to SSD1306_HEIGHT - 1
x2Second coordinate X location. Valid input is 0 to SSD1306_WIDTH - 1
y2Second coordinate Y location. Valid input is 0 to SSD1306_HEIGHT - 1
x3Third coordinate X location. Valid input is 0 to SSD1306_WIDTH - 1
y3Third coordinate Y location. Valid input is 0 to SSD1306_HEIGHT - 1
cColor to be used. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_Fill ( SSD1306_COLOR_t  Color)

Fills entire LCD with desired color.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
ColorColor to be used for screen fill. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
None
void TM_SSD1306_GotoXY ( uint16_t  x,
uint16_t  y 
)

Sets cursor pointer to desired location for strings.

Parameters
xX location. This parameter can be a value between 0 and SSD1306_WIDTH - 1
yY location. This parameter can be a value between 0 and SSD1306_HEIGHT - 1
Return values
None
uint8_t TM_SSD1306_Init ( void  )

Initializes SSD1306 LCD.

Parameters
None
Return values
Initializationstatus:
  • 0: LCD was not detected on I2C port
  • > 0: LCD initialized OK and ready to use
char TM_SSD1306_Putc ( char  ch,
TM_FONT_t Font,
SSD1306_COLOR_t  color 
)

Puts character to internal RAM.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
chCharacter to be written
*FontPointer to TM_FONT_t structure with used font
colorColor used for drawing. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
Characterwritten
char TM_SSD1306_Puts ( char *  str,
TM_FONT_t Font,
SSD1306_COLOR_t  color 
)

Puts string to internal RAM.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
*strString to be written
*FontPointer to TM_FONT_t structure with used font
colorColor used for drawing. This parameter can be a value of SSD1306_COLOR_t enumeration
Return values
Zeroon success or character value when function failed
void TM_SSD1306_ToggleInvert ( void  )

Toggles pixels invertion inside internal RAM.

Note
TM_SSD1306_UpdateScreen() must be called after that in order to see updated LCD screen
Parameters
None
Return values
None
void TM_SSD1306_UpdateScreen ( void  )

Updates buffer from internal RAM to LCD.

Note
This function must be called each time you do some changes to LCD, to update buffer from RAM to LCD
Parameters
None
Return values
None