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
use
super::*;
pub const HAL_SPI_MODE_MASTER: u32 = 1;
pub const HAL_SPI_MODE_SLAVE: u32 = 2;
pub type __uint8_t = ::cty::c_uchar;
pub type __uint16_t = ::cty::c_ushort;
pub type __int32_t = ::cty::c_int;
pub type __uint32_t = ::cty::c_uint;
#[repr(C)]
#[derive(Default, Copy, Clone)]
pub struct spi_config_t {
pub mode: u8,
pub freq: u32,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct spi_dev_t {
pub port: u8,
pub config: spi_config_t,
pub priv_: *mut ::cty::c_void,
}
impl Default for spi_dev_t {
fn default() -> Self {
unsafe { ::core::mem::zeroed() }
}
}
#[safe_wrap(_)] extern "C" {
pub fn hal_spi_transfer(
spi_dev: *mut spi_dev_t,
xfer: *mut ::cty::c_void,
size: u8,
) -> ::cty::c_int;
}
#[safe_wrap(_)] extern "C" {
pub fn spi_init(
spi: *mut spi_dev_t,
port: u8,
mode: u8,
polar_phase: u8,
freq: u32,
tx_dma_ch: u8,
rx_dma_ch: u8,
pin_clk: u8,
pin_cs: u8,
pin_mosi: u8,
pin_miso: u8,
) -> ::cty::c_int;
}