-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.c
More file actions
56 lines (39 loc) · 953 Bytes
/
user.c
File metadata and controls
56 lines (39 loc) · 953 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
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "main.h"
void Init_All(void) {
// initialize all things
stdio_init_all();
ADC_Init();
RGB_Init();
Flash_LogFile_Init();
Setup_File_Init();
cyw43_arch_init();
BT_Init();
// "purge" du buffer USB RX ?
getchar_timeout_us(0);
}
uint8_t Reboot_Func(void) {
watchdog_hw->ctrl = WATCHDOG_CTRL_TRIGGER_BITS;
return 0;
}
uint8_t Reboot_USB_Func(void) {
reset_usb_boot(0,0);
return 0;
}
uint8_t Print_Version_Func(void) {
printf("version,PKit_Plateau_RP2040_Software\n");
printf("Compiled_on,");
printf(__DATE__);
printf(" @ ");
printf(__TIME__);
printf("\n");
return 0;
}
uint32_t time_ms_32(void) {
// Read the lower 32 bits
uint64_t lo = timer_hw->timelr;
// Now read the upper 32 bits
uint64_t hi = timer_hw->timehr;
uint64_t loc_time_us = (hi << 32) + lo;
loc_time_us = loc_time_us / 1000;
return loc_time_us;
}