Skip to content

Commit

Permalink
Started transition to TROOPERS24 hardware
Browse files Browse the repository at this point in the history
  • Loading branch information
hnzlmnn committed May 29, 2024
1 parent 8c207e1 commit 3ca63b3
Show file tree
Hide file tree
Showing 44 changed files with 292 additions and 7,199 deletions.
120 changes: 120 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,123 @@ esp-idf
dependencies.lock
cmake-build-debug/
cmake-build-debug-esp-idf/
cmake-build-debug-esp-idf*/
font.txt

# Created by https://www.toptal.com/developers/gitignore/api/clion
# Edit at https://www.toptal.com/developers/gitignore?templates=clion

### CLion ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml

# End of https://www.toptal.com/developers/gitignore/api/clion
17 changes: 10 additions & 7 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,24 @@
path = components/eeprom
url = https://github.com/Nicolai-Electronics/esp32-component-i2c-eeprom.git
branch = main
[submodule "components/troopers23-bsp"]
path = components/troopers23-bsp
url = [email protected]:badgeteam/esp32-component-troopers23-bsp.git
[submodule "components/troopers24-bsp"]
path = components/troopers24-bsp
url = [email protected]:badgeteam/troopers24-bsp.git
[submodule "components/i2c-pca9555"]
path = components/i2c-pca9555
url = [email protected]:badgeteam/esp32-component-pca9555.git
[submodule "components/keyboard"]
path = components/keyboard
url = [email protected]:badgeteam/troopers2023-keyboard.git
[submodule "components/troopers23-efuse"]
path = components/troopers23-efuse
url = [email protected]:badgeteam/troopers23-efuse.git
url = [email protected]:badgeteam/troopers24-keyboard.git
[submodule "components/troopers24-efuse"]
path = components/troopers24-efuse
url = [email protected]:badgeteam/troopers24-efuse.git
[submodule "components/i2c-controller"]
path = components/i2c-controller
url = [email protected]:hnzlmnn/esp32-component-controller.git
[submodule "components/i2c-ktd2052"]
path = components/i2c-ktd2052
url = [email protected]:hnzlmnn/esp32-component-ktd2052.git
[submodule "components/pax-keyboard"]
path = components/pax-keyboard
url = https://github.com/robotman2412/pax-keyboard.git
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.12
2 changes: 1 addition & 1 deletion components/appfs
Submodule appfs updated 2 files
+2 −1 .gitignore
+3 −3 tools/generate.sh
4 changes: 2 additions & 2 deletions components/gui-toolkit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ idf_component_register(
REQUIRES
"pax-graphics"
"pax-codecs"
"physical-keyboard"
"pax-keyboard"
"spi-ili9341"
"troopers23-bsp"
"troopers24-bsp"
)
123 changes: 63 additions & 60 deletions components/gui-toolkit/graphics_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

#include <string.h>

#include "esp_log.h"
#include "hardware.h"
#include "physical_keyboard.h"
#include "pax_keyboard.h"

static const char* TAG = "graphic_wrapper";

