diff --git a/Dockerfile b/Dockerfile index 1b260c4..819baa6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,19 @@ run apt-get update && apt-get install -y \ sudo \ git \ python3-pip \ - dos2unix + dos2unix \ + curl run python3 -m pip install --user qmk env PATH="/root/.local/bin:${PATH}" run qmk setup -y -H /qmk_firmware +run curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -t thumbv7em-none-eabihf -y +env PATH="/root/.cargo/bin/:${PATH}" + +copy ./compile.sh /usr/bin/compile.sh +run dos2unix /usr/bin/compile.sh +run chmod +x /usr/bin/compile.sh copy ./keymap/* /qmk_firmware/keyboards/massdrop/alt/keymaps/ashe/ run find /qmk_firmware/keyboards/massdrop/alt/keymaps/ashe | xargs dos2unix diff --git a/build.sh b/build.sh index 6fcfc27..6a20488 100644 --- a/build.sh +++ b/build.sh @@ -8,7 +8,7 @@ IMAGE=$(docker build -q .) docker run -it \ --mount type=bind,src=$(pwd)/out,dst=/out \ $IMAGE \ - sh -c 'cd /qmk_firmware && qmk compile -kb massdrop/alt -km ashe && cp massdrop_alt_ashe.bin /out' + sh -c compile.sh cp out/massdrop_alt_ashe.bin ~/bin/Massdrop/qmk/massdrop_alt_ashe.bin cd ~/bin/Massdrop/ diff --git a/compile.sh b/compile.sh new file mode 100644 index 0000000..5acb399 --- /dev/null +++ b/compile.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e + +cd /qmk_firmware/ +rustc --emit=obj --target=thumbv7em-none-eabihf --codegen panic=abort -o test.o ./keyboards/massdrop/alt/keymaps/ashe/test.rs + +cd /qmk_firmware +qmk compile -kb massdrop/alt -km ashe +cp massdrop_alt_ashe.bin /out diff --git a/keymap/pomodoro.c b/keymap/pomodoro.c index 35e34e1..a6bf602 100644 --- a/keymap/pomodoro.c +++ b/keymap/pomodoro.c @@ -7,10 +7,14 @@ #define POM_COMPLETE_INDEX POM_CURRENT_INDEX + POM_LIGHT_COUNT + 1 #define POM_DURATION 1500 /* 25 * 60 */ +uint8_t test_function(void); + void draw_pom(void) { static bool blink_on; static short last_pos; + const uint8_t test_val = test_function(); + const uint8_t complete_hsv[3] = {HSV_TEAL}; const uint8_t current_hsv[3] = {HSV_GOLDENROD}; const uint8_t hidden_hsv[3] = C_MODI; @@ -36,6 +40,8 @@ void draw_pom(void) { hsv_matrix_set_color(completed_position, hidden_hsv); } + hsv_matrix_set_color(POM_COMPLETE_INDEX + test_val - 1, complete_hsv); + if (current_pom_state == STOPPED) return; diff --git a/keymap/pomodoro.h b/keymap/pomodoro.h index 6c8fd9c..6074551 100644 --- a/keymap/pomodoro.h +++ b/keymap/pomodoro.h @@ -13,4 +13,6 @@ short pom_current_secs; uint32_t pom_second_start; void draw_pom(void); -void count_pom(void); \ No newline at end of file +void count_pom(void); + +uint8_t test_function(void); \ No newline at end of file diff --git a/keymap/rules.mk b/keymap/rules.mk index 133c8de..70b4561 100644 --- a/keymap/rules.mk +++ b/keymap/rules.mk @@ -14,4 +14,5 @@ EXTRAKEY_ENABLE = yes # Audio control and System control # COMBO_ENABLE # Key combo feature # LEADER_ENABLE # Enable leader key chording -SRC += lighting_funcs.c pomodoro.c \ No newline at end of file +SRC += lighting_funcs.c pomodoro.c +LIB_SRC += test.o \ No newline at end of file diff --git a/keymap/test.rs b/keymap/test.rs new file mode 100644 index 0000000..80944f5 --- /dev/null +++ b/keymap/test.rs @@ -0,0 +1,14 @@ +#![no_std] +#![no_builtins] +#![crate_type = "staticlib"] +#![allow(dead_code)] + +#[panic_handler] +fn my_panic(_info: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +pub extern "C" fn test_function() -> u8 { + 2 +} \ No newline at end of file