libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
scopedirqblocker.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <stdint.h>
4
5
#ifndef UNIT_TEST
// provide dummy implementation for unit tests
6
extern
"C"
7
{
8
#include <cmsis_gcc.h>
9
}
10
11
namespace
daisy
12
{
14
class
ScopedIrqBlocker
15
{
16
public
:
17
ScopedIrqBlocker
()
18
{
19
prim_ =
__get_PRIMASK
();
20
__disable_irq
();
21
}
22
23
~ScopedIrqBlocker
()
24
{
25
if
(!prim_)
26
__enable_irq
();
27
}
28
29
private
:
30
uint32_t
prim_;
31
};
32
}
// namespace daisy
33
34
#else
// ifndef UNIT_TEST
35
36
namespace
daisy
37
{
39
class
ScopedIrqBlocker
40
{
41
public
:
42
ScopedIrqBlocker
(){};
43
~ScopedIrqBlocker
() =
default
;
44
};
45
}
// namespace daisy
46
47
#endif
daisy::LedDriverPca9685
Definition
leddriver.h:33
daisy::ScopedIrqBlocker
Definition
scopedirqblocker.h:15
daisy::ScopedIrqBlocker::~ScopedIrqBlocker
~ScopedIrqBlocker()
Definition
scopedirqblocker.h:23
daisy::ScopedIrqBlocker::ScopedIrqBlocker
ScopedIrqBlocker()
Definition
scopedirqblocker.h:17
daisy
Hardware defines and helpers for daisy field platform.
Definition
index.h:2
src
util
scopedirqblocker.h