aboutsummaryrefslogtreecommitdiffstats
path: root/src/linux
Commit message (Collapse)AuthorAgeFilesLines
* linux: implement i2cArksine2020-01-134-1/+112
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* spicmds: Rework spi config commandsKevin O'Connor2019-08-061-2/+2
| | | | | | | | | | Rework the spi_config commands so that bus configuration and shutdown message configuration is done separately from the main "config_spi" command. This makes the spi configuration more flexible. It's now possible to use software spi without a CS pin. It's now possible to define multiple SPI messages to send on a shutdown event. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: add support for Linux hardware PWMJanne Grunau2019-04-056-4/+110
| | | | | | | | | | 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 <janne-3d@jannau.net> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Convert SPI to use enumerationsKevin O'Connor2019-04-041-1/+10
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Use enumerations for pin mappingsKevin O'Connor2019-03-171-0/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Always pass a string to the DECL_CONSTANT() macroKevin O'Connor2019-03-174-4/+4
| | | | | | | | Make it clear that the name of the constant being defined is a string. When the value being defined is also a string, use a new DECL_CONSTANT_STR() macro. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Add support for bi-directional SPI communicationRicardo Amezquita2018-07-242-5/+33
| | | | | Signed-off-by: Ricardo Amézquita <ramezquitao@cihologramas.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* SPI: introduce spi_prepare functionGrigori Goronzy2018-07-082-0/+6
| | | | | | | | | | | | | | | | 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>
* command: Add command_find_and_dispatch() helperKevin O'Connor2018-05-281-3/+1
| | | | | | | Add a helper function that calls command_find_block() followed by command_dispatch(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Add a command_encode_and_frame() helperKevin O'Connor2018-05-281-2/+1
| | | | | | | Add a helper function that calls command_encodef() followed by command_add_frame(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Prefer uint8_t* for buffers; prefer uint8_fast_t for lengthsKevin O'Connor2018-05-281-4/+4
| | | | | | | | | Prefer using 'uint8_t' buffers as it is too easy to run into C sign extension problems with 'char' buffers. Prefer using 'uint_fast8_t' for buffer lengths as gcc does a better job compiling them on 32bit mcus. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Introduce and use gpio_out_toggle_noirq()Kevin O'Connor2018-05-151-0/+1
| | | | | | | | | | | | | | | 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>
* linux: Convert linux SPI code to use the generic spicmds.c codeKevin O'Connor2018-05-073-11/+38
| | | | | | | | | | 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>
* linux: Remove unneeded includes from timer.cKevin O'Connor2017-10-231-2/+0
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Fix typo causing config_reset to not fully restartKevin O'Connor2017-10-151-1/+1
| | | | | | A typo in the code caused the wrong config_reset code to be run. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Open watchdog device after consoleKevin O'Connor2017-10-151-7/+5
| | | | | | | | Only open the watchdog device after the console has been opened. The machine should not reboot in the unlikely event the console can't be opened. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Make sure to close fd on analog/pca9685 init failureKevin O'Connor2017-10-142-11/+17
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pca9685: Fix missing devices_count incrementKevin O'Connor2017-10-131-0/+1
| | | | | | The devices_count was not being incremented on each device add. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pca9685: Support default valuesKevin O'Connor2017-10-121-21/+31
| | | | | | Allow the pwm pin to have a non-zero default value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* adccmds: Continue to query analog inputs after a shutdownKevin O'Connor2017-10-121-1/+2
| | | | | | | | Continue to sample the ADC input pins even if the MCU goes into a shutdown state. This enables the printer to continue reporting temperatures even on an mcu error. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Don't shutdown on a "timer in the past" if already shutdownKevin O'Connor2017-10-121-3/+2
| | | | | | A shutdown will not help if the mcu is already in a shutdown state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Update installation and flash scriptsKevin O'Connor2017-09-201-0/+4
| | | | | | | | | Update the scripts used to install and "flash" the pru micro-controller code. Also, add a "flash" script for the linux micro-controller code. This makes it easier to install Klipper on a Beaglebone board that uses a Replicape. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Add support for analog IIO devicesKevin O'Connor2017-09-204-1/+81
| | | | | | | | Add support for reading analog values via the standard Linux IIO interface. This can be used on Replicape boards to sample analog input pins. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Add support for spidev devicesKevin O'Connor2017-09-202-1/+69
| | | | | | | | Add support for sending SPI messages to devices via the standard Linux SPI interface. This can be used to configure the shift registers on Replicape boards. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Add support for pca9685 i2c pwm devicesKevin O'Connor2017-09-204-2/+210
| | | | | | | Add support for controlling pca9685 PWM drivers using the standard Linux I2C interface. The pca9685 device is found on Replicape boards. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Initial support for running Klipper in a Linux real-time processKevin O'Connor2017-09-207-0/+617
Add support for compiling the Klipper micro-controller code as a real-time process capable of running on standard Linux systems. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>