Basic proof of concept - has light indexed by rust code

main
Ashelyn Dawn 3 years ago
parent 2a6e36bf62
commit 8268e7a8c7

@ -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

@ -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/

@ -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

@ -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;

@ -13,4 +13,6 @@ short pom_current_secs;
uint32_t pom_second_start;
void draw_pom(void);
void count_pom(void);
void count_pom(void);
uint8_t test_function(void);

@ -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
SRC += lighting_funcs.c pomodoro.c
LIB_SRC += test.o

@ -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
}
Loading…
Cancel
Save