# spi_host_hw

SPI host

Author | William Welch Copyright © 2009, all rights reserved.
Adapted-by | Sebastien Lelong
Compiler | 2.4l

Description

    SPI host hardware control.
    Routines for sending and receiving through the SPI in host mode

Sources

    good overview of SPI at http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
    also at: http://elm-chan.org/docs/spi_e.html

Dependencies

- spi_common

## Summary

### Global variables/contants

### Procedures

- `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()`

### Functions

- `spi_host_hw'get() return byte`
- `spi_host_hw_exchange(byte in m_data) return byte`

## API details

### Global variables/contants

### Procedures

- `spi_host_hw_set_mode_10()`

  No documentation found

- `spi_host_hw_set_mode_01()`

  No documentation found

- `spi_host_hw'put(byte in data)`

      half-duplex convenience function. send data to slave, discard reply

- `spi_host_hw_set_mode_00()`

  No documentation found

- `spi_host_hw_set_mode(byte in spi_mode)`

      Specify SPI mode (see spi_common for predefined constant you can use
      as parameters)

- `spi_host_hw_set_speed(byte in spi_rate)`

  No documentation found

- `spi_init(byte in spi_mode, byte in spi_rate)`

      Initialize the SPI registers.
      Note: check your datasheet -- TRIS settings, any SPI errata?

- `spi_host_hw_set_mode_11()`

  No documentation found

### Functions

- `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

## Related samples

Here are the list of samples which use this library:

16f1823 | 16f1823_nrf24l01.jal
16f1825 | 16f1825_nrf24l01.jal
16f1825 | 16f1825_mcp23s08.jal