Boboter
Loading...
Searching...
No Matches
buttons.h
Go to the documentation of this file.
1
7
8#pragma once
9
10#include <cstdint>
11#include <soc/gpio_num.h>
12
13class Robot;
14
15namespace Device {
16 class Buttons {
17 private:
18 static constexpr const char* TAG = "Device::Buttons";
19
20 static constexpr gpio_num_t BUTTON_PRIMARY_PIN = GPIO_NUM_16;
21 static constexpr gpio_num_t BUTTON_SECONDARY_PIN = GPIO_NUM_17;
22 static constexpr uint32_t DEBOUNCE_US = 250'000;
23
24 Robot& robot;
25 bool primary_button_state;
26 bool secondary_button_state;
27
28 public:
29 explicit Buttons(Robot& robot);
30 ~Buttons();
31
35 void initialize();
36
41
45 bool get_button_state_primary() const { return primary_button_state; }
46
50 bool get_button_state_secondary() const { return secondary_button_state; }
51 };
52}
bool get_button_state_secondary() const
Gets the state of the secondary button.
Definition buttons.h:50
void initialize()
Sets up the neccessary GPIO pins.
Definition buttons.cpp:26
Buttons(Robot &robot)
Definition buttons.cpp:14
void update_button_states()
Updates the button states with the current hardware states.
Definition buttons.cpp:46
~Buttons()
Definition buttons.cpp:22
bool get_button_state_primary() const
Gets the state of the primary button.
Definition buttons.h:45
Class containing all the components of the robot.
Definition robot.h:24
Definition battery.cpp:14