Skip to content

Commit

Permalink
Merge pull request #486 from bmorcelli/main
Browse files Browse the repository at this point in the history
CYD brightness Control and powersave fix
  • Loading branch information
pr3y authored Nov 26, 2024
2 parents d2b795a + 87cd2aa commit ecaeff8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ports/CYD-2432S028/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,16 @@ void _setup_gpio() {
log_i("Touch IC not Started");
} else log_i("Touch IC Started");
digitalWrite(XPT2046_CS, LOW);
// Brightness control -> Not working yet, don't know why! @Pirata

}

/***************************************************************************************
** Function name: _post_setup_gpio()
** Location: main.cpp
** Description: second stage gpio setup to make a few functions work
***************************************************************************************/
void _post_setup_gpio() {
// Brightness control must be initialized after tft in this case @Pirata
pinMode(TFT_BL,OUTPUT);
ledcSetup(TFT_BRIGHT_CHANNEL,TFT_BRIGHT_FREQ, TFT_BRIGHT_Bits); //Channel 0, 10khz, 8bits
ledcAttachPin(TFT_BL, TFT_BRIGHT_CHANNEL);
Expand Down Expand Up @@ -169,6 +178,7 @@ bool checkPrevPress() {
** Verifies if Select or OK was pressed
**********************************************************************/
bool checkSelPress() {
checkPowerSaveTime();
if(menuPress(SEL)) {
if(wakeUpScreen()) {
delay(200);
Expand Down
6 changes: 6 additions & 0 deletions ports/CYD-2432S028/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
***************************************************************************************/
void _setup_gpio();

/***************************************************************************************
** Function name: _post_setup_gpio()
** Location: main.cpp
** Description: second stage gpio setup to make a few functions work
***************************************************************************************/
void _post_setup_gpio();

/***************************************************************************************
** Function name: getBattery()
Expand Down
6 changes: 6 additions & 0 deletions ports/_New-Device-Model/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
***************************************************************************************/
void _setup_gpio() { }

/***************************************************************************************
** Function name: _post_setup_gpio()
** Location: main.cpp
** Description: second stage gpio setup to make a few functions work
***************************************************************************************/
void _post_setup_gpio() { }

/***************************************************************************************
** Function name: getBattery()
Expand Down
6 changes: 6 additions & 0 deletions ports/_New-Device-Model/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
***************************************************************************************/
void _setup_gpio();

/***************************************************************************************
** Function name: _post_setup_gpio()
** Location: main.cpp
** Description: second stage gpio setup to make a few functions work
***************************************************************************************/
void _post_setup_gpio();

/***************************************************************************************
** Function name: getBattery()
Expand Down
10 changes: 10 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ void begin_storage() {
void _setup_gpio() __attribute__((weak));
void _setup_gpio() { }

/*********************************************************************
** Function: _post_setup_gpio()
** Sets up a weak (empty) function to be replaced by /ports/* /interface.h
*********************************************************************/
void _post_setup_gpio() __attribute__((weak));
void _post_setup_gpio() { }

/*********************************************************************
** Function: setup_gpio
** Setup GPIO pins
Expand Down Expand Up @@ -264,6 +271,9 @@ void setup() {

init_clock();

// Some GPIO Settings (such as CYD's brightness control must be set after tft and sdcard)
_post_setup_gpio();
// end of post gpio begin
boot_screen_anim();

startup_sound();
Expand Down

0 comments on commit ecaeff8

Please sign in to comment.