Robot Control Library
spi.h File Reference
#include <stdint.h>
#include <linux/spi/spidev.h>

Go to the source code of this file.

Macros

#define RC_SPI_MAX_SPEED   24000000
 24mhz More...
 
#define RC_SPI_MIN_SPEED   1000
 1khz More...
 
#define RC_SPI_BITS_PER_WORD   8
 only allow for 8-bit words More...
 
#define RC_BB_SPI1_SS1   1,0
 bus and slave to use for Robotics Cape and BeagleBone Blue SPI1.1 port More...
 
#define RC_BB_SPI1_SS2   1,1
 bus and slave to use for Robotics Cape and BeagleBone Blue SPI1.2 port More...
 
#define RC_CAPE_SS1_GPIO   3,17
 Robotics Cape SPI1 SS1 gpio P9_28, normally AUTO mode. More...
 
#define RC_CAPE_SS2_GPIO   1,17
 Robotics Cape SPI1 SS2 gpio P9_23, normally MANUAL GPIO mode. More...
 
#define RC_BLUE_SS1_GPIO   0,29
 BeagleBone Blue SPI1 SS1 gpio 0_29 pin H18. More...
 
#define RC_BLUE_SS2_GPIO   0,7
 BeagleBone Blue SPI1 SS2 gpio 0_7 pin H18. More...
 

Functions

int rc_spi_init_auto_slave (int bus, int slave, int bus_mode, int speed_hz)
 Initializes an SPI bus. More...
 
int rc_spi_init_manual_slave (int bus, int slave, int bus_mode, int speed_hz, int chip, int pin)
 Initializes an SPI bus and GPIO pin for use as a manual SPI slave select pin. More...
 
int rc_spi_get_fd (int bus, int slave)
 fetches the file descriptor for a specified slave so the user can do more advanced IO operations than what's presented here More...
 
int rc_spi_close (int bus)
 Closes and cleans up the bus for specified slave. More...
 
int rc_spi_manual_select (int bus, int slave, int select)
 Manually selects or deselects a slave. More...
 
int rc_spi_transfer (int bus, int slave, uint8_t *tx_data, size_t tx_bytes, uint8_t *rx_data)
 Send any sequence of bytes and read the response. More...
 
int rc_spi_write (int bus, int slave, uint8_t *data, size_t bytes)
 Writes data to specified slave. More...
 
int rc_spi_read (int bus, int slave, uint8_t *data, size_t bytes)
 Reads data from a specified slave. More...