Skip to content

Commit

Permalink
pio testing nearly finished
Browse files Browse the repository at this point in the history
  • Loading branch information
No0ne committed Dec 18, 2022
1 parent da06c6d commit 9386937
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 112 deletions.
23 changes: 23 additions & 0 deletions ps2device.pio
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,26 @@ sendloop:
set pindirs, 0
irq clear 0
jmp start

% c-sdk {

void ps2dev_program_init(PIO pio, uint sm, uint offset, uint clk, uint dat) {
pio_sm_config c = ps2dev_program_get_default_config(offset);

pio_gpio_init(pio, clk);
pio_gpio_init(pio, dat);

sm_config_set_clkdiv(&c, 2560);
sm_config_set_jmp_pin(&c, clk);
sm_config_set_set_pins(&c, clk, 1);
sm_config_set_sideset_pins(&c, dat);
sm_config_set_out_pins(&c, dat, 1);
sm_config_set_out_shift(&c, true, true, 11);
sm_config_set_in_pins(&c, dat);
sm_config_set_in_shift(&c, true, true, 9);

pio_sm_init(pio, sm, offset, &c);
pio_sm_set_enabled(pio, sm, true);
}

%}
Loading

0 comments on commit 9386937

Please sign in to comment.