-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
123 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#include <gob_unifiedButton.hpp> | ||
// setup/main in rotation_main.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
gob_unifiedButton example | ||
rotation for CoreS3 | ||
*/ | ||
#include <M5Unified.h> | ||
#include <gob_unifiedButton.hpp> | ||
|
||
goblib::UnifiedButton unifiedButton; // gob_unifiedButton instance | ||
auto& display = M5.Display; | ||
|
||
void setup() | ||
{ | ||
M5.begin(); | ||
unifiedButton.begin(&display); | ||
display.clear(TFT_DARKGREEN); | ||
unifiedButton.getButtonA()->setLabelText("ROTATE"); | ||
} | ||
|
||
void loop() | ||
{ | ||
bool force{}; | ||
static uint_fast8_t rot{display.getRotation()}; | ||
|
||
M5.update(); | ||
unifiedButton.update(); | ||
|
||
// Change rotation | ||
if(M5.BtnA.wasClicked()) | ||
{ | ||
rot = (rot + 1) & 0x07; | ||
M5_LOGI("setRotation:%u", rot); | ||
|
||
display.clear(TFT_DARKGREEN); | ||
|
||
display.setRotation(rot); | ||
unifiedButton.setRotation(display.getRotation()); // Do not use a value different from the target! | ||
// If you have already customized the buttons, you will need to do it again. | ||
unifiedButton.getButtonA()->setLabelText("ROTATE"); | ||
|
||
force = true; | ||
} | ||
|
||
display.setCursor(16, 32); | ||
display.printf("R:%u W:%d H:%d\n", display.getRotation(), display.width(), display.height()); | ||
display.printf("Click A to rotate random"); | ||
unifiedButton.draw(force); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters