Skip to content

Commit

Permalink
Brightness on CYDs
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorcelli committed Nov 26, 2024
1 parent 52ac302 commit bb2ae91
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ports/CYD-2432S028/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ 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
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 @@ -160,6 +160,13 @@ void get_partition_sizes() {
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
** Where the devices are started and variables set
Expand Down Expand Up @@ -284,6 +291,9 @@ void setup() {
TouchFooter2();
#endif


_post_setup_gpio();

//Start Bootscreen timer
int i = millis();
int j = 0;
Expand Down

0 comments on commit bb2ae91

Please sign in to comment.