| Author | William Welch Copyright © 2009..2025, all rights reserved. |
| Adapted-by | Sebastien Lelong, Rob Jansen |
| Compiler | 2.5r9 |
SPI host hardware control.
Routines for sending and receiving through the SPI in host mode
Good overview of SPI at http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
Also at: http://elm-chan.org/docs/spi_e.html
spi_host_hw_set_mode_10()
spi_host_hw_set_mode_01()
spi_host_hw'put(byte in data)
spi_host_hw_set_mode_00()
spi_host_hw_set_mode(byte in spi_mode)
spi_host_hw_set_speed(byte in spi_rate)
spi_init(byte in spi_mode, byte in spi_rate)
spi_host_hw_set_mode_11()
spi_host_hw_set_mode_10()
Clock SPI data when SCK goes from high to low. SCK is inactive high.
spi_host_hw_set_mode_01()
Clock SPI data when SCK goes from high to low. SCK is inactive low.
spi_host_hw'put(byte in data)
Half-duplex convenience function. send data to slave, discard reply.
spi_host_hw_set_mode_00()
Clock SPI data when SCK goes from low to high. SCK is low inactive low.
spi_host_hw_set_mode(byte in spi_mode)
Specify SPI mode. See spi_common.jal for predefined constants you can use as parameter.
spi_host_hw_set_speed(byte in spi_rate)
Set the SPI host speed, see spi_common.jal. Some newer PICs have a separate baud rate register, in that case SCK = Fosc / (2 * (spi_rate + 1)).
spi_init(byte in spi_mode, byte in spi_rate)
Initialize the SPI registers and enable the SPI interface.
spi_host_hw_set_mode_11()
Clock SPI data when SCK goes from low to high. SCK is inactive high.
spi_host_hw'get() return byte
Half-duplex convenience function. send 0xFF, get slave data.
spi_host_hw_exchange(byte in m_data) return byte
SPI is full-duplex, so we exchange host and slave data byte.
| 16f1823 | 16f1823_nrf24l01.jal |
| 16f1825 | 16f1825_mcp23s08.jal |
| 16f1825 | 16f1825_nrf24l01.jal |
| 18f15q40 | 18f15q40_mcp23s08.jal |
| 18f15q40 | 18f15q40_spi.jal |
| 18f15q40 | 18f15q40_dma_glcd_ili9341.jal |