Closed ohmytime closed 1 year ago
问题出在了偏移量上吗?我的也是ST7567
确切来说,只显示了上面8行,下面的都没显示。
I met this problem before, some ST7567 doesn't support row/page shift, so the following code might not work
void ST7567_UpdateScreen(void)
{
ST7567_WriteCommand(ST7567_SET_PAGE_ADDRESS | (0x00 & ST7567_SET_PAGE_ADDRESS_MASK));
ST7567_WriteCommand(ST7567_SET_COLUMN_ADDRESS_MSB);
ST7567_WriteCommand(ST7567_SET_COLUMN_ADDRESS_LSB);
ST7567_Transmit(ST7567_Buffer_all, sizeof(ST7567_Buffer_all), ST7567_TIMEOUT);
}
You need to update it page by page like this. The following code might not work out-of-box, just for your reference.
void ST7567_UpdateScreen(void)
{
uint8_t i = 0, *pt = ST7567_Buffer_all;
for (i = 0; i < ST7567_PAGES; i++)
{
ST7567_WriteCommand(ST7567_SET_PAGE_ADDRESS|(i & ST7567_SET_PAGE_ADDRESS_MASK));
ST7567_WriteCommand(ST7567_SET_COLUMN_ADDRESS_MSB|(ST7567_X_OFFSET >> 4));
ST7567_WriteCommand(ST7567_SET_COLUMN_ADDRESS_LSB|(ST7567_X_OFFSET & 0x0F));
ST7567_Transmit(pt + (ST7567_WIDTH * i), ST7567_WIDTH, ST7567_TIMEOUT);
}
}
Thank you for your Tips ~
After I use your reference code, the screen can be fully displayed, but a new problem has appeared, It seems to be displayed a bit misplaced.
Adjust the following configurations, depends on your hardware and display mode
// Additional bytes in each row
#define ST7567_SEG_EXPAND 4
// X orientation
#define ST7567_X_ORIENT ST7567_SEG_DIRECTION_REVERSE
// Y orientation
#define ST7567_Y_ORIENT ST7567_COM_DIRECTION_NORMAL
and
#if ST7567_X_ORIENT == ST7567_SEG_DIRECTION_REVERSE
#define ST7567_X_OFFSET ST7567_SEG_EXPAND
#else
#define ST7567_X_OFFSET 0
#endif
Adjust the following configurations, depends on your hardware and display mode
// Additional bytes in each row #define ST7567_SEG_EXPAND 4 // X orientation #define ST7567_X_ORIENT ST7567_SEG_DIRECTION_REVERSE // Y orientation #define ST7567_Y_ORIENT ST7567_COM_DIRECTION_NORMAL
and
#if ST7567_X_ORIENT == ST7567_SEG_DIRECTION_REVERSE #define ST7567_X_OFFSET ST7567_SEG_EXPAND #else #define ST7567_X_OFFSET 0 #endif
Thank you so much for your fast reply, I will try.
I change it to this,finally it works.
// Additional bytes in each row
#define ST7567_SEG_EXPAND 0
// X orientation
#define ST7567_X_ORIENT ST7567_SEG_DIRECTION_NORMAL
// Y orientation
// #define ST7567_Y_ORIENT ST7567_COM_DIRECTION_NORMAL
#define ST7567_Y_ORIENT ST7567_COM_DIRECTION_REVERSE
Cool!
Thanks a lot for your open source library, it's very cool !
You are welcome.
看起来只有上面一点能显示出来想要的字符 下图是我用Fill(1)的结果