aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr
Commit message (Collapse)AuthorAgeFilesLines
* avr: Allow I2C bus speed to be set by Klipper (#6111)Dr. Matthew Swabey2023-03-211-20/+16
| | | | | Allow I2C bus speed to be set by appropriate Klipper commands. Signed-off-by: Matthew Swabey <matthew@swabey.org>
* avr: No need to define bootloader_request()Kevin O'Connor2022-12-301-6/+0
| | | | | | | Since avr does not define HAVE_BOOTLOADER_REQUEST it is not necessary to define the function. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_cdc: Rename usb_request_bootloader() to bootloader_request()Kevin O'Connor2022-07-291-1/+2
| | | | | | | Rename this board API function to a more generic name. This is in preparation for calling the function from the canbus code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Make step pulse duration customizable at run-timeKevin O'Connor2021-11-041-3/+0
| | | | | | | | | | | | Remove the STEP_DELAY Kconfig option and replace it with a per-stepper step_pulse_duration printer.cfg config option. The AVR code will continue to have optimized code to step and "unstep" in the same function (which is automatically activated when the step delay is 40 ticks or less). This change removes the Kconfig option for single function step/unstep on 32bit processors. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Fix typo causing broken gpio mappingsKevin O'Connor2021-08-151-2/+2
| | | | | | | Commit 070fac07 had a typo causing two PINE definitions to be added to the list of available GPIOs. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Define PORTE on atmega328pKevin O'Connor2021-08-142-1/+7
| | | | | | | | The atmega328pb supports PORTE, but the current avr-libc toolchain doesn't support the atmega328pb. So, for now, add support for PORTE to atmega328p. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Rename the analog-only PE0/PE1 pins on atmega168/328 to PE2/PE3Kevin O'Connor2021-08-141-2/+2
| | | | | | | The atmega328pb has officially named these pins as PE2 and PE3, so use that naming scheme instead of the previous Klipper invented names. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Fix Kconfig USB/Serial selectionKevin O'Connor2021-03-181-1/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Use "communication interface" menu option in KconfigKevin O'Connor2021-03-181-12/+13
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Add a new CONFIG_HAVE_STRICT_TIMING build definitionKevin O'Connor2020-05-311-0/+1
| | | | | | | | Add a new build definition to note micro-controllers that have strict timing. The Linux mcu code does not have strict timing - all other targets currently do. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: implement i2c_readArksine2020-01-131-1/+18
| | | | Signed-off-by: Eric Callahan <arksine.code@gmail.com>
* avr: List 20Mhz option below 16Mhz option in KconfigKevin O'Connor2019-09-301-2/+2
| | | | | | | | When enabling "low level options" in Kconfig, selecting a chip that is 20Mhz capable would result in 20Mhz being the default. A 16Mhz speed is the preferred default, so list that first in the menu. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Simplify spi mode settingKevin O'Connor2019-05-071-22/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Use enumerations for buses and reserve pinsKevin O'Connor2019-04-044-7/+33
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add enumerations for the atmega168/328 analog only pinsKevin O'Connor2019-03-311-0/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Use enumerations for pin mappingsKevin O'Connor2019-03-171-0/+18
| | | | 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>
* stepper: Support an optimized step/unstep function on ARMKevin O'Connor2019-03-101-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Makefile: Reduce use of $^ in build rulesKevin O'Connor2019-03-021-2/+2
| | | | | | | It's rare to use all of a target's prerequisites in a recipe - replace most cases with $< (the target's first prerequisite). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Wrap code to 80 columnsKevin O'Connor2019-02-273-3/+8
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pins: Add support for pull down resistorsKevin O'Connor2019-02-271-2/+2
| | | | | | | Add initial support for selecting pull down resistors (for micro-controllers that support it). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Only prompt for cpu speed and uart port on LOW_LEVEL_OPTIONSKevin O'Connor2019-02-161-3/+3
| | | | | | | The cpu is almost always 16Mhz and the serial port is almost always UART0, so no need to prompt in the normal case. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Only prompt for CLEAR_PRESCALER and SIMULAVR with LOW_LEVEL_OPTIONSKevin O'Connor2019-01-251-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Move SERIAL_BAUD to src/Kconfig and show with LOW_LEVEL_OPTIONSKevin O'Connor2019-01-251-4/+0
| | | | | | | | Move the definition of SERIAL_BAUD to the main src/Kconfig file. Only show this as an option if the user selects the ability to configure low-level options. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Rename AVR_SERIAL and AVR_USBSERIAL to SERIAL and USBSERIALKevin O'Connor2019-01-252-8/+8
| | | | | | | Rename the config options to be more consistent with other architectures. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Support configuring the stepper pulse length from KconfigKevin O'Connor2019-01-091-1/+3
| | | | | | | Allow the stepper pulse length to be configured at compile time from the Kconfig menu system. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* i2ccmds: Pass the i2c address as a 7-bit number (0-127)Kevin O'Connor2019-01-071-1/+1
| | | | | | | | | | | | | | | | The sam3 i2c code and the linux code use a 7-bit i2c address, while the avr, lpc176x, and samd21 i2c code uses an 8-bit address with the least significant bit always zero. A similar issue occurred in the host code (sx1509.py and replicape.py use 7-bit addresses while uc1701.py and mcp4451.py use 8-bit addresses). Consistently use 7-bit addresses in all the code. This breaks compatibility between host and mcu software, so make a change to the config_i2c command to force users to synchronize software updates. This also breaks common Smoothieboard configs, so update the mcp4451 code to validate the i2c_address. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_cdc: Add support for detecting a USB level Arduino bootloader requestKevin O'Connor2018-12-241-0/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spicmds: Check for an incorrect mode in spicmds.cKevin O'Connor2018-11-301-1/+1
| | | | | | | Check the mode parameter in spicmds.c so that the mcu code does not need to check it. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add support for sending I2C messagesKevin O'Connor2018-11-234-0/+114
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Minor comment update in hard_pwm.cKevin O'Connor2018-11-201-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Rework hardware pwm pin definitionsKevin O'Connor2018-11-201-56/+48
| | | | | | | Simultaneously define the hardware pin and the timer registers. This makes the table a little easier to understand. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Split gpio.c into gpio.c, adc.c, hard_pwm.c, and spi.cKevin O'Connor2018-11-206-391/+418
| | | | | | | Split up gpio.c into multiple files in an effort to make the code a little more understandable. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add initial support for atmega32u4 chipsKevin O'Connor2018-11-203-12/+32
| | | | | Signed-off-by: Trevor Jones <trevorjones141@gmail.com> Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Minor update to help text in KconfigKevin O'Connor2018-11-191-2/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add support for atmega328pKevin O'Connor2018-10-292-5/+8
| | | | | | | The atmega328p is basically the same as the atmega328 - add explicit support for it so that avrdude doesn't complain while flashing. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Disable usb serial interrupts while processing dataKevin O'Connor2018-10-021-6/+10
| | | | | | | There's no need to keep taking interrupts if the high-level code is busy processing messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: No need to reset ep0 interrupts on a shutdownKevin O'Connor2018-10-021-7/+0
| | | | | | | The usb_cdc code will arrange to call usb_read_ep0_setup() after a shutdown, so no need to have an explicit shutdown handler. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Allow the serial port to be selected on the atmega2560/1280Kevin O'Connor2018-10-011-10/+17
| | | | | | | Allow the serial port to be selected on the atmega2560 and atmega1280 chips in Kconfig. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Increase stack size to 256 for all AVR targetsKevin O'Connor2018-10-011-2/+1
| | | | | | | | Recent code additions have increased the stack usage and it is no longer clear that everything will fit in 128 bytes. Increase all targets to 256 bytes (the atmega2560 was already at 256 bytes). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Use generic usb_cdc code for usb serial supportKevin O'Connor2018-09-302-46/+225
| | | | | | | Use the generic usb_cdc driver code instead of the "pjrc" usb driver code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* usb_cdc: Add support for usb_send_ep0_progmem()Kevin O'Connor2018-09-301-0/+2
| | | | | | | Add support for explicitly sending to the ep0 pipe from constant "progmem" memory on the AVR. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add support for gpio_x_reset()Kevin O'Connor2018-08-272-12/+26
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Disable HAVE_GPIO_BITBANGING on atmega168Kevin O'Connor2018-08-271-1/+1
| | | | | | | The atmega168 doesn't have enough flash space to fit all features - disable the "bit banging" interfaces to make room. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Kconfig: Rename HAVE_USER_INTERFACE to HAVE_GPIO_BITBANGINGKevin O'Connor2018-08-271-1/+1
| | | | | | | Rename the HAVE_USER_INTERFACE definition in preparation for other "bit banging" interfaces. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* atmega1284p: Add choice between UART0 or UART1 to KconfigPascal Albert2018-07-131-1/+12
| | | | Signed-off-by: Pascal Albert <lucky@foxserver.org>
* avr: Configure spi transfer in spi_prepare()Kevin O'Connor2018-07-111-4/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* SPI: introduce spi_prepare functionGrigori Goronzy2018-07-082-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>
* avr: Don't set SS high on spi_init()Kevin O'Connor2018-06-271-1/+3
| | | | | | | | | | The AVR requires that the SS pin be an output pin for correct SPI operation. Some boards use the SS pin to control devices separate from SPI, however. Don't change the output level if the pin is already an output, and prefer setting it low if it is not already an output pin. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Add command_find_and_dispatch() helperKevin O'Connor2018-05-281-4/+2
| | | | | | | Add a helper function that calls command_find_block() followed by command_dispatch(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>