Author | Matthew Schinkel - borntechi.com, copyright © 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4o |
SPI Hardware Slave library for exchanging data through SPI bus.
http://www.justanotherlanguage.org/content/jallib/tutorials/tutorial_spi_introduction Jallib spi_master_hw library - Written by William Welch http://ww1.microchip.com/downloads/en/devicedoc/spi.pdf
const byte _SPI_SLAVE_HW_FULL = 1
var byte spi_slave_hw_rx_byte_count = 0
var byte _spi_slave_hw_buffer_tx_status = _SPI_SLAVE_HW_EMPTY
var byte spi_slave_hw_rx_byte_count_old = 0
const byte _SPI_SLAVE_HW_EMPTY = 0
spi_slave_hw'put(byte in data)
spi_slave_initerrupt()
spi_slave_hw_sync()
spi_slave_init(byte in spi_mode)
spi_slave_hw'get() return byte
spi_slave_hw_packet_available'get() return bit
spi_slave_hw_exchange(byte in data) return byte
const byte _SPI_SLAVE_HW_FULL = 1
No documentation found
var byte spi_slave_hw_rx_byte_count = 0
spi slave initerrupt
var byte _spi_slave_hw_buffer_tx_status = _SPI_SLAVE_HW_EMPTY
No documentation found
var byte spi_slave_hw_rx_byte_count_old = 0
No documentation found
const byte _SPI_SLAVE_HW_EMPTY = 0
tx out buffer state
spi_slave_hw'put(byte in data)
wait to receive data from the spi port (wait for chip select to go low, and clock pulses to come in from master)
spi_slave_initerrupt()
No documentation found
spi_slave_hw_sync()
Synchronize SPI. Sets SPI bit counter to 0 to sync received data. You should use this if you set SPI_SLAVE_HW_SYNCHRONOUS == FALSE, or if you don't use pin_ss for chip select. On a stable wire, you don't need to use this but it is recommended that you use it once per packet. On an unstable wire, you should use this more often. Maybe even after every byte recieved.
spi_slave_init(byte in spi_mode)
spi slave init
spi_slave_hw'get() return byte
wait to transmit data to spi port (wait for chip select to go low, and clock pulses to come in from master)
spi_slave_hw_packet_available'get() return bit
check if there is a packet available, for interrupts + packets enabled.
spi_slave_hw_exchange(byte in data) return byte
wait to exchange data through the spi port (wait for chip select to go low, and clock pulses to come in from master)
18f4620 | 18f4620_spi_to_serial.jal |
18f4620 | 18f4620_spi_slave_hw.jal |