clean up unused code
This commit is contained in:
parent
a091567aa2
commit
74a9fb3073
4 changed files with 9 additions and 53 deletions
|
@ -1,5 +1,3 @@
|
|||
use core::ops::Deref;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct GccState {
|
||||
pub a: bool,
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
use cortex_m::{delay::Delay, singleton};
|
||||
use cortex_m::delay::Delay;
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use rp_pico::{
|
||||
hal::{
|
||||
dma::{double_buffer, single_buffer, DMAExt},
|
||||
gpio::{Pin, PinId, PinMode, Pins, ValidPinMode},
|
||||
pio::{
|
||||
InstalledProgram, Rx, StateMachine, StateMachineIndex, Stopped, Tx, UninitStateMachine,
|
||||
ValidStateMachine, PIO, SM0,
|
||||
PIO,
|
||||
},
|
||||
prelude::_rphal_pio_PIOExt,
|
||||
Sio,
|
||||
},
|
||||
pac::{self, Peripherals, PIO0, RESETS},
|
||||
pac::{PIO0, RESETS},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
@ -119,6 +116,7 @@ pub fn datatransfer(
|
|||
}
|
||||
};
|
||||
|
||||
// poll
|
||||
if data == 0x40 {
|
||||
let mut state = GccState::new();
|
||||
|
||||
|
@ -139,7 +137,7 @@ pub fn datatransfer(
|
|||
|
||||
while rx.read().is_none() {}
|
||||
|
||||
let rumble = loop {
|
||||
let _rumble = loop {
|
||||
match rx.read() {
|
||||
Some(x) => break x as u8,
|
||||
None => continue,
|
||||
|
@ -148,22 +146,6 @@ pub fn datatransfer(
|
|||
|
||||
delay.delay_us(8);
|
||||
|
||||
// let (st, installed) = s.uninit(rx, tx);
|
||||
|
||||
// (sm, rx, tx) =
|
||||
// init_state_machine_with_installed_program(st, datapin.id().num, installed);
|
||||
|
||||
// sm.exec_instruction(pio::Instruction {
|
||||
// operands: pio::InstructionOperands::JMP {
|
||||
// condition: pio::JmpCondition::Always,
|
||||
// address: offset + offset_outmode as u8,
|
||||
// },
|
||||
// delay: 0,
|
||||
// side_set: None,
|
||||
// });
|
||||
|
||||
// s = sm.start();
|
||||
|
||||
let mut st = s.stop();
|
||||
st.exec_instruction(pio::Instruction {
|
||||
operands: pio::InstructionOperands::JMP {
|
||||
|
@ -178,12 +160,7 @@ pub fn datatransfer(
|
|||
for i in 0..pio_response.len() {
|
||||
while !tx.write((*pio_response)[i]) {}
|
||||
}
|
||||
|
||||
// if rumble & 1 == 1 {
|
||||
// ledpin.set_high().unwrap();
|
||||
// } else {
|
||||
// ledpin.set_low().unwrap();
|
||||
// }
|
||||
// origin
|
||||
} else if data == 0x41 {
|
||||
let origin_response: [u8; 10] = [0x00, 0x80, 127, 127, 127, 127, 0, 0, 0, 0];
|
||||
let pio_response: PioResponse<6> = to_pio_response(origin_response);
|
||||
|
@ -204,8 +181,7 @@ pub fn datatransfer(
|
|||
for i in 0..pio_response.len() {
|
||||
while !tx.write((*pio_response)[i]) {}
|
||||
}
|
||||
|
||||
// make ledpin blink twice with 500 ms delay
|
||||
// probe
|
||||
} else if data == 0 {
|
||||
let probe_response: [u8; 3] = [0x09, 0x00, 0x03];
|
||||
let pio_response: PioResponse<2> = to_pio_response(probe_response);
|
||||
|
@ -226,6 +202,7 @@ pub fn datatransfer(
|
|||
for i in 0..pio_response.len() {
|
||||
while !tx.write((*pio_response)[i]) {}
|
||||
}
|
||||
// something else (probably snippet of some other message)
|
||||
} else {
|
||||
ledpin.set_high().unwrap();
|
||||
let (st, installed) = s.uninit(rx, tx);
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
use bsp::entry;
|
||||
use defmt::*;
|
||||
use defmt_rtt as _;
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
|
||||
use panic_probe as _;
|
||||
|
||||
use rp2040_hal::xosc::CrystalOscillator;
|
||||
// Provide an alias for our BSP so we can switch targets quickly.
|
||||
// Uncomment the BSP you included in Cargo.toml, the rest of the code does not need to change.
|
||||
use rp_pico as bsp;
|
||||
|
@ -28,7 +27,6 @@ use crate::joybus::datatransfer;
|
|||
mod gccstate;
|
||||
mod joybus;
|
||||
mod pio;
|
||||
mod types;
|
||||
|
||||
#[entry]
|
||||
fn main() -> ! {
|
||||
|
|
17
src/types.rs
17
src/types.rs
|
@ -1,17 +0,0 @@
|
|||
struct GccState {
|
||||
a: u8,
|
||||
b: u8,
|
||||
x: u8,
|
||||
y: u8,
|
||||
start: u8,
|
||||
dup: u8,
|
||||
dleft: u8,
|
||||
dright: u8,
|
||||
ddown: u8,
|
||||
l: u8,
|
||||
r: u8,
|
||||
lstickx: i8,
|
||||
lsticky: i8,
|
||||
rstickx: i8,
|
||||
rsticky: i8,
|
||||
}
|
Loading…
Reference in a new issue