-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.rs
More file actions
42 lines (33 loc) · 976 Bytes
/
lib.rs
File metadata and controls
42 lines (33 loc) · 976 Bytes
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
use pyo3::{ffi::c_str, prelude::*};
mod common;
mod flash;
mod hosts;
use pyo3_stub_gen::define_stub_info_gatherer;
use hosts::minimal::MinimalClient;
use hosts::servo::ServoClient;
/// This module hosts Python wrappers for communicating with Bluepill Rust firmware.
#[pymodule]
fn rustpill_clients(m: &Bound<'_, PyModule>) -> PyResult<()> {
Python::with_gil(|py| {
py.run(
c_str!(
"
import logging
if not logging.getLogger().hasHandlers():
FORMAT = \"%(levelname)s %(name)s %(message)s\"
logging.basicConfig(format=FORMAT)
logging.getLogger().setLevel(logging.INFO)
"
),
None,
None,
)
})?;
pyo3_log::init();
m.add_function(wrap_pyfunction!(flash::check_probe_rs, m)?)?;
m.add_function(wrap_pyfunction!(flash::flash_binary, m)?)?;
m.add_class::<MinimalClient>()?;
m.add_class::<ServoClient>()?;
Ok(())
}
define_stub_info_gatherer!(stub_info);