Small code modification

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

View File

@ -357,38 +357,30 @@ uint8_t SSD1306_SetPosition (uint8_t x, uint8_t y)
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// start COLUMN status = SSD1306_Send_Command (x); // start COLUMN
status = SSD1306_Send_Command (x);
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// end COLUMN status = SSD1306_Send_Command (END_COLUMN_ADDR); // end COLUMN
status = SSD1306_Send_Command (END_COLUMN_ADDR); // 127
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// update column index _indexCol = x; // update column index
_indexCol = x;
// PAGE // PAGE
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
status = SSD1306_Send_Command (SSD1306_SET_PAGE_ADDR); // 0x22 status = SSD1306_Send_Command (SSD1306_SET_PAGE_ADDR); // 0x22
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// start PAGE status = SSD1306_Send_Command (y); // start PAGE
status = SSD1306_Send_Command (y);
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// end PAGE status = SSD1306_Send_Command (END_PAGE_ADDR); // end PAGE
status = SSD1306_Send_Command (END_PAGE_ADDR); // 7 for 128x64
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// update column index _indexPage = y; // update column index
_indexPage = y;
// TWI stop // TWI stop
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
TWI_Stop (); TWI_Stop ();
@ -477,7 +469,6 @@ uint8_t SSD1306_DrawChar (char ch)
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
_indexCol = _indexCol + CHARS_COLS_LENGTH + 1; // update global col _indexCol = _indexCol + CHARS_COLS_LENGTH + 1; // update global col
// TWI stop // TWI stop
@ -547,7 +538,6 @@ uint8_t SSD1306_DrawPixel (uint8_t x, uint8_t y)
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// PAGE // PAGE
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
status = SSD1306_Send_Command (SSD1306_SET_PAGE_ADDR); // 0x22 status = SSD1306_Send_Command (SSD1306_SET_PAGE_ADDR); // 0x22
@ -564,20 +554,18 @@ uint8_t SSD1306_DrawPixel (uint8_t x, uint8_t y)
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// TWI control byte data stream // TWI control byte data stream
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
status = TWI_MT_Send_Data (SSD1306_DATA); // send data 0xC0 status = TWI_MT_Send_Data (SSD1306_DATA); // send data 0xC0
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// send clear byte to memory lcd // PIXEL
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
status = TWI_MT_Send_Data (pixel); // send pixel status = TWI_MT_Send_Data (pixel); // send pixel
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// TWI stop // TWI stop
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
TWI_Stop (); TWI_Stop ();
@ -667,7 +655,7 @@ uint8_t SSD1306_DrawLineHorz (uint8_t y, uint8_t x1, uint8_t x2)
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
// send pixels // PIXELS
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
i = 0; i = 0;
j = 0; j = 0;
@ -677,7 +665,7 @@ uint8_t SSD1306_DrawLineHorz (uint8_t y, uint8_t x1, uint8_t x2)
if (SSD1306_SUCCESS != status) { // check status if (SSD1306_SUCCESS != status) { // check status
return status; // error return status; // error
} }
j++; j++; // next column
} }
j = 0; // null x counter j = 0; // null x counter
i++; // next page i++; // next page