forked from tessel/t1-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
API.txt
52 lines (31 loc) · 1.67 KB
/
API.txt
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
# SPI
SPI master connections to slave devices.
int hw_spi_initialize (size_t port, uint32_t clockspeed, uint8_t spimode, uint8_t cpol, uint8_t cpha, uint8_t frameformat)
Enable SPI port with initialized settings. bitorder: `HW_LSB` or `HW_MSB`. cpol: `HW_LOW` or `HW_HIGH`. cpha: `HW_FIRST` or `HW_SECOND`.
int hw_spi_enable (size_t port)
Enable SPI port.
int hw_spi_disable (size_t port)
Disable SPI port.
int hw_spi_transfer (size_t port, uint8_t *txbuf, uint8_t *rxbuf, size_t buf_len, size_t* buf_read)
Send and receive data from SPI slave synchronously.
int hw_spi_send (size_t port, uint8_t *txbuf, size_t buf_len)
Send data to SPI slave synchronously.
int hw_spi_receive (size_t port, uint8_t *rxbuf, size_t buf_len, size_t* buf_read)
Receive data from SPI slave synchronously.
int hw_spi_transfer_async (tm_loop_t loop, tm_callback_t callback, size_t port, uint8_t *txbuf, uint8_t *rxbuf, size_t buf_len, size_t* buf_read)
Send and receive data from SPI slave synchronously.
int hw_spi_send_async (tm_loop_t loop, tm_callback_t callback, size_t port, uint8_t *txbuf, size_t buf_len, size_t* buf_read)
Send data to SPI slave synchronously.
int hw_spi_receive_async (tm_loop_t loop, tm_callback_t callback, size_t port, uint8_t *rxbuf, size_t buf_len, size_t* buf_read)
Receive data from SPI slave synchronously.
## SPI Slave
Slave functionality. hw_spi_slave_buffer_set, hw_spi_slave_buffer_get
int hw_spi_slave_enable ()
int hw_spi_slave_disable ()
int hw_spi_slave_receive () ...
int hw_spi_slave_transfer () ...
int hw_spi_slave_send () ...
# PWM
Pulse-width modulation.
int hw_pwm_enable (size_t pin, hw_pwm_t mode, uint32_t period, uint32_t pulsewidth)
Enables PWM for a pin.