#include "spi_functions.h"
Go to the source code of this file.
Macros | |
#define | SUCCESS 1 |
Modified from SPI testing utility (using spidev driver) Linux/Documentation/spi/spidev_test.c. More... | |
#define | FAILURE 0 |
Functions | |
int | pabort (const char *s) |
int | spi_init (uint8_t mode, uint32_t speed, uint8_t cs) |
spi Functions to deal communication by SPI protocol More... | |
void | spi_end (int spi_dev) |
TERMINATES SPI DEVICE. More... | |
int | adc_read (int spi_dev, uint8_t ch, uint8_t sgl, short int *data) |
READ DATA FROM A/D CONVERTER MCP3208. More... | |
int | dac_write (int spi_dev, uint8_t ch, uint8_t _shdn, unsigned short int data) |
WRITE DATA TO D/A CONVERTER MCP3922. More... | |
int | spi_trans_bytes (int spi_dev, uint8_t *send, uint8_t *receive, int n) |
TRANSFER N BYTES. More... | |
Variables | |
static uint8_t | bits = 8 |
static uint16_t | delay |
#define FAILURE 0 |
Definition at line 9 of file spi_functions.c.
Referenced by adc_read(), dac_write(), and spi_trans_bytes().
#define SUCCESS 1 |
Modified from SPI testing utility (using spidev driver) Linux/Documentation/spi/spidev_test.c.
Definition at line 8 of file spi_functions.c.
Referenced by adc_read(), dac_write(), and spi_trans_bytes().
int adc_read | ( | int | spi_dev, |
uint8_t | ch, | ||
uint8_t | sgl, | ||
short int * | data | ||
) |
READ DATA FROM A/D CONVERTER MCP3208.
ch | Set Channel (0 .. 7) |
sgl | (0: to single or 1: to pseudo-differencial) |
Definition at line 172 of file spi_functions.c.
References ARRAY_SIZE, delay, FAILURE, and SUCCESS.
Referenced by read_all_data().
int dac_write | ( | int | spi_dev, |
uint8_t | ch, | ||
uint8_t | _shdn, | ||
unsigned short int | data | ||
) |
WRITE DATA TO D/A CONVERTER MCP3922.
Definition at line 200 of file spi_functions.c.
References ARRAY_SIZE, delay, FAILURE, and SUCCESS.
Referenced by actuate().
int pabort | ( | const char * | s | ) |
Definition at line 11 of file spi_functions.c.
Referenced by spi_init().
void spi_end | ( | int | spi_dev | ) |
TERMINATES SPI DEVICE.
Definition at line 166 of file spi_functions.c.
int spi_init | ( | uint8_t | mode, |
uint32_t | speed, | ||
uint8_t | cs | ||
) |
spi Functions to deal communication by SPI protocol
INITIALIZE SPI DEVICE
Definition at line 100 of file spi_functions.c.
References bits, and pabort().
Referenced by devices_init().
int spi_trans_bytes | ( | int | spi_dev, |
uint8_t * | send, | ||
uint8_t * | receive, | ||
int | n | ||
) |
TRANSFER N BYTES.
Fix this to show all data
Definition at line 228 of file spi_functions.c.
References ARRAY_SIZE, delay, FAILURE, and SUCCESS.
Referenced by enc_read_pos(), enc_wait_for_ack(), and enc_zero_set().
|
static |
Definition at line 18 of file spi_functions.c.
Referenced by conv_byte_hex_bin(), and spi_init().
|
static |
Definition at line 20 of file spi_functions.c.
Referenced by adc_read(), dac_write(), and spi_trans_bytes().