Add power tracking api, to lufa only (not exactly what is trying to go into develop...
[jackhill/qmk/firmware.git] / quantum / power.h
1 /*
2 * Copyright 2021 Andrei Purdea <andrei@purdea.ro>
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #pragma once
19
20 #include "quantum.h"
21
22 void power_set_configuration(bool isConfigured, uint8_t configurationNumber);
23 void power_set_suspend(bool isConfigured, uint8_t configurationNumber);
24 void power_set_resume(bool isConfigured, uint8_t configurationNumber);
25 void power_set_reset(void);
26 void power_init(void);
27
28 enum power_state {
29 POWER_STATE_INIT = 0, // Can consume up to 100mA
30 POWER_STATE_CONFIGURED = 1, // Can consume up to what is specified in configuration descriptor, typically 500mA
31 POWER_STATE_SUSPEND = 2 // Can consume only suspend current
32 };
33
34 extern enum power_state power_state;
35
36 void notify_power_state_change_kb(void);