Commit Graph

36 Commits

Author SHA1 Message Date
Kevin O'Connor 8aa8feedb8 lpc176x: Use enumerations for pin mappings
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-17 19:38:18 -04:00
Kevin O'Connor b28e95ca1a command: Always pass a string to the DECL_CONSTANT() macro
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>
2019-03-17 19:38:18 -04:00
Kevin O'Connor 4718f39b2f flash_usb: Run dfu-util via sudo
Default to running dfu-util via sudo as most machines will not have
the user setup with permissions to access the raw usb device.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-11 22:33:24 -04:00
Kevin O'Connor f5b10f0c13 lpc176x: Add support for flashing via "make flash"
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-08 22:22:41 -05:00
Kevin O'Connor 9430fea2c5 Makefile: Fix lpc176x and stm32f1 builds
Commit e18501d0 broke the build for targets that added objects to
klipper.elf via adding dependencies.  Rework the build so that it is
possible to add objects to klipper.elf via a new OBJS_klipper.elf
makefile variable.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-03-02 11:26:14 -05:00
Kevin O'Connor dddfb681c7 pins: Add support for pull down resistors
Add initial support for selecting pull down resistors (for
micro-controllers that support it).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-27 11:13:21 -05:00
Kevin O'Connor 1096075d9b lpc176x: Convert code to use armcm_timer
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-02-06 22:03:09 -05:00
Kevin O'Connor b6ccd2682c Kconfig: Move SERIAL_BAUD to src/Kconfig and show with LOW_LEVEL_OPTIONS
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>
2019-01-25 18:02:03 -05:00
Kevin O'Connor d3ec103816 lpc176x: Implement a median filter on ADC readings
The lpc176x ADC is extremely noisy.  Implement a 5 order median filter
on each ADC read to weed out obviously incorrect readings.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-14 13:08:45 -05:00
Kevin O'Connor 078a03dc21 lpc176x: Add mechanism for entering the bootloader from a USB signal
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-13 12:25:58 -05:00
Kevin O'Connor e26d1a3567 i2ccmds: Pass the i2c address as a 7-bit number (0-127)
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>
2019-01-07 20:00:44 -05:00
Kevin O'Connor 277a8185e1 lpc176x: Pass gpio id to gpio_peripheral()
Pass the gpio id instead of the bank/pin to gpio_peripheral().  This
is in keeping with other ARM ports.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 11:07:22 -05:00
Kevin O'Connor a40df4b6f7 lpc176x: Move enable_peripheral_clock to main.c
Move and rename function to enable_pclock() - in keeping with other
ARM ports.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 11:00:09 -05:00
Kevin O'Connor 8f7fc4e6a9 lpc176x: Move ADC code to new adc.c file
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2019-01-04 10:42:36 -05:00
Kevin O'Connor b84ecebf8f usb_cdc: Add support for detecting a USB level Arduino bootloader request
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-12-24 11:42:19 -05:00
Kevin O'Connor db4f0c24cd spicmds: Check for an incorrect mode in spicmds.c
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>
2018-11-30 11:50:48 -05:00
Kevin O'Connor cbbc6801a0 lpc176x: Enable full speed peripheral clocks on SPI and I2C
Scale the bus speed within the peripheral instead of on the system bus
as scaling on the system bus slows down general register access to the
peripheral.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-21 20:44:39 -05:00
Kevin O'Connor 4bbd631086 lpc176x: Add an enable_peripheral_clock() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-21 20:44:18 -05:00
Kevin O'Connor f3c4deb1ab lpc176x: Convert i2c code to use standard i2ccmds.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-11-14 10:23:56 -05:00
Kevin O'Connor 8fca908445 lpc176x: Divide system clock within timer; not on system bus
Scaling the timer on the system bus has a notable impact on
performance.  So, scale the timer within the timer hardware itself.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-10-18 09:37:47 -04:00
Kevin O'Connor 93e4897044 usb_cdc: Add usb_read_ep0_setup() interface function
Use new usb_read_ep0_setup() function when reading a setup packet -
this allows the low-level usb hardware code to better handle errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-09-30 22:32:19 -04:00
Kevin O'Connor 6ab16d2407 usb_cdc: Rename interface functions to avoid the term "setup"
Use "ep0" when referring to endpoint0 - don't use "setup" as that can
be confused with the low-level usb setup token.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-09-30 14:09:55 -04:00
Kevin O'Connor 5a993b743e lpc176x: Add support for gpio_x_reset()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-27 12:40:38 -04:00
Kevin O'Connor 82a542faed Kconfig: Rename HAVE_USER_INTERFACE to HAVE_GPIO_BITBANGING
Rename the HAVE_USER_INTERFACE definition in preparation for other
"bit banging" interfaces.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-27 11:09:47 -04:00
Kevin O'Connor 635a199a47 usb_cdc: Allow USB endpoint ids to be board specific
It's common for boards to have restrictions on the type of each
endpoint.  So, make it possible for the board to select the endpoint
ids for each endpoint.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-06 23:36:05 -04:00
Kevin O'Connor f4910e119a lpc176x: Use common cmsis-core files
No need to include separate cmsis files from the mbed project - the
standard CMSIS_5 files work fine.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-08-06 23:36:05 -04:00
Kevin O'Connor e2b4b1616f lpc176x: Add support for SPI
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-07-18 10:11:29 -04:00
Kevin O'Connor d725160706 mcp4451: Add initial support for programming the mcp4451 on lpc176x
Add support for programming smoothieboard current.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-29 21:20:12 -04:00
Kevin O'Connor 4fbecfa1fc lpc176x: Build with LCD support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-06-18 12:46:08 -04:00
Kevin O'Connor 2994638380 lpc176x: Add a dummy "make flash" command to advise users on how to flash
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:58:23 -04:00
Kevin O'Connor 4344f7fc10 lpc176x: Add build rules for smoothieware bootloader support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00
Kevin O'Connor c381d03aad lpc176x: Initial support for serial over usb
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00
Kevin O'Connor c812a40a37 lpc176x: Add ADC support
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00
Kevin O'Connor 65613aeddf lpc176x: Enable watchdog
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00
Kevin O'Connor c78b90767f lpc176x: Add support for GPIO pins
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00
Kevin O'Connor 970831ee0d lpc176x: Add initial support for LPC176x processors
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2018-05-25 11:52:13 -04:00