wrote some ffi functions and interfaces
tested the fact that the rust library could be used in a embedded application
This commit is contained in:
@ -1,3 +1,26 @@
|
||||
#![no_std]
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[panic_handler]
|
||||
fn panik(_panic_state: &PanicInfo) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
extern {
|
||||
fn gpio_put_explict(pin: i32, status: bool) -> i32;
|
||||
fn sleep_ms(time: i32) -> i32;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn set_and_sleep(pin: i32, status: bool, time: i32) -> () {
|
||||
unsafe {
|
||||
gpio_put_explict(pin, status);
|
||||
sleep_ms(time);
|
||||
}
|
||||
}
|
||||
|
||||
// this is just a mock test, supposed to pass
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
|
Reference in New Issue
Block a user