PololuRust/lib.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
#![allow(non_snake_case)]
#![allow(unused)]
use std::error::Error;
use std::thread;
use std::time::Duration;
// Gpio uses BCM pin numbering. BCM GPIO 23 is tied to physical pin 16.
const GPIO_UART_TX: u8 = 14;
struct PololuController {
target:[u8; 24],
min:[u8; 24],
max:[u8; 24],
pololuHeader : u8
}
impl PololuController {
pub fn new () -> Self {
return PololuController {
target: [0; 24],
min: [0; 24],
max: [0; 24],
//170: AA in decimal
//12: default device id
pololuHeader: 170 + 12
}
}
}
#[cfg(test)]
mod tests {
// use rppal::{
// uart::{
// Parity,
// Uart,
// Result,
// },
// system::DeviceInfo,
// };
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
// #[test]
// fn lights() -> () {
// // println!("Blinking an LED on a {}.", super::DeviceInfo::new().unwrap().model());
// let mut uart: Uart = Uart::new(115_200, Parity::None, 8u8, 1u8).unwrap();
// // uart.set_baud_rate(115_200u32);
// uart.set_baud_rate(50u32);
// uart.send_start();
// let buffer: &[u8; 1usize] = &[0x01u8];
// loop {
// uart.write(buffer);
// }
// // Blink the LED by setting the pin's logic level high for 500 ms.
// // uart.set_high();
// // thread::sleep(Duration::from_millis(500));
// // uart.set_low();
// // Ok(())
// }
}