diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-06-27 16:38:28 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-06-27 16:38:28 +0200 |
commit | 98b9909429aea0869f7a6f2f44ab386a4a3ff094 (patch) | |
tree | e1080a61bb89a75edc70818489f8044adf597c48 /keyboards/tzarc/djinn/djinn_usbpd.c | |
parent | b610965fd6d851484025166fb255078b1c809261 (diff) | |
parent | fa3dd373b4925734d9843ae6014349069ffec353 (diff) | |
download | qmk_firmware-98b9909429aea0869f7a6f2f44ab386a4a3ff094.tar.gz qmk_firmware-98b9909429aea0869f7a6f2f44ab386a4a3ff094.zip |
Merge branch 'master' into taamas
Diffstat (limited to 'keyboards/tzarc/djinn/djinn_usbpd.c')
-rw-r--r-- | keyboards/tzarc/djinn/djinn_usbpd.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/keyboards/tzarc/djinn/djinn_usbpd.c b/keyboards/tzarc/djinn/djinn_usbpd.c new file mode 100644 index 0000000000..b0bf166b7c --- /dev/null +++ b/keyboards/tzarc/djinn/djinn_usbpd.c @@ -0,0 +1,28 @@ +// Copyright 2018-2022 Nick Brassel (@tzarc) +// SPDX-License-Identifier: GPL-2.0-or-later +#include <string.h> +#include "quantum.h" +#include "djinn.h" + +const char* usbpd_str(usbpd_allowance_t allowance) { + switch (allowance) { + default: + case USBPD_500MA: + return "500mA"; + case USBPD_1500MA: + return "1500mA"; + case USBPD_3000MA: + return "3000mA"; + } +} + +void usbpd_update(void) { + static uint32_t last_read = 0; + if (timer_elapsed32(last_read) > 250) { + usbpd_allowance_t allowance = usbpd_get_allowance(); + if (kb_state.current_setting != allowance) { + dprintf("Transitioning UCPD1 %s -> %s\n", usbpd_str(kb_state.current_setting), usbpd_str(allowance)); + kb_state.current_setting = allowance; + } + } +}
\ No newline at end of file |