-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ST7796S Support #169
base: master
Are you sure you want to change the base?
Changes from all commits
df12bf7
06fee16
0158ecc
85deb58
92cb5d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#include "config.h" | ||
|
||
#if defined(ST7735R) || defined(ST7735S) || defined(ST7789) | ||
#if defined(ST7735R) || defined(ST7735S) || defined(ST7789) || defined(ST7796S) | ||
|
||
#include "spi.h" | ||
|
||
|
@@ -62,6 +61,10 @@ void InitST7735R() | |
madctl ^= MADCTL_ROTATE_180_DEGREES; | ||
#endif | ||
|
||
#if defined(ST7796S) | ||
madctl ^= MADCTL_COLUMN_ADDRESS_ORDER_SWAP; | ||
#endif | ||
|
||
#ifdef DISPLAY_ROTATE_180_DEGREES | ||
madctl ^= MADCTL_ROTATE_180_DEGREES; | ||
#endif | ||
|
@@ -96,10 +99,15 @@ void InitST7735R() | |
#endif | ||
|
||
// TODO: The 0xB1 command is not Frame Rate Control for ST7789VW, 0xB3 is (add support to it) | ||
#ifndef ST7789VW | ||
#if !defined(ST7789VW) || !defined(ST7796S) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
// Frame rate = 850000 / [ (2*RTNA+40) * (162 + FPA+BPA)] | ||
SPI_TRANSFER(0xB1/*FRMCTR1:Frame Rate Control*/, /*RTNA=*/6, /*FPA=*/1, /*BPA=*/1); // This should set frame rate = 99.67 Hz | ||
#endif | ||
// The frame rate control on the ST7796S needs different values in order to work correctly. Borrowing these values | ||
// from the device tree files of the MHS-4.0 inch hat device tree files. They fix all the problems I was having. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps change this comment to
since a comment |
||
#ifdef ST7796S | ||
SPI_TRANSFER(0xB1, 0x80, 0x10); | ||
#endif | ||
|
||
SPI_TRANSFER(/*Display ON*/0x29); | ||
usleep(100 * 1000); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needing to have this in here seems odd. Is this making the display landscape by default? Or portrait? The panel is a portrait scaning panel, according to the DISPLAY_NATIVE_WIDTH/HEIGHT fields from below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's been a few weeks, but I believe that I added this because without it the display was mirrored.