wpi-32u4-library
src
USBPause.h
Go to the documentation of this file.
1
// Copyright Pololu Corporation. For more information, see https://www.pololu.com/
2
11
#pragma once
12
13
#include <avr/io.h>
14
26
class
USBPause
27
{
29
uint8_t
savedUDIEN
;
30
32
uint8_t
savedUENUM
;
33
35
uint8_t
savedUEIENX0
;
36
37
public
:
38
39
USBPause
()
40
{
41
// Disable the general USB interrupt. This must be done
42
// first, because the general USB interrupt might change the
43
// state of the EP0 interrupt, but not the other way around.
44
savedUDIEN
= UDIEN;
45
UDIEN = 0;
46
47
// Select endpoint 0.
48
savedUENUM
= UENUM;
49
UENUM = 0;
50
51
// Disable endpoint 0 interrupts.
52
savedUEIENX0
= UEIENX;
53
UEIENX = 0;
54
}
55
56
~USBPause
()
57
{
58
// Restore endpoint 0 interrupts.
59
UENUM = 0;
60
UEIENX =
savedUEIENX0
;
61
62
// Restore endpoint selection.
63
UENUM =
savedUENUM
;
64
65
// Restore general device interrupt.
66
UDIEN =
savedUDIEN
;
67
}
68
69
};
USBPause
Definition:
USBPause.h:27
USBPause::savedUEIENX0
uint8_t savedUEIENX0
The saved value of the UEIENX register for endpoint 0.
Definition:
USBPause.h:35
USBPause::USBPause
USBPause()
Definition:
USBPause.h:39
USBPause::savedUENUM
uint8_t savedUENUM
The saved value of the UENUM register.
Definition:
USBPause.h:32
USBPause::savedUDIEN
uint8_t savedUDIEN
The saved value of the UDIEN register.
Definition:
USBPause.h:29
USBPause::~USBPause
~USBPause()
Definition:
USBPause.h:56
Generated by
1.9.3