From aab89e7f85d01fffb349b2046daebdc0deb1ce92 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 24 Mar 2019 10:25:56 +0100 Subject: linux: add support for Linux hardware PWM The replicape servo pins (P9_14/P9_16) are muxed to the SOCs hardware PWM unit driven by a 13MHz GP timer. They have to be driven by the linux host mcu. This commits adds hardware PWM support using the linux sysfs user space interface. Signed-off-by: Janne Grunau Signed-off-by: Kevin O'Connor --- src/linux/gpio.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/linux/gpio.h') diff --git a/src/linux/gpio.h b/src/linux/gpio.h index ff8e0cc2..d177581c 100644 --- a/src/linux/gpio.h +++ b/src/linux/gpio.h @@ -28,4 +28,11 @@ void spi_prepare(struct spi_config config); void spi_transfer(struct spi_config config, uint8_t receive_data , uint8_t len, uint8_t *data); +struct gpio_pwm { + int fd; + uint32_t period; +}; +struct gpio_pwm gpio_pwm_setup(uint8_t pin, uint32_t cycle_time, uint16_t val); +void gpio_pwm_write(struct gpio_pwm g, uint16_t val); + #endif // gpio.h -- cgit v1.2.3-70-g09d2