Small code modification

This commit is contained in:
Marián 2022-12-07 15:53:48 +01:00 committed by GitHub
parent a9e421d5ff
commit f1845d86ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,24 +150,24 @@ uint8_t SSD1306_Init (void)
// -------------------------------------------------------------------------------------
TWI_Init ();
// TWI Start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// MAIN LOOP
// SEND COMMAND & ARGUMENTS
// -------------------------------------------------------------------------------------
while (no_of_commands) { // commands loop
no_of_arguments = pgm_read_byte (commands++); // number of arguments
command = pgm_read_byte (commands++); // command
// SEND COMMAND
// Send commands
// -----------------------------------------------------------------------------------
status = SSD1306_Send_Command (command); // send command
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// SEND ARGUMENTS
// Send arguments
// -----------------------------------------------------------------------------------
while (no_of_arguments--) {
status = SSD1306_Send_Command (pgm_read_byte(commands++)); // send argument
@ -175,7 +175,6 @@ uint8_t SSD1306_Init (void)
return status; // error
}
}
no_of_commands--; // next command
}
// TWI STOP
@ -202,7 +201,7 @@ uint8_t SSD1306_Send_StartAndSLAW (uint8_t address)
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// TWI start & SLAW
// TWI SLAW
// -------------------------------------------------------------------------------------
status = TWI_MT_Send_SLAW (address); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -250,7 +249,7 @@ uint8_t SSD1306_NormalScreen (void)
{
uint8_t status = INIT_STATUS; // TWI init status 0xFF
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -262,6 +261,9 @@ uint8_t SSD1306_NormalScreen (void)
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();
return SSD1306_SUCCESS; // success
}
@ -277,7 +279,7 @@ uint8_t SSD1306_InverseScreen (void)
{
uint8_t status = INIT_STATUS; // TWI init status 0xFF
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -289,6 +291,9 @@ uint8_t SSD1306_InverseScreen (void)
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();
return SSD1306_SUCCESS; // success
}
@ -305,7 +310,7 @@ uint8_t SSD1306_ClearScreen (void)
uint8_t status = INIT_STATUS; // TWI init status 0xFF
uint16_t i = 0; // counter
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -326,7 +331,7 @@ uint8_t SSD1306_ClearScreen (void)
}
i++; // update counter
}
// TWI stop
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();
@ -345,7 +350,7 @@ uint8_t SSD1306_SetPosition (uint8_t x, uint8_t y)
{
uint8_t status = INIT_STATUS; // TWI init status 0xFF
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -381,7 +386,8 @@ uint8_t SSD1306_SetPosition (uint8_t x, uint8_t y)
return status; // error
}
_indexPage = y; // update column index
// TWI stop
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();
@ -442,7 +448,8 @@ uint8_t SSD1306_DrawChar (char ch)
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -471,7 +478,7 @@ uint8_t SSD1306_DrawChar (char ch)
}
_indexCol = _indexCol + CHARS_COLS_LENGTH + 1; // update global col
// TWI stop
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();
@ -516,7 +523,7 @@ uint8_t SSD1306_DrawPixel (uint8_t x, uint8_t y)
return SSD1306_ERROR; // error
}
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -566,7 +573,8 @@ uint8_t SSD1306_DrawPixel (uint8_t x, uint8_t y)
if (SSD1306_SUCCESS != status) { // check status
return status; // error
}
// TWI stop
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();
@ -611,7 +619,7 @@ uint8_t SSD1306_DrawLineHorz (uint8_t y, uint8_t x1, uint8_t x2)
}
i++; // next page
}
// TWI start & SLAW
// TWI START & SLAW
// -------------------------------------------------------------------------------------
status = SSD1306_Send_StartAndSLAW (SSD1306_ADDR); // start & SLAW
if (SSD1306_SUCCESS != status) { // check status
@ -670,7 +678,8 @@ uint8_t SSD1306_DrawLineHorz (uint8_t y, uint8_t x1, uint8_t x2)
j = 0; // null x counter
i++; // next page
}
// TWI stop
// TWI STOP
// -------------------------------------------------------------------------------------
TWI_Stop ();