Skip to content

Commit

Permalink
sdk: fix menu layout issues
Browse files Browse the repository at this point in the history
keira: add more icons
  • Loading branch information
and3rson committed Apr 4, 2024
1 parent 9b36471 commit 770ea3b
Show file tree
Hide file tree
Showing 11 changed files with 1,423 additions and 213 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ icons:
-not \( -name mJS -prune \) \
-not \( -name SimpleFTPServer -prune \) \
-not \( -name *splash* -prune \) \
-not \( -name *weather* -prune \) \
-iname *.png \
-exec $(IMAGE2CODE) {} \;

Expand Down
13 changes: 8 additions & 5 deletions firmware/keira/src/apps/gpiomanager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "gpiomanager.h"

#include "icons/input.h"
#include "icons/output.h"

GPIOManagerApp::GPIOManagerApp() : App("GPIOManager") {
menu.setTitle("GPIO");
// Set default pin mode
Expand Down Expand Up @@ -39,8 +42,8 @@ void GPIOManagerApp::run() {
readPinData();
for (int i = 0; i < PIN_COUNT; i++) {
menu.addItem(
String(pinNo[i]) + (pinM[i] == INPUT ? " <- IN " : " -> OUT "),
0,
String(pinNo[i]) + (pinM[i] == INPUT ? " <- IN" : " -> OUT"),
pinM[i] == INPUT ? &input : &output,
0,
pinData[i] == HIGH ? "HIGH" : "LOW"
);
Expand All @@ -55,7 +58,7 @@ void GPIOManagerApp::run() {
lilka::serial_log("Menu finished");
int16_t curPos = menu.getCursor();
if (curPos == PIN_COUNT) break;
auto button = menu.getButton();
lilka::Button button = menu.getButton();
if (button == lilka::Button::A) {
if (pinM[curPos] == INPUT) {
// alert
Expand All @@ -76,7 +79,7 @@ void GPIOManagerApp::readSpeedCompare() {
lilka::serial_log("Reading pins using REG_READ");
uint8_t pinDataRegRead[64];
uint8_t pinDataDigitalRead[64];
auto time_begin = micros();
uint64_t time_begin = micros();
uint32_t gpioValue = (REG_READ(GPIO_IN_REG));
uint32_t gpio1Value = (REG_READ(GPIO_IN1_REG));
// lilka::serial_log("Pin data : %s %s", getStrBits(gpioValue).c_str(), getStrBits(gpio1Value).c_str());
Expand Down Expand Up @@ -106,4 +109,4 @@ String GPIOManagerApp::getStrBits(uint32_t num) {
bitStr += ((num >> i) & 1 ? "1" : "0");
}
return bitStr;
}
}
2 changes: 1 addition & 1 deletion firmware/keira/src/apps/gpiomanager.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once
#include "app.h"
#define PIN_COUNT 6
#define GET_BIT(data, bit_no) (data >> bit_no) & 0b1
#define GET_BIT(data, bit_no) ((data) >> (bit_no)) & 0b1

class GPIOManagerApp : public App {
public:
Expand Down
Loading

0 comments on commit 770ea3b

Please sign in to comment.