summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2015-11-16 10:08:07 -0600
committerMike Fiore <mfiore@multitech.com>2015-11-16 10:08:07 -0600
commit18f49ed922576d2add2d7ad926b33faa83155897 (patch)
treef2a5bea234c54493070be35dc5847dfb5ce35cb6
parent2f9996bac0dd1c0bbacadc0d420a1b3244cd9a76 (diff)
downloadmtdot-box-evb-factory-firmware-18f49ed922576d2add2d7ad926b33faa83155897.tar.gz
mtdot-box-evb-factory-firmware-18f49ed922576d2add2d7ad926b33faa83155897.tar.bz2
mtdot-box-evb-factory-firmware-18f49ed922576d2add2d7ad926b33faa83155897.zip
put enums inside class scope when possible
-rw-r--r--ButtonHandler/ButtonHandler.cpp8
-rw-r--r--ButtonHandler/ButtonHandler.h14
-rw-r--r--main.cpp8
3 files changed, 15 insertions, 15 deletions
diff --git a/ButtonHandler/ButtonHandler.cpp b/ButtonHandler/ButtonHandler.cpp
index c49283e..ccbccfa 100644
--- a/ButtonHandler/ButtonHandler.cpp
+++ b/ButtonHandler/ButtonHandler.cpp
@@ -38,7 +38,7 @@ void worker(void const* argument) {
b->_sw1_time = b->_sw1_timer.read_ms();
if (b->_sw1_time > b->_debounce_time) {
- b->_event = sw1_press;
+ b->_event = ButtonHandler::sw1_press;
osSignalSet(b->_main, buttonSignal);
}
}
@@ -59,7 +59,7 @@ void worker(void const* argument) {
b->_sw2_time = b->_sw2_timer.read_ms();
if (b->_sw2_time > b->_debounce_time) {
- b->_event = sw2_press;
+ b->_event = ButtonHandler::sw2_press;
osSignalSet(b->_main, buttonSignal);
}
}
@@ -75,7 +75,7 @@ void worker(void const* argument) {
check_sw1 = false;
b->_sw1_running = false;
b->_sw1_timer.stop();
- b->_event = sw1_hold;
+ b->_event = ButtonHandler::sw1_hold;
osSignalSet(b->_main, buttonSignal);
}
}
@@ -104,7 +104,7 @@ ButtonHandler::ButtonHandler(osThreadId main)
_sw2.mode(PullUp);
}
-ButtonEvent ButtonHandler::getButtonEvent() {
+ButtonHandler::ButtonEvent ButtonHandler::getButtonEvent() {
ButtonEvent event = _event;
_event = none;
return event;
diff --git a/ButtonHandler/ButtonHandler.h b/ButtonHandler/ButtonHandler.h
index 57f768d..00898c6 100644
--- a/ButtonHandler/ButtonHandler.h
+++ b/ButtonHandler/ButtonHandler.h
@@ -6,15 +6,15 @@
#define buttonSignal (uint32_t)0x01
-typedef enum {
- none = 0,
- sw1_press,
- sw1_hold,
- sw2_press
-} ButtonEvent;
-
class ButtonHandler {
public:
+ typedef enum {
+ none = 0,
+ sw1_press,
+ sw1_hold,
+ sw2_press
+ } ButtonEvent;
+
ButtonHandler(osThreadId main);
~ButtonHandler();
diff --git a/main.cpp b/main.cpp
index cd8a186..cd89699 100644
--- a/main.cpp
+++ b/main.cpp
@@ -80,19 +80,19 @@ void mainMenu() {
while (true) {
osEvent e = Thread::signal_wait(buttonSignal);
if (e.status == osEventSignal) {
- ButtonEvent ev = buttons->getButtonEvent();
+ ButtonHandler::ButtonEvent ev = buttons->getButtonEvent();
std::string selected;
switch (ev) {
- case sw1_press:
+ case ButtonHandler::sw1_press:
logInfo("sw1 press");
selected = menu.select();
logInfo("selected %s", selected.c_str());
break;
- case sw2_press:
+ case ButtonHandler::sw2_press:
logInfo("sw2 press");
menu.scroll();
break;
- case sw1_hold:
+ case ButtonHandler::sw1_hold:
logInfo("sw1 hold - already in main menu");
break;
default: