mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-24 01:28:11 -07:00
LCD Inversion refactoring
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include <string.h>
|
||||
|
||||
/*============================================*/
|
||||
|
||||
void u8g2_ClearBuffer(u8g2_t* u8g2) {
|
||||
size_t cnt;
|
||||
cnt = u8g2_GetU8x8(u8g2)->display_info->tile_width;
|
||||
@@ -45,13 +46,6 @@ void u8g2_ClearBuffer(u8g2_t* u8g2) {
|
||||
memset(u8g2->tile_buf_ptr, 0, cnt);
|
||||
}
|
||||
|
||||
void u8g2_FillBuffer(u8g2_t* u8g2) {
|
||||
size_t cnt;
|
||||
cnt = u8g2_GetU8x8(u8g2)->display_info->tile_width;
|
||||
cnt *= u8g2->tile_buf_height;
|
||||
cnt *= 8;
|
||||
memset(u8g2->tile_buf_ptr, 255, cnt);
|
||||
}
|
||||
/*============================================*/
|
||||
|
||||
static void u8g2_send_tile_row(u8g2_t* u8g2, uint8_t src_tile_row, uint8_t dest_tile_row) {
|
||||
|
||||
@@ -280,3 +280,17 @@ void u8g2_Setup_st756x_flipper(
|
||||
buf = u8g2_m_16_8_f(&tile_buf_height);
|
||||
u8g2_SetupBuffer(u8g2, buf, tile_buf_height, u8g2_ll_hvline_vertical_top_lsb, rotation);
|
||||
}
|
||||
|
||||
void u8x8_d_st756x_set_inversion(u8x8_t* u8x8, bool arg) {
|
||||
// if arg is true - set last bit to 1 (inversion ON)
|
||||
if(arg) {
|
||||
u8x8_cad_StartTransfer(u8x8);
|
||||
u8x8_cad_SendCmd(u8x8, ST756X_CMD_INVERSE_DISPLAY | 0b01);
|
||||
u8x8_cad_EndTransfer(u8x8);
|
||||
// else use standart command with 0 in last bit
|
||||
} else {
|
||||
u8x8_cad_StartTransfer(u8x8);
|
||||
u8x8_cad_SendCmd(u8x8, ST756X_CMD_INVERSE_DISPLAY);
|
||||
u8x8_cad_EndTransfer(u8x8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,3 +16,5 @@ void u8g2_Setup_st756x_flipper(
|
||||
void u8x8_d_st756x_init(u8x8_t* u8x8, uint8_t contrast, uint8_t regulation_ratio, bool bias);
|
||||
|
||||
void u8x8_d_st756x_set_contrast(u8x8_t* u8x8, int8_t contrast_offset);
|
||||
|
||||
void u8x8_d_st756x_set_inversion(u8x8_t* u8x8, bool arg);
|
||||
Reference in New Issue
Block a user