robokit
: The short-term goal is to build an automated machine for grid beam production.
The long-term goal is to provide a (real-time interrupt-driven) actor-based foundation for robotic automation or CNC machine control.
If you're here and like what's happening, please give this a star and say hi! 👋
no-std
environments(for Nucleo-F767ZI)
```rust
use blinky as _;
use core::task::Poll; use cortexmrt::entry; use defmt::Debug2Format; use fugit::ExtU32; use robokit::{ actuatorset, Command, LedAction, LedDevice, RobotBuilder, Sensor, SuperTimer, SwitchDevice, SwitchStatus, }; use stm32f7xxhal::{pac, prelude::*};
use blinky::init_heap;
const TICKTIMERHZ: u32 = 1000000; const ACTIVECOMMANDSCOUNT: usize = 1;
actuator_set!(
Led { Green, Blue, Red },
LedAction
fn getruncommands fn main() -> ! {
init_heap(); }
``` See Copyright 2023 Village Kit Limited Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.[entry]
defmt::println!("Init!");
let p = pac::Peripherals::take().unwrap();
let rcc = p.RCC.constrain();
let clocks = rcc.cfgr.sysclk(216.MHz()).freeze();
let gpiob = p.GPIOB.split();
let gpioc = p.GPIOC.split();
let tick_timer = p.TIM5.counter_us(&clocks);
let mut super_timer = SuperTimer::new(tick_timer, u32::MAX);
let user_button_pin = gpioc.pc13.into_floating_input();
let user_button_timer = super_timer.sub();
let mut user_button = SwitchDevice::new_active_high(user_button_pin, user_button_timer);
let green_led_pin = gpiob.pb0.into_push_pull_output();
let green_led_timer = super_timer.sub();
let green_led = LedDevice::new(green_led_pin, green_led_timer);
let blue_led_pin = gpiob.pb7.into_push_pull_output();
let blue_led_timer = super_timer.sub();
let blue_led = LedDevice::new(blue_led_pin, blue_led_timer);
let red_led_pin = gpiob.pb14.into_push_pull_output();
let red_led_timer = super_timer.sub();
let red_led = LedDevice::new(red_led_pin, red_led_timer);
let mut robot = RobotBuilder::new()
.with_leds(LedSet::new(green_led, blue_led, red_led))
.build()
.with_run_commands(&get_run_commands())
.build::<ACTIVE_COMMANDS_COUNT>();
super_timer.setup().expect("Failed to setup super time");
loop {
super_timer.tick().expect("Failed to tick super timer");
if let Some(user_button_update) = user_button.sense().expect("Error reading user button") {
if let SwitchStatus::On = user_button_update.status {
robot.toggle();
}
}
if let Poll::Ready(Err(err)) = robot.poll() {
defmt::println!("Unexpected error: {}", Debug2Format(&err));
robot.stop();
}
}
Development
docs/dev.md
License
http://www.apache.org/licenses/LICENSE-2.0