Skip to content

Commit

Permalink
Merge pull request #51 from badgeteam/renze/stuff
Browse files Browse the repository at this point in the history
Renze/stuff
  • Loading branch information
renzenicolai authored Feb 10, 2024
2 parents 108e4ae + a1358a7 commit 5deeeb9
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 100 deletions.
2 changes: 1 addition & 1 deletion components/hackerhotel2024-bsp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
idf_component_register(
SRCS "bsp.c"
SRCS "bsp.c" "task_button_input_handler.c" "task_keyboard.c" "task_term_input_handler.c"
INCLUDE_DIRS "." "include"
EMBED_FILES "resources/ch32_firmware.bin"
"resources/hackerhotel.png"
Expand Down
20 changes: 1 addition & 19 deletions components/hackerhotel2024-bsp/include/coprocessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,7 @@
#define SWITCH_4 3
#define SWITCH_5 4

#define SWITCH_L1 5
#define SWITCH_L2 6
#define SWITCH_L3 7
#define SWITCH_L4 8
#define SWITCH_L5 9

#define SWITCH_R1 10
#define SWITCH_R2 11
#define SWITCH_R3 12
#define SWITCH_R4 13
#define SWITCH_R5 14

#define NUM_SWITCHES 5
#define NUM_ROTATION 10
#define NUM_CHARACTERS 37
// first 26 are letters,
// next 10 are numbers 0-9
// last character is space

#define NUM_SWITCHES 5

// Types
typedef struct _coprocessor_input_message {
Expand Down
1 change: 1 addition & 0 deletions components/hackerhotel2024-bsp/include/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "badge-communication-protocol.h"
#include "bsp.h"
#include "task_keyboard.h"

typedef enum _event_type {
event_input_button,
Expand Down
File renamed without changes.
29 changes: 29 additions & 0 deletions components/hackerhotel2024-bsp/include/task_keyboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "freertos/FreeRTOS.h"
#include "freertos/queue.h"

typedef struct _task_keyboard_parameters {
QueueHandle_t input_queue;
QueueHandle_t output_queue;
} task_keyboard_parameters_t;

#define ROTATION_L1 5
#define ROTATION_L2 6
#define ROTATION_L3 7
#define ROTATION_L4 8
#define ROTATION_L5 9

#define ROTATION_R1 10
#define ROTATION_R2 11
#define ROTATION_R3 12
#define ROTATION_R4 13
#define ROTATION_R5 14

#define NUM_ROTATION 10
#define NUM_CHARACTERS 37
// first 26 are letters,
// next 10 are numbers 0-9
// last character is space

esp_err_t start_task_keyboard(QueueHandle_t input_queue, QueueHandle_t output_queue);
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ void keyboard_handle_input(keyboard_state_t* state, coprocessor_input_message_t*
}
if (state->enable_rot_action) {
switch (state->button_state_left) {
case (1 << 0): rotation = SWITCH_L1; break;
case (1 << 1): rotation = SWITCH_L2; break;
case (1 << 2): rotation = SWITCH_L3; break;
case (1 << 3): rotation = SWITCH_L4; break;
case (1 << 4): rotation = SWITCH_L5; break;
case (1 << 0): rotation = ROTATION_L1; break;
case (1 << 1): rotation = ROTATION_L2; break;
case (1 << 2): rotation = ROTATION_L3; break;
case (1 << 3): rotation = ROTATION_L4; break;
case (1 << 4): rotation = ROTATION_L5; break;
}

switch (state->button_state_right) {
case (1 << 0): rotation = SWITCH_R1; break;
case (1 << 1): rotation = SWITCH_R2; break;
case (1 << 2): rotation = SWITCH_R3; break;
case (1 << 3): rotation = SWITCH_R4; break;
case (1 << 4): rotation = SWITCH_R5; break;
case (1 << 0): rotation = ROTATION_R1; break;
case (1 << 1): rotation = ROTATION_R2; break;
case (1 << 2): rotation = ROTATION_R3; break;
case (1 << 3): rotation = ROTATION_R4; break;
case (1 << 4): rotation = ROTATION_R5; break;
}
}

Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ idf_component_register(
${task_srcs}
${module_srcs}
INCLUDE_DIRS "."
"tasks"
"modules"
EMBED_FILES ${project_dir}/resources/bodgeteam.png
${project_dir}/resources/textedit.png
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_home.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ screen_t screen_home_entry(QueueHandle_t application_event_queue, QueueHandle_t
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor = Decrement(cursor, Nb_screen); break;
case SWITCH_R1: cursor = Increment(cursor, Nb_screen); break;
case ROTATION_L1: cursor = Decrement(cursor, Nb_screen); break;
case ROTATION_R1: cursor = Increment(cursor, Nb_screen); break;
case SWITCH_1: break;
case SWITCH_2: break;
case SWITCH_3: break;
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_library.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ screen_t screen_library_entry(QueueHandle_t application_event_queue, QueueHandle
case SWITCH_1: return screen_home; break;
case SWITCH_2: break;
case SWITCH_3: break;
case SWITCH_L3: cursor = Decrement(cursor, Nb_item_library); break;
case SWITCH_R3: cursor = Increment(cursor, Nb_item_library); break;
case ROTATION_L3: cursor = Decrement(cursor, Nb_item_library); break;
case ROTATION_R3: cursor = Increment(cursor, Nb_item_library); break;
case SWITCH_4: break;
case SWITCH_5:
screen_library_content(application_event_queue, keyboard_event_queue, cursor);
Expand Down
88 changes: 44 additions & 44 deletions main/modules/screen_pointclick.c
Original file line number Diff line number Diff line change
Expand Up @@ -1752,10 +1752,10 @@ screen_t screen_pointclick_dock1(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -1833,10 +1833,10 @@ screen_t screen_pointclick_dock2(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -1914,10 +1914,10 @@ screen_t screen_pointclick_land1(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -1987,10 +1987,10 @@ screen_t screen_pointclick_dune1(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: move_back++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2064,10 +2064,10 @@ screen_t screen_pointclick_dune2(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: move_back++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2179,10 +2179,10 @@ screen_t screen_pointclick_town1(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: button2++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2252,10 +2252,10 @@ screen_t screen_pointclick_town2(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: move_back++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2333,10 +2333,10 @@ screen_t screen_pointclick_road1(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: move_back++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2431,10 +2431,10 @@ screen_t screen_pointclick_dune3(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: move_back++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2534,10 +2534,10 @@ screen_t screen_pointclick_lighthouse1(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: button2++; break;
case SWITCH_3: move_forward++; break;
Expand Down Expand Up @@ -2617,10 +2617,10 @@ screen_t screen_pointclick_lighthouse2(
case event_input_button: break; // Ignore raw button input
case event_input_keyboard:
switch (event.args_input_keyboard.action) {
case SWITCH_L1: cursor--; break;
case SWITCH_R1: cursor++; break;
case SWITCH_L5: cursor--; break;
case SWITCH_R5: cursor++; break;
case ROTATION_L1: cursor--; break;
case ROTATION_R1: cursor++; break;
case ROTATION_L5: cursor--; break;
case ROTATION_R5: cursor++; break;
case SWITCH_1: return screen_home; break;
case SWITCH_2: move_back++; break;
case SWITCH_3: move_forward++; break;
Expand Down
8 changes: 4 additions & 4 deletions main/modules/screen_repertoire.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,10 @@ screen_t screen_repertoire_entry(QueueHandle_t application_event_queue, QueueHan
// StoreRepertoire(name, maca, i);
// }
break;
case SWITCH_L2: cursor.x--; break;
case SWITCH_R2: cursor.x++; break;
case SWITCH_L3: cursor.y++; break;
case SWITCH_R3: cursor.y--; break;
case ROTATION_L2: cursor.x--; break;
case ROTATION_R2: cursor.x++; break;
case ROTATION_L3: cursor.y++; break;
case ROTATION_R3: cursor.y--; break;
case SWITCH_3: break;
case SWITCH_4:
if (!show_name_or_mac)
Expand Down
4 changes: 2 additions & 2 deletions main/modules/screen_scrambled.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ screen_t screen_scrambled_entry(QueueHandle_t application_event_queue, QueueHand
configure_keyboard_typing(keyboard_event_queue, true);
}
break;
case SWITCH_L4:
case ROTATION_L4:
if (cursor > 0)
cursor--;
break;
case SWITCH_R4:
case ROTATION_R4:
if (usertext[cursor] != '\0')
cursor++;
break;
Expand Down
8 changes: 4 additions & 4 deletions main/modules/screen_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,11 @@ const float OCVLut[32][2] = {{0, 2.7296}, {0.0164, 3.0857}, {0.0328, 3.2497
// case SWITCH_3: break;
// case SWITCH_4: break;
// case SWITCH_5: break;
// case SWITCH_L5:
// case ROTATION_L5:
// if (cursor)
// cursor--;
// break;
// case SWITCH_R5:
// case ROTATION_R5:
// if (cursor)
// cursor++;
// break;
Expand Down Expand Up @@ -535,11 +535,11 @@ screen_t screen_lut_dial(QueueHandle_t application_event_queue, QueueHandle_t ke
case SWITCH_3: break;
case SWITCH_4: break;
case SWITCH_5: break;
case SWITCH_L5:
case ROTATION_L5:
if (cursor)
cursor--;
break;
case SWITCH_R5:
case ROTATION_R5:
if (cursor < 4)
cursor++;
break;
Expand Down
11 changes: 0 additions & 11 deletions main/tasks/task_keyboard.h

This file was deleted.

0 comments on commit 5deeeb9

Please sign in to comment.