void render_outline(float position_x, float position_y, float width, float height, pax_col_t border_color, pax_col_t background_color) {
pax_buf_t* pax_buffer = get_pax_buffer();
Expand All @@ -29,54 +32,6 @@ void render_message(char* message) {
pax_noclip(pax_buffer);
}

int buttonToKey(uint8_t button) {
switch (button) {
case BUTTON_ACCEPT: return PKB_ACCEPT;
case BUTTON_BACK: return -1;
case BUTTON_START: return PKB_NO_INPUT;
case BUTTON_SELECT: return PKB_NO_INPUT;
case JOYSTICK_UP: return PKB_UP;
case JOYSTICK_DOWN: return PKB_DOWN;
case JOYSTICK_LEFT: return PKB_LEFT;
case JOYSTICK_RIGHT: return PKB_RIGHT;
case KEY_SHIELD: return PKB_SUPER;
case KEY_FN: return PKB_FN;
case KEY_SPACE: return PKB_SPACE;
case KEY_BACKSPACE: return PKB_DELETE_BEFORE;
case KEY_SHIFT: return PKB_SHIFT;
case KEY_RETURN: return PKB_RETURN;
case KEY_Q: return PKB_Q;
case KEY_W: return PKB_W;
case KEY_E: return PKB_E;
case KEY_R: return PKB_R;
case KEY_T: return PKB_T;
case KEY_Y: return PKB_Y;
case KEY_U: return PKB_U;
case KEY_I: return PKB_I;
case KEY_O: return PKB_O;
case KEY_P: return PKB_P;
case KEY_A: return PKB_A;
case KEY_S: return PKB_S;
case KEY_D: return PKB_D;
case KEY_F: return PKB_F;
case KEY_G: return PKB_G;
case KEY_H: return PKB_H;
case KEY_J: return PKB_J;
case KEY_K: return PKB_K;
case KEY_L: return PKB_L;
case KEY_Z: return PKB_Z;
case KEY_X: return PKB_X;
case KEY_C: return PKB_C;
case KEY_V: return PKB_V;
case KEY_B: return PKB_B;
case KEY_N: return PKB_N;
case KEY_M: return PKB_M;
default:
printf("Unmapped key: %u\n", button);
break;
}
return PKB_NO_INPUT;
}

bool keyboard(xQueueHandle buttonQueue, float aPosX, float aPosY, float aWidth, float aHeight, const char* aTitle,
const char* aHint, char* aOutput, size_t aOutputSize) {
Expand Down Expand Up @@ -129,17 +84,65 @@ bool keyboard(xQueueHandle buttonQueue, float aPosX, float aPosY, float aWidth,
if (xQueueReceive(buttonQueue, &buttonMessage, portMAX_DELAY) == pdTRUE) {
uint8_t button = buttonMessage.input;
bool value = buttonMessage.state;
int key = buttonToKey(button);
if (key == -1) {
if (value) {
running = false;
}
} else if (key != PKB_NO_INPUT) {
if (value) {
pkb_press(&kb_ctx, key);
} else {
pkb_release(&kb_ctx, key);
}

switch (button) {
case JOYSTICK_DOWN:
if (value) {
pkb_press(&kb_ctx, PKB_DOWN);
} else {
pkb_release(&kb_ctx, PKB_DOWN);
}
break;
case JOYSTICK_UP:
if (value) {
pkb_press(&kb_ctx, PKB_UP);
} else {
pkb_release(&kb_ctx, PKB_UP);
}
break;
case JOYSTICK_LEFT:
if (value) {
pkb_press(&kb_ctx, PKB_LEFT);
} else {
pkb_release(&kb_ctx, PKB_LEFT);
}
break;
case JOYSTICK_RIGHT:
if (value) {
pkb_press(&kb_ctx, PKB_RIGHT);
} else {
pkb_release(&kb_ctx, PKB_RIGHT);
}
break;
case BUTTON_ACCEPT:
if (value) {
pkb_press(&kb_ctx, PKB_CHARSELECT);
} else {
pkb_release(&kb_ctx, PKB_CHARSELECT);
}
break;
case BUTTON_BACK:
if (value) {
pkb_press(&kb_ctx, PKB_DELETE_BEFORE);
} else {
pkb_release(&kb_ctx, PKB_DELETE_BEFORE);
}
break;
case BUTTON_SELECT:
if (value) {
pkb_press(&kb_ctx, PKB_MODESELECT);
} else {
pkb_release(&kb_ctx, PKB_MODESELECT);
}
break;
case BUTTON_START:
if (value) {
running = false;
}
break;
default:

break;
}
}
pkb_loop(&kb_ctx);
Expand Down
2 changes: 1 addition & 1 deletion components/keyboard
Submodule keyboard updated 4 files
+1 −1 CMakeLists.txt
+2 −2 README.md
+2 −76 include/keyboard.h
+15 −122 keyboard.c
1 change: 1 addition & 0 deletions components/pax-keyboard
Submodule pax-keyboard added at 78f781
8 changes: 0 additions & 8 deletions components/physical-keyboard/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 3ca63b3

Please sign in to comment.