~aleteoryx/muditaos

ref: 3623a84da9d7a9e382da241b8c365d36431925ac muditaos/module-bsp/bsp/battery-charger/battery_charger.hpp -rw-r--r-- 885 bytes
3623a84d — Pawel Paprocki [EGD-5517] Add MMI custom response window 5 years ago
                                                                                
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
54
55
56
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <cstdint>
extern "C"
{
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
}

namespace bsp::battery_charger
{
	using StateOfCharge = std::uint8_t;

	enum class batteryRetval{
		OK,
		ChargerError,
		ChargerNotCharging,
		ChargerCharging
	};

	enum class batteryIRQSource{
		INTB = 0x01,
		INOKB = 0x02
	};

	enum class batteryINTBSource{
		minSOCAlert = 1 << 10,
		minVAlert = 1 << 8,
		SOCOnePercentChange = 1 << 7
	};

	int init(xQueueHandle queueHandle);

	void deinit();

	StateOfCharge getBatteryLevel();

	bool getChargeStatus();

	void clearAllIRQs();

	void clearFuelGuageIRQ();

	std::uint16_t getStatusRegister();

	BaseType_t INOKB_IRQHandler();

	BaseType_t INTB_IRQHandler();
} // bsp::battery_charger