added serial demo and fixed some issues with str

This commit is contained in:
ZennDev1337 2023-09-20 21:34:21 +02:00
parent 5dbe66e910
commit 82650ccdd8
9 changed files with 510 additions and 163 deletions

View file

@ -7,13 +7,7 @@ use arduboy_rust::prelude::*;
#[allow(dead_code)]
const arduboy: Arduboy2 = Arduboy2::new();
extern "C" {
#[link_name = "arduino_serial_begin"]
fn serial_begin(serial: c_ulong);
// #[link_name = "arduino_serial_println_chars"]
// fn serial_println_chars(cstr: *const c_char);
}
// Progmem data
// dynamic ram variables
@ -25,7 +19,7 @@ pub unsafe extern "C" fn setup() {
arduboy.begin();
arduboy.set_frame_rate(30);
arduboy.clear();
serial_begin(9600)
// serial::begin(9600)
}
// The loop() function repeats forever after setup() is done
@ -36,7 +30,15 @@ pub unsafe extern "C" fn loop_() {
if !arduboy.next_frame() {
return;
}
serial::print("velo\0");
// if serial::available() > 0 {
// let intcoming_byte = serial::read_as_utf8_str();
// serial::print("I received: \0");
// serial::println(intcoming_byte);
// }
if arduboy.pressed(A) {
//serial::print("kekw")
}
//serial_println_chars(b"hallo\0" as *const [u8] as *const i8);
arduboy.display();
}