diff options
author | ConfuSomu | 2021-09-03 22:39:09 -0400 |
---|---|---|
committer | ConfuSomu | 2021-09-03 22:39:09 -0400 |
commit | 47a6054ab5ed163a3101d3d1fa4a77b085a1fd4b (patch) | |
tree | 6a102b44941569d2d47c98e1b2868795c0a5058e | |
parent | f2c4de8739bd8c5bd121c823a1f54eae294e2515 (diff) | |
download | pico-watch-47a6054ab5ed163a3101d3d1fa4a77b085a1fd4b.tar pico-watch-47a6054ab5ed163a3101d3d1fa4a77b085a1fd4b.tar.gz pico-watch-47a6054ab5ed163a3101d3d1fa4a77b085a1fd4b.zip |
Refactor names to btn_pressed/btn_released
This helps with consistency (use of snake case) while keeping the method
names short ("btn" is used instead of "button").
-rw-r--r-- | app/app_manager.cpp | 4 | ||||
-rw-r--r-- | app/base_app.hpp | 8 | ||||
-rw-r--r-- | apps/home_menu/main.cpp | 2 | ||||
-rw-r--r-- | apps/home_menu/main.hpp | 2 | ||||
-rw-r--r-- | apps/main_clock/main.cpp | 2 | ||||
-rw-r--r-- | apps/main_clock/main.hpp | 2 | ||||
-rw-r--r-- | apps/settings/main.cpp | 2 | ||||
-rw-r--r-- | apps/settings/main.hpp | 2 |
8 files changed, 12 insertions, 12 deletions
diff --git a/app/app_manager.cpp b/app/app_manager.cpp index b05b258..07e68fa 100644 --- a/app/app_manager.cpp +++ b/app/app_manager.cpp @@ -90,11 +90,11 @@ void app_mgr::app_render(BaseApp* app) { } void app_mgr::app_btnpressed(BaseApp* app, uint gpio, unsigned long delta) { - app_act_on_return_value(app, app->btnpressed(&app_api, gpio, delta)); + app_act_on_return_value(app, app->btn_pressed(&app_api, gpio, delta)); } void app_mgr::app_btnreleased(BaseApp* app, uint gpio, unsigned long delta) { - app_act_on_return_value(app, app->btnreleased(&app_api, gpio, delta)); + app_act_on_return_value(app, app->btn_released(&app_api, gpio, delta)); } void app_mgr::app_destroy(BaseApp* to_erase) { diff --git a/app/base_app.hpp b/app/base_app.hpp index 1f0c319..94b12cc 100644 --- a/app/base_app.hpp +++ b/app/base_app.hpp @@ -22,11 +22,11 @@ class BaseApp { // where app_attribues is an instance of AppAttributes virtual AppReturnValues render(Api *app_api) = 0; // Has to be implemented - // Called when a button is released. - // \param delta The time since the button has been last released. Delta is in ms, from time_since_button_press(). - virtual AppReturnValues btnpressed(Api *app_api, uint gpio, unsigned long delta) {return AppReturnValues::OK;}; + // Called when a button is pressed. + // \param delta The time since the button been last released. Delta is in ms, from time_since_button_press(). + virtual AppReturnValues btn_pressed(Api *app_api, uint gpio, unsigned long delta) {return AppReturnValues::OK;}; // Called when a button is released. // \param delta The time since the button has been pressed. Delta is in ms, from time_since_button_press(). - virtual AppReturnValues btnreleased(Api *app_api, uint gpio, unsigned long delta) {return AppReturnValues::OK;}; + virtual AppReturnValues btn_released(Api *app_api, uint gpio, unsigned long delta) {return AppReturnValues::OK;}; virtual AppReturnValues bgrefresh(Api *app_api, bool in_foreground) {return AppReturnValues::OK;}; }; diff --git a/apps/home_menu/main.cpp b/apps/home_menu/main.cpp index bf47e1e..ffa279c 100644 --- a/apps/home_menu/main.cpp +++ b/apps/home_menu/main.cpp @@ -36,7 +36,7 @@ BaseApp::AppReturnValues app_home_menu::render(Api *app_api) { // Example of how button inputs could be interpreted. // Drawing on screen should be done in the render function. -BaseApp::AppReturnValues app_home_menu::btnpressed(Api *app_api, uint gpio, unsigned long delta) { +BaseApp::AppReturnValues app_home_menu::btn_pressed(Api *app_api, uint gpio, unsigned long delta) { switch (gpio) { case BUTTON_SELECT: app_mgr::app_switch_request(selected_app); diff --git a/apps/home_menu/main.hpp b/apps/home_menu/main.hpp index 0e13c3f..242d2a3 100644 --- a/apps/home_menu/main.hpp +++ b/apps/home_menu/main.hpp @@ -25,7 +25,7 @@ class app_home_menu : public BaseApp { app_home_menu(Api *app_api); AppReturnValues render(Api *app_api); - AppReturnValues btnpressed(Api *app_api, uint gpio, unsigned long delta); + AppReturnValues btn_pressed(Api *app_api, uint gpio, unsigned long delta); AppReturnValues bgrefresh(Api *app_api, bool in_foreground); ~app_home_menu(); }; diff --git a/apps/main_clock/main.cpp b/apps/main_clock/main.cpp index 73a3103..4b9758c 100644 --- a/apps/main_clock/main.cpp +++ b/apps/main_clock/main.cpp @@ -70,7 +70,7 @@ BaseApp::AppReturnValues app_main_clock::render(Api *app_api) { } // Interpretation of button inputs -BaseApp::AppReturnValues app_main_clock::btnpressed(Api *app_api, uint gpio, unsigned long delta) { +BaseApp::AppReturnValues app_main_clock::btn_pressed(Api *app_api, uint gpio, unsigned long delta) { if (gpio == BUTTON_MODE) *ask_user_choice = true; return AppReturnValues::OK; diff --git a/apps/main_clock/main.hpp b/apps/main_clock/main.hpp index 0919fd7..132f789 100644 --- a/apps/main_clock/main.hpp +++ b/apps/main_clock/main.hpp @@ -23,7 +23,7 @@ class app_main_clock : public BaseApp { app_main_clock(Api *app_api); AppReturnValues render(Api *app_api); - AppReturnValues btnpressed(Api *app_api, uint gpio, unsigned long delta); + AppReturnValues btn_pressed(Api *app_api, uint gpio, unsigned long delta); AppReturnValues bgrefresh(Api *app_api, bool in_foreground); ~app_main_clock(); }; diff --git a/apps/settings/main.cpp b/apps/settings/main.cpp index 4917128..ae0734b 100644 --- a/apps/settings/main.cpp +++ b/apps/settings/main.cpp @@ -138,7 +138,7 @@ BaseApp::AppReturnValues app_settings::render(Api *app_api) { return AppReturnValues::OK; } -BaseApp::AppReturnValues app_settings::btnpressed(Api *app_api, uint gpio, unsigned long delta) { +BaseApp::AppReturnValues app_settings::btn_pressed(Api *app_api, uint gpio, unsigned long delta) { switch (gpio) { case BUTTON_SELECT: selected = true; diff --git a/apps/settings/main.hpp b/apps/settings/main.hpp index c425033..d9eabda 100644 --- a/apps/settings/main.hpp +++ b/apps/settings/main.hpp @@ -21,7 +21,7 @@ class app_settings : public BaseApp { app_settings(Api *app_api); AppReturnValues render(Api *app_api); - AppReturnValues btnpressed(Api *app_api, uint gpio, unsigned long delta); + AppReturnValues btn_pressed(Api *app_api, uint gpio, unsigned long delta); AppReturnValues bgrefresh(Api *app_api, bool in_foreground); ~app_settings(); }; |