diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-05-04 20:23:58 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-05-07 09:10:34 -0400 |
commit | f70fefa06f9fe1aaca8c6303f0ee9e904a6f3623 (patch) | |
tree | d806c232bef22284960c8d9911cd6b8cc8306b30 /src/linux/gpio.h | |
parent | 31ae74c56c9663fdbcc8f332efd0e331d2e024ff (diff) | |
download | kutter-f70fefa06f9fe1aaca8c6303f0ee9e904a6f3623.tar.gz kutter-f70fefa06f9fe1aaca8c6303f0ee9e904a6f3623.tar.xz kutter-f70fefa06f9fe1aaca8c6303f0ee9e904a6f3623.zip |
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 <kevin@koconnor.net>
Diffstat (limited to 'src/linux/gpio.h')
-rw-r--r-- | src/linux/gpio.h | 14 |
1 files changed, 14 insertions, 0 deletions
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 <stdint.h> // 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 |