Pololu3piPlus32U4 library
Pololu3piPlus32U4Buttons.h
Go to the documentation of this file.
1 // Copyright (C) Pololu Corporation. See www.pololu.com for details.
2 
4 
5 #pragma once
6 
7 #include <Pushbutton.h>
8 #include <FastGPIO.h>
9 #include <USBPause.h>
10 #include <util/delay.h>
11 
12 namespace Pololu3piPlus32U4
13 {
14 
16 class ButtonA : public Pushbutton
17 {
18 public:
20  static const uint8_t buttonAPin = 14;
21 
23  {
24  }
25 };
26 
38 class ButtonB : public PushbuttonBase
39 {
40 public:
42  static const uint8_t buttonBPin = IO_D5;
43 
44  virtual bool isPressed()
45  {
46  USBPause usbPause;
47  FastGPIO::PinLoan<buttonBPin> loan;
48  FastGPIO::Pin<buttonBPin>::setInputPulledUp();
49  _delay_us(3);
50  return !FastGPIO::Pin<buttonBPin>::isInputHigh();
51  }
52 };
53 
65 class ButtonC : public PushbuttonBase
66 {
67 public:
69  static const uint8_t buttonCPin = 17;
70 
71  virtual bool isPressed()
72  {
73  USBPause usbPause;
74  FastGPIO::PinLoan<buttonCPin> loan;
75  FastGPIO::Pin<buttonCPin>::setInputPulledUp();
76  _delay_us(3);
77  return !FastGPIO::Pin<buttonCPin>::isInputHigh();
78  }
79 };
80 
81 }
Interfaces with button A on the 3pi+ 32U4.
static const uint8_t buttonAPin
The pin number for the pin connected to button A on the 3pi+ 32U4.
Interfaces with button B on the 3pi+ 32U4.
static const uint8_t buttonBPin
The pin number for the pin connected to button B on the 3pi+ 32U4.
Interfaces with button C on the 3pi+ 32U4.
static const uint8_t buttonCPin
The pin number for the pin conencted to button C on the 3pi+ 32U4.
Top-level namespace for the Pololu3piPlus32U4 library.