-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutil.h
44 lines (40 loc) · 836 Bytes
/
util.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
/*
* author : Shuichi TAKANO
* since : Sun Feb 04 2024 01:17:42
*/
#pragma once
#include <stdio.h>
#include <hardware/structs/systick.h>
namespace util
{
inline void
dumpBytes(const void *p, size_t size)
{
auto *pp = static_cast<const uint8_t *>(p);
size_t i = 0;
while (i < size)
{
printf("%02x ", pp[i]);
++i;
if ((i & 15) == 0)
{
printf("\n");
}
}
if (i & 15)
{
printf("\n");
}
}
inline void initSysTick()
{
systick_hw->csr = 0x5;
systick_hw->rvr = 0x00FFFFFF;
}
// tick counterを取得
// カウンタは減っていくのに注意
inline uint32_t getSysTickCounter24()
{
return systick_hw->cvr;
}
}