mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-25 17:09:44 +00:00
WIP - feat(core/prodtest): add wpc control commands
[no changelog]
This commit is contained in:
parent
7a6d28a2d0
commit
3f4efa9ce9
@ -79,6 +79,7 @@
|
||||
|
||||
#ifdef USE_POWERCTL
|
||||
#include "../../sys/powerctl/npm1300/npm1300.h"
|
||||
#include "../../sys/powerctl/stwlc38/stwlc38.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_STORAGE_HWKEY
|
||||
@ -939,6 +940,52 @@ void test_pmic(const char *args) {
|
||||
}
|
||||
}
|
||||
|
||||
void test_wpc(const char *args) {
|
||||
stwlc38_init();
|
||||
|
||||
stwlc38_status_t status;
|
||||
|
||||
if (strcmp(args, "EN") == 0) {
|
||||
if (!stwlc38_enable(true)) {
|
||||
vcp_println("ERROR # STWLC38 not initialized");
|
||||
return;
|
||||
}
|
||||
vcp_println("OK");
|
||||
} else if (strcmp(args, "DIS") == 0) {
|
||||
if (!stwlc38_enable(false)) {
|
||||
vcp_println("ERROR # STWLC38 not initialized");
|
||||
return;
|
||||
}
|
||||
vcp_println("OK");
|
||||
} else if (strcmp(args, "VEN") == 0) {
|
||||
if (!stwlc38_enable_vout(true)) {
|
||||
vcp_println("ERROR # STWLC38 not initialized");
|
||||
return;
|
||||
}
|
||||
vcp_println("OK");
|
||||
} else if (strcmp(args, "VDIS") == 0) {
|
||||
if (!stwlc38_enable_vout(false)) {
|
||||
vcp_println("ERROR # STWLC38 not initialized");
|
||||
return;
|
||||
}
|
||||
vcp_println("OK");
|
||||
} else {
|
||||
if (!stwlc38_get_status(&status)) {
|
||||
vcp_println("ERROR # STWLC38 not initialized");
|
||||
return;
|
||||
} else {
|
||||
vcp_println("# ready = %d", status.ready);
|
||||
vcp_println("# vout_ready = %d", status.vout_ready);
|
||||
vcp_println("# vrect = %d", status.vrect);
|
||||
vcp_println("# vout = %d", status.vout);
|
||||
vcp_println("# icur = %d", status.icur);
|
||||
vcp_println("# tmeas = %d", status.tmeas);
|
||||
vcp_println("# opfreq = %d", status.opfreq);
|
||||
vcp_println("# ntc = %d", status.ntc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define BACKLIGHT_NORMAL 150
|
||||
|
||||
int main(void) {
|
||||
@ -1106,6 +1153,10 @@ int main(void) {
|
||||
test_pmic(line + 5);
|
||||
} else if (startswith(line, "PMIC")) {
|
||||
test_pmic(line + 4);
|
||||
} else if (startswith(line, "WPC ")) {
|
||||
test_wpc(line + 4);
|
||||
} else if (startswith(line, "WPC")) {
|
||||
test_wpc(line + 3);
|
||||
} else {
|
||||
vcp_println("UNKNOWN");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user