mirror of
https://github.com/marcriera/ddgo-pnp-controller.git
synced 2025-05-18 13:48:34 +02:00
Fix input reading bug, module subdivision
This commit is contained in:
parent
52a4d6eb62
commit
4c18e70ce8
6 changed files with 59 additions and 34 deletions
36
src/controller/emulated.rs
Normal file
36
src/controller/emulated.rs
Normal file
|
@ -0,0 +1,36 @@
|
|||
use crate::state::ControllerState;
|
||||
mod dgoc44u;
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum ControllerModel {
|
||||
NONE,
|
||||
DGOC44U,
|
||||
TYPE2,
|
||||
}
|
||||
|
||||
pub fn set_model(state: &ControllerState) -> ControllerModel {
|
||||
if state.button_right {
|
||||
println!("Selected controller DGOC44-U.");
|
||||
return ControllerModel::DGOC44U;
|
||||
}
|
||||
else if state.button_up {
|
||||
println!("Selected controller TCPP-20009.");
|
||||
return ControllerModel::TYPE2;
|
||||
}
|
||||
else {
|
||||
println!("No controller selected.");
|
||||
return ControllerModel::NONE;
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_state(state: &mut ControllerState, model: &ControllerModel) {
|
||||
match model {
|
||||
ControllerModel::DGOC44U => {
|
||||
dgoc44u::update_gadget(state);
|
||||
}
|
||||
ControllerModel::TYPE2 => {
|
||||
|
||||
}
|
||||
ControllerModel::NONE => (),
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue