Skip to content

Commit

Permalink
T-Embed power management
Browse files Browse the repository at this point in the history
  • Loading branch information
bmorcelli committed Nov 6, 2024
1 parent 543804b commit 00751c9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"string_view": "cpp",
"initializer_list": "cpp",
"regex": "cpp",
"*.tpp": "cpp"
"*.tpp": "cpp",
"list": "cpp"
},
"cmake.sourceDirectory": "C:/Projetos/M5Stick-Launcher/lib/M5GFX"
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ Sourcecode will be released in the future..
* UiFlow 1 doesn´t work with Launcher.. it uses an old MicroPython distro, that uses an old ESP-IDF distro with lots os secrets that I couldn´t figure out.

## Changelog
* 2.3.2:
* [x] T-Embed CC1101 power chip management fix
* 2.3.1:
* [x] Fox for https://github.com/bmorcelli/M5Stick-Launcher/issues/77
* [x] Fixed screen direction for T-Deck devices
Expand Down
10 changes: 5 additions & 5 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ default_envs =

[common]
build_flags =
-DLAUNCHER='"2.3.0"'
-DLAUNCHER='"2.3.2"'
-DMAXFILES=256
-DEEPROMSIZE=128
-DLH=8
Expand Down Expand Up @@ -1190,8 +1190,8 @@ build_flags =

lib_deps =
${common.lib_deps}
https://github.com/lewisxhe/XPowersLib
https://github.com/mathertel/RotaryEncoder
lewisxhe/XPowersLib @ ^0.2.6
mathertel/RotaryEncoder @ ^1.5.3


[env:lilygo-t-embed-cc1101]
Expand Down Expand Up @@ -1275,5 +1275,5 @@ build_flags =

lib_deps =
${common.lib_deps}
https://github.com/lewisxhe/XPowersLib
https://github.com/mathertel/RotaryEncoder
lewisxhe/XPowersLib @ ^0.2.6
mathertel/RotaryEncoder @ ^1.5.3
33 changes: 16 additions & 17 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,23 +220,22 @@ void setup() {
#ifdef T_EMBED_1101
pinMode(PIN_POWER_ON, OUTPUT);
digitalWrite(PIN_POWER_ON, HIGH); // Power on CC1101 and LED
PPM.init(Wire,8,18,BQ25896_SLAVE_ADDRESS);
// Set the minimum operating voltage. Below this voltage, the PPM will protect
PPM.setSysPowerDownVoltage(3300);
// Set input current limit, default is 500mA
PPM.setInputCurrentLimit(3250);
// Disable current limit pin
PPM.disableCurrentLimitPin();
// Set the charging target voltage, Range:3840 ~ 4608mV ,step:16 mV
PPM.setChargeTargetVoltage(4208);
// Set the precharge current , Range: 64mA ~ 1024mA ,step:64mA
PPM.setPrechargeCurr(64);
// The premise is that Limit Pin is disabled, or it will only follow the maximum charging current set by Limi tPin.
// Set the charging current , Range:0~5056mA ,step:64mA
PPM.setChargerConstantCurr(832);
// Get the set charging current
PPM.getChargerConstantCurr();
Serial.printf("getChargerConstantCurr: %d mA\n",PPM.getChargerConstantCurr());
bool pmu_ret = false;
Wire.begin(8, 18);
pmu_ret = PPM.init(Wire, 8, 18, BQ25896_SLAVE_ADDRESS);
if(pmu_ret) {
PPM.setSysPowerDownVoltage(3300);
PPM.setInputCurrentLimit(3250);
Serial.printf("getInputCurrentLimit: %d mA\n",PPM.getInputCurrentLimit());
PPM.disableCurrentLimitPin();
PPM.setChargeTargetVoltage(4208);
PPM.setPrechargeCurr(64);
PPM.setChargerConstantCurr(832);
PPM.getChargerConstantCurr();
Serial.printf("getChargerConstantCurr: %d mA\n",PPM.getChargerConstantCurr());
PPM.enableADCMeasure();
PPM.enableCharge();
}


// To obtain voltage data, the ADC must be enabled first
Expand Down

0 comments on commit 00751c9

Please sign in to comment.