-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPU_control.h
More file actions
43 lines (32 loc) · 952 Bytes
/
CPU_control.h
File metadata and controls
43 lines (32 loc) · 952 Bytes
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
/*
CPU_control.h
# Description:
- This has many important things, some related to performance and some related to monitoring.
- This has also timing class AutoWait used to make sure timings are met.
*/
#pragma once
#include "esp32-hal.h"
#include "esp32-hal-cpu.h"
#include "soc/rtc.h"
#include "esp_freertos_hooks.h"
#include <chrono>
namespace CPU {
class AutoWait {
const uint64_t m_now, m_diff;
uint64_t m_last;
public:
AutoWait(const uint64_t ms);
~AutoWait();
// Returns true if time set was past. Auto-resets for more of that time, perfectly timed.
bool is_time();
};
uint32_t get_lowest_clock_mhz();
uint32_t get_highest_clock_mhz();
uint32_t get_cpu_clock_mhz();
void set_clock_mhz(const uint32_t);
float get_cpu_usage();
float get_cpu_usage(const uint8_t);
float get_ram_usage();
//uint32_t get_random();
//uint8_t get_core_id();
}