From f70fefa06f9fe1aaca8c6303f0ee9e904a6f3623 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 4 May 2018 20:23:58 -0400 Subject: linux: Convert linux SPI code to use the generic spicmds.c code Use the generic spi send/receive code on Linux. Update the replicape code to use the updated command format. Also, update the replicape code to turn off the stepper motors on a shutdown event. Signed-off-by: Kevin O'Connor --- src/linux/gpio.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/linux/gpio.h') diff --git a/src/linux/gpio.h b/src/linux/gpio.h index a2c92520..74d9db37 100644 --- a/src/linux/gpio.h +++ b/src/linux/gpio.h @@ -3,6 +3,13 @@ #include // uint8_t +struct gpio_out { + uint32_t pin; +}; +struct gpio_out gpio_out_setup(uint8_t pin, uint8_t val); +void gpio_out_toggle(struct gpio_out g); +void gpio_out_write(struct gpio_out g, uint8_t val); + struct gpio_adc { int fd; }; @@ -11,4 +18,11 @@ uint32_t gpio_adc_sample(struct gpio_adc g); uint16_t gpio_adc_read(struct gpio_adc g); void gpio_adc_cancel_sample(struct gpio_adc g); +struct spi_config { + int fd; +}; +struct spi_config spi_setup(uint32_t bus, uint8_t mode, uint32_t rate); +void spi_transfer(struct spi_config config, uint8_t receive_data + , uint8_t len, uint8_t *data); + #endif // gpio.h -- cgit v1.2.3-70-g09d2