rrivirr / rriv-rust

GNU General Public License v3.0
3 stars 4 forks source link

control interface service #23

Open misterinterrupt opened 1 year ago

misterinterrupt commented 1 year ago

create an integrated usage of the control interface that uses the board object and also connects the control interface to the serial interrupt

ZavenArra commented 1 year ago

main(){ 

  board  = Board::new()

  command_registry = CommandRegistry()
  control_interface = ControlInterface(command_registry)
  board.registerProcessCommandCallback(control_interface.process_command)

  Loop {
    control_interface.process_command()
  }

}

—--------------

main(){ 

  board  = Board::new()

  // init services
  control_interface = ControlInterface(board)

  Loop {
    control_interface.runloop()
  }

}

ControlInterface.new(board) {
  command_registry = CommandRegistry()  // command registry is a struct property
  control_interface = ControlInterface(command_registry)       
  board.registerProcessCommandCallback(control_interface.process_command)
}

—---------------

main(){  // entry

  board  = Board::new() // init board

  rriv = RRIV.init(board) // init app

  Loop {
    rriv.runloop()
  }

}

RRIV.new(board) {
   // init services
  control_interface = ControlInterface(board)

}

RRIV.runloop() {
  control_interface.runstep()
}