aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32f1/gpio.c
Commit message (Collapse)AuthorAgeFilesLines
* stm32f1: Add support for gpio_x_reset()Kevin O'Connor2018-08-271-12/+26
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stm32f1: implement spi_prepareGrigori Goronzy2018-07-081-3/+2
| | | | | | | | | | | | | | | | | | Implement spi_prepare to fix the undefined behavior on SPI transaction start. Tested with the following command sequence: allocate_oids count=2 config_spi oid=0 bus=0 pin=PA8 mode=3 rate=1000000 shutdown_msg= config_spi oid=1 bus=0 pin=PA8 mode=1 rate=1000000 shutdown_msg= spi_send oid=0 data=30313233343536373839 spi_transfer oid=1 data=3031 Discussion about this here: https://github.com/KevinOConnor/klipper/pull/453#issuecomment-403131149 Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* SPI: introduce spi_prepare functionGrigori Goronzy2018-07-081-0/+5
| | | | | | | | | | | | | | | | The SPI interface needs to be enabled and configured to the correct settings of a given oid before CS is asserted. The new function spi_prepare() allows ports to do that. This port only introduces the new function in all ports with no implementation and adds the call to the Klipper generic firmware code. That means everything still works as before. Ports need to be changed to fix the underlying issue. Discussion about the motivation here: https://github.com/KevinOConnor/klipper/pull/453#issuecomment-403131149 Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stm32f1: add SPI supportGrigori Goronzy2018-07-071-0/+101
| | | | | | | | | Add basic SPI support and associated documentation. v2: remove baud rate check, fix baud rate calculations v3: finish transaction with BSY check, disable SPI when not in use Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stm32f1: fix ADC pin listGrigori Goronzy2018-06-271-1/+1
| | | | | | | For some reason, the upper two pin definitions were missing. Found while writing the port documentation. Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
* stepper: Introduce and use gpio_out_toggle_noirq()Kevin O'Connor2018-05-151-1/+9
| | | | | | | | | | | | | | | The gpio_out_toggle() function in the sam3x8e and stm32f1 code was only valid if it was called with irqs disabled. Commits 018c5daa and 9c52ad43 enabled the lcd code which called gpio_out_toggle() with irqs enabled. This could cause corruption of the gpio state. Introduce a gpio_out_toggle_noirq() function that will only be invoked with irqs disabled, and fix gpio_out_toggle() on sam3x8e and stm32f1 so that it safe to call even if irqs are enabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Add STM32F103 portGrigori Goronzy2018-04-091-0/+213
Add a fully functional STM32F1 port, currently mostly targeting STM32F103 microcontrollers. This requires an 8 MHz XTAL. The maximum possible step rate is around 282K steps per second. This uses stm32flash to burn the firmware. The bootloader needs to be started by setting BOOT0 to 1 and resetting the MCU. There is no automatic bootloader, unlike on Arduino. Signed-off-by: Grigori Goronzy <greg@kinoho.net>