-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCInterrupt.h
49 lines (40 loc) · 886 Bytes
/
CInterrupt.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
45
46
47
48
49
/*
* CInterrupt.h
*
* Created: 04.06.2018 13:41:22
* Author: Andrew
*/
#define Boot 1
#define App 0
#ifndef CINTERRUPT_H_
#define CINTERRUPT_H_
class CInterrupt
{
public:
CInterrupt(){}
CInterrupt(int usesection){
PMIC.CTRL |= PMIC_LOLVLEN_bm | PMIC_MEDLVLEN_bm | PMIC_HILVLEN_bm ;// àêòèâàöèÿ êîíòðîëëåðà ïðåðûâàíèé 10 bytes PM
if(usesection == Boot)
{
CCP = CCP_IOREG_gc; //Ðàçðåøåíèå çàïèñè â çàùèù¸ííûé ðåãèñòð
PMIC.CTRL |= PMIC_IVSEL_bm; // àêòèâàöèÿ òàáëèöû ïðåðûâàíèé çàãðóçî÷íîãî ñåêòîðà
}
if(usesection == App)
{
CCP = CCP_IOREG_gc; //Ðàçðåøåíèå çàïèñè â çàùèù¸ííûé ðåãèñòð
PMIC.CTRL &= ~PMIC_IVSEL_bm; // àêòèâàöèÿ òàáëèöû ïðåðûâàíèé çàãðóçî÷íîãî ñåêòîðà
}
}
~CInterrupt(){}
void enable();
void disable();
};
void CInterrupt::enable()
{
sei();
}
void CInterrupt::disable()
{
cli();
}
#endif /* CINTERRUPT_H_ */