Balboa32U4 library
Balboa32U4Buttons.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 BALBOA_32U4_BUTTON_A 14
14 
16 #define BALBOA_32U4_BUTTON_B IO_D5
17 
19 #define BALBOA_32U4_BUTTON_C 17
20 
23 {
24 public:
26  {
27  }
28 };
29 
41 {
42 public:
43 
44  virtual bool isPressed()
45  {
46  USBPause usbPause;
49  _delay_us(3);
51  }
52 };
53 
65 {
66 public:
67 
68  virtual bool isPressed()
69  {
70  USBPause usbPause;
73  _delay_us(3);
75  }
76 };
77 
Interfaces with button B on the Balboa 32U4.
static bool isInputHigh() __attribute__((always_inline))
Reads the input value of the pin.
Definition: FastGPIO.h:352
Interfaces with button A on the Balboa 32U4.
Main class for interfacing with pushbuttons.
Definition: Pushbutton.h:137
virtual bool isPressed()
indicates whether button is currently pressed without any debouncing.
#define BALBOA_32U4_BUTTON_A
Pushbutton(uint8_t pin, uint8_t pullUp=PULL_UP_ENABLED, uint8_t defaultState=DEFAULT_STATE_HIGH)
Definition: Pushbutton.cpp:120
static void setInputPulledUp() __attribute__((always_inline))
Sets a pin to be a digital input with the internal pull-up resistor enabled.
Definition: FastGPIO.h:342
Interfaces with button C on the Balboa 32U4.
virtual bool isPressed()
indicates whether button is currently pressed without any debouncing.
General pushbutton class that handles debouncing.
Definition: Pushbutton.h:70