hardware driver separation

This commit is contained in:
sharandac
2020-08-26 15:20:44 +02:00
parent c335328ab4
commit d93c90e3c8
13 changed files with 42 additions and 28 deletions

View File

@@ -35,9 +35,11 @@ static uint8_t brightness = 0;
/*
*
*/
void display_setup( TTGOClass *ttgo ) {
void display_setup( void ) {
display_read_config();
TTGOClass *ttgo = TTGOClass::getWatch();
ttgo->openBL();
ttgo->bl->adjust( 0 );
ttgo->tft->setRotation( display_config.rotation / 90 );
@@ -46,7 +48,9 @@ void display_setup( TTGOClass *ttgo ) {
/*
* loop routine for handling IRQ in main loop
*/
void display_loop( TTGOClass *ttgo ) {
void display_loop( void ) {
TTGOClass *ttgo = TTGOClass::getWatch();
if ( !powermgm_get_event( POWERMGM_STANDBY ) && !powermgm_get_event( POWERMGM_SILENCE_WAKEUP )) {
if ( dest_brightness != brightness ) {
if ( brightness < dest_brightness ) {

View File

@@ -46,13 +46,13 @@
*
* @param ttgo pointer to an TTGOClass
*/
void display_setup( TTGOClass *ttgo );
void display_setup( void );
/*
* @brief display loop
*
* @param ttgo pointer to an TTGOClass
*/
void display_loop( TTGOClass *ttgo );
void display_loop( void );
/*
* @brief save config for display to spiffs
*/

View File

@@ -341,3 +341,13 @@ float pmu_get_coulumb_data( void ) {
TTGOClass *ttgo = TTGOClass::getWatch();
return( ttgo->power->getCoulombData() );
}
bool pmu_is_charging( void ) {
TTGOClass *ttgo = TTGOClass::getWatch();
return( ttgo->power->isChargeing() );
}
bool pmu_is_vbus_plug( void ) {
TTGOClass *ttgo = TTGOClass::getWatch();
return( ttgo->power->isVBUSPlug() );
}

View File

@@ -104,5 +104,7 @@
float pmu_get_battery_discharge_current( void );
float pmu_get_vbus_voltage( void );
float pmu_get_coulumb_data( void );
bool pmu_is_charging( void );
bool pmu_is_vbus_plug( void );
#endif // _PMU_H

View File

@@ -170,7 +170,7 @@ void powermgm_loop( void ) {
else {
pmu_loop();
bma_loop();
display_loop( ttgo );
display_loop();
}
}