Zumo32U4 library
Zumo32U4Buttons.h
Go to the documentation of this file.
1 // Copyright Pololu Corporation. For more information, see http://www.pololu.com/
2 
5 #pragma once
6 
7 #include <Pushbutton.h>
8 #include <FastGPIO.h>
9 #include <USBPause.h>
10 #include <util/delay.h>
11 
13 #define ZUMO_32U4_BUTTON_A 14
14 
18 #define ZUMO_32U4_BUTTON_B IO_D5
19 
21 #define ZUMO_32U4_BUTTON_C 17
22 
25 {
26 public:
28  {
29  }
30 };
31 
43 {
44 public:
45 
46  virtual bool isPressed()
47  {
48  USBPause usbPause;
49  FastGPIO::PinLoan<ZUMO_32U4_BUTTON_B> loan;
50  FastGPIO::Pin<ZUMO_32U4_BUTTON_B>::setInputPulledUp();
51  _delay_us(3);
52  return !FastGPIO::Pin<ZUMO_32U4_BUTTON_B>::isInputHigh();
53  }
54 };
55 
67 {
68 public:
69 
70  virtual bool isPressed()
71  {
72  USBPause usbPause;
73  FastGPIO::PinLoan<ZUMO_32U4_BUTTON_C> loan;
74  FastGPIO::Pin<ZUMO_32U4_BUTTON_C>::setInputPulledUp();
75  _delay_us(3);
76  return !FastGPIO::Pin<ZUMO_32U4_BUTTON_C>::isInputHigh();
77  }
78 };
79 
#define ZUMO_32U4_BUTTON_A
Pushbutton(uint8_t pin, uint8_t pullUp=PULL_UP_ENABLED, uint8_t defaultState=DEFAULT_STATE_HIGH)
Interfaces with button A on the Zumo 32U4.
Interfaces with button B on the Zumo 32U4.
Interfaces with button C on the Zumo 32U4.