-
-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathNicla_System.h
53 lines (42 loc) · 1.14 KB
/
Nicla_System.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef Nicla_System_h_
#define Nicla_System_h_
#include "Arduino.h"
#include "BQ25120A.h"
#include "RGBled.h"
#include <mbed.h>
#include <I2C.h>
#define USE_FASTCHG_TO_KICK_WATCHDOG 1
#define BATTERY_FULL 5
#define BATTERY_ALMOST_FULL 4
#define BATTERY_HALF 3
#define BATTERY_ALMOST_EMPTY 2
#define BATTERY_EMPTY 1
#define BATTERY_COLD (1 << 4)
#define BATTERY_COOL (2 << 4)
#define BATTERY_HOT (3 << 4)
#define BATTERY_CHARGING (1 << 7)
class nicla {
public:
static bool begin();
static bool enable3V3LDO();
static bool enable1V8LDO();
static bool disableLDO();
static bool enterShipMode();
static uint8_t readLDOreg();
static bool enableCharge(uint8_t mA = 20, bool disable_ntc = true);
static int getBatteryStatus();
static uint16_t getFault();
static bool ntc_disabled;
static RGBled leds;
static BQ25120A _pmic;
friend class RGBled;
friend class BQ25120A;
friend class Arduino_BHY2;
static bool started;
private:
static void pingI2CThd();
static void checkChgReg();
static rtos::Mutex i2c_mutex;
static uint8_t _chg_reg;
};
#endif