aboutsummaryrefslogtreecommitdiffstats
path: root/wirish
Commit message (Collapse)AuthorAgeFilesLines
* Include <stdint.h> from wirish.h.Marti Bolivar2012-08-311-0/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSPI: move warning into .cpp from header.Marti Bolivar2012-08-272-5/+5
| | | | | | | This causes the warning to be emitted at most once. As is, it can be emitted each time HardwareSPI.h is included, which is annoying. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_serial.cpp: Hackishly silence spurious warnings on VLDiscovery.Marti Bolivar2012-08-271-0/+6
| | | | | | Guard hooks with BOARD_HAVE_SERIALUSB to keep GCC quiet. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_serial.cpp: Neaten up reset signal RX hook.Marti Bolivar2012-08-221-34/+33
| | | | | | | | | | Move magic bytes from stack to Flash. De-magic-number sizeof magic byte buffer. Use uintptr_t instead of unsigned int when casting address of wait_reset(). Based on a patch by Michael Hope. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Make PRIMASK set/clear functions __always_inline.Marti Bolivar2012-08-141-2/+2
| | | | | | | This is just to ensure that -Os doesn't prevent these from getting inlined. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/ext_interrupts.h: DoxygenMarti Bolivar2012-08-141-6/+7
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add support for ARM's GCC ARM embedded toolchain.Marti Bolivar2012-08-052-9/+10
| | | | | | | Based on patches provided by Hanspeter Portner: http://forums.leaflabs.com/topic.php?id=1717#post-11812 Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move bootloader details out of libmaple.h.Marti Bolivar2012-07-311-0/+12
| | | | | | Finally! Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSerial: make read() block until data arrive.Marti Bolivar2012-07-311-0/+3
| | | | | | | This makes the HardwareSerial behavior match that of SerialUSB, and should help avoid confusion. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move bootloader reset signal detection to Wirish.Marti Bolivar2012-07-311-0/+116
| | | | | | | | Use usb_cdcacm hooks to move the DTR edge and "1EAF" magic packet detection to usb_serial.cpp. We'll later be able to extend this system to support Leonardo-style reset signalling. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Hack: Provide a hook so Mini doesn't disable JTAG/SWD.Marti Bolivar2012-07-311-1/+3
| | | | | | | The nonexistence of a configuration system is starting to become kind of a pain. Oh well; let's keep piling hacks on until things break. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* usb_serial.cpp: Minor tweak.Marti Bolivar2012-07-251-2/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add pin alias enums to other boards.Marti Bolivar2012-07-245-0/+41
| | | | | | | | Repeat Anton's VLDiscovery trick on the rest of the boards. Leave out st_stm3220g_eval since that's just a teaser to get people to play with F2. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Doxygen hacks and fixups.Marti Bolivar2012-06-281-1/+1
| | | | | | | | - Shut Doxygen up in various places - Fix some genuine docs bugs - Ignore sources we're not responsible for Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Clean up micros().Marti Bolivar2012-06-271-7/+4
| | | | | | Don't leave US_PER_MS user-visible. Remove an unnecessary variable. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F1: Bring back HardwareSPI.Marti Bolivar2012-06-262-3/+6
| | | | | | We're going to merge into master without F2 support for this. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back and fix up util.c functionality.Marti Bolivar2012-06-263-0/+129
| | | | | | | | | | | | | | | Rip out the existing nonportable pieces, and shove them under wirish/stm32f1, using weak symbols so users who only want libmaple proper don't end up with build errors. Add stubbed-out (and only partially functional) definitions for F2 targets under wirish/stm32f2. The behavior on F103 targets is the same as it was before (though the assertion framework has always been broken and badly needs replacement, that awaits another commit). We additionally now skip re-enabling USB on F1 targets without USB, to make things work on value line MCUs. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareTimer: add a c_dev().Marti Bolivar2012-06-131-0/+8
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSPI: add a c_dev().Marti Bolivar2012-06-131-0/+8
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSerial: Add c_dev() accessor for instance's usart_dev*.Marti Bolivar2012-06-131-0/+4
| | | | | | This is analagous to std::string::c_str(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Typo fix.Marti Bolivar2012-06-121-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple: board.cpp: More comments.Marti Bolivar2012-06-081-5/+5
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back <wirish/wirish_debug.h>.Marti Bolivar2012-06-085-7/+105
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple: board.h: More comments, remove SYSTICK_RELOAD_VAL.Marti Bolivar2012-06-081-9/+14
| | | | | | | We derive SYSTICK_RELOAD_VAL from CYCLES_PER_MICROSECOND now, so let's hide it for expert use. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/syscalls.c: Assert LeafLabs copyright.Marti Bolivar2012-06-071-0/+1
| | | | | | _sbrk() is new in 2011, and there've been changes in 2012. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/syscalls.c: Weaken I/O related function defs.Marti Bolivar2012-06-071-12/+12
| | | | | | For overriding. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move syscalls.c into Wirish.Marti Bolivar2012-06-072-0/+170
| | | | | | libmaple takes orders, it doesn't give them. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple/board.cpp: Demo weakness of boardInit().Marti Bolivar2012-06-071-0/+5
| | | | | | | This shows people what to do to write boardInit(), but also how to save work if they don't need it. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple/board.cpp: Use PMAP_ROW().Marti Bolivar2012-06-071-45/+55
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* board_private.h: Add PMAP_ROW() convenience macro.Marti Bolivar2012-06-071-0/+4
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* maple/board.cpp: Add more explanatory comments.Marti Bolivar2012-06-071-0/+16
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* isButtonPressed(): Take a pin and pressedLevel argument.Marti Bolivar2012-06-072-4/+5
| | | | | | | This allows dealing with push-buttons on pins other than BOARD_BUTTON_PIN. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <wirish/boards.h>: Add BOARD_BUTTON_PRESSED_LEVEL.Marti Bolivar2012-06-072-3/+11
| | | | | | | | | | This allows boards to override the logic level of a pressed button. All Maple boards have a pressed button read HIGH, but if the opposite convention is used, isButtonPressed() will infinite loop. Make isButtonPressed() respect this setting. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/boards.h: Optionally derive SYSTICK_RELOAD_VAL.Marti Bolivar2012-06-071-0/+3
| | | | | | It's stupid to make everyone keep this around. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Allow boards to override PLL configuration.Marti Bolivar2012-06-071-6/+20
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* HardwareSerial.cpp: Fix "#warn" -> "#warning".Marti Bolivar2012-06-071-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish: Weaken boards_private.h definitions.Marti Bolivar2012-06-072-28/+36
| | | | | | | This lets users override them conveniently if our decisions don't suit. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Provide wirish::priv::series_init() on F1.Marti Bolivar2012-06-072-10/+7
| | | | | | This lets us remove the weak definition in boards.cpp. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Remove a completed FIXME comment.Marti Bolivar2012-06-071-3/+0
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Add EXTI support.Marti Bolivar2012-06-031-1/+1
| | | | | | | | Add series headers to keep the base pointers, and (on F2) use SYSCFG to tell exti_do_select() where the EXTI control registers are. No surprises. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Turn on SYSCFG I/O compensation during init().Marti Bolivar2012-06-031-0/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Add SYSCFG support.Marti Bolivar2012-06-033-1/+16
| | | | | | Turn it on at init() time on F2. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back EXTI on F1, with deprecations for gpio.h on F1.Marti Bolivar2012-06-032-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tested on Maple Mini with examples/mini-exti-test. Changes to Wirish are minor: use the new EXTI types exti_num and exti_cfg (see below) in place of now-deprecated variants in ext_interrupts.cpp. The way I originally did libmaple/exti.h was stupid, and fixing it turned out to be a little disruptive. libmaple/exti.h depends on libmaple/gpio.h (for AFIO), but that's a classic case of exposed implementation detail. So invert the dependency: make gpio.h depend on exti.h. Do this by adding exti_num and exti_cfg to exti.h; these respectively replace afio_exti_num and afio_exti_port. The afio_* variants are now deprecated. (Throw in a typedef and some macros at the bottom of the F1 series/gpio.h for backwards compatibility). Make exti_attach_interrupt() and exti_detach_interrupt() take exti_num/exti_cfg arguments instead of the afio_* variants. Make the EXTI dispatch routines __always_inline to defeat GCC -Os. Many renames throughout libmaple/stm32f1/ to stop using the deprecated names. Also move the previously F1-only gpio_exti_port() function into the public libmaple header. Reimplementing it in terms of rcc_clk_ids lets us deprecate the gpio_dev->exti_port field, which will save space in the future. While we're there, I notice that struct gpio_dev is defined once per series. That's dumb, as it misses the entire point of having device structs: they contain what's portable. So put the F1 version (which has the extra EXTI port field) into libmaple/gpio.h, and add the necessary exti_ports to libmaple/stm32f2/gpio.c. Sigh. We'll get rid of it eventually, at least. Clean up some other mistakes in gpio.h files as well (mostly removing util.h dependency). Sorry for the messy commit. For portability, add a new series-specific exti function, exti_select(). The F1 version in (new) libmaple/stm32f1/exti.c uses AFIO and some new private functionality in libmaple/exti.c and (new) libmaple/exti_private.h to make this convenient. We'll be able to do the SYSCFG equivalent on F2 without any trouble. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/ext_interrupts.cpp: Doxygen, copyright.Marti Bolivar2012-06-031-1/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Slightly improve and generify the USB infrastructure.Marti Bolivar2012-06-034-8/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The good news is that <libmaple/usb.h> and <libmaple/usb_cdcacm.h> did turn out generic enough in what they specify to go on unchanged. However, we can't just go on assuming that there's USB just because we're on an F1. Now that there's value line in the tree, we need to be more careful (value line F1s don't have USB peripherals). To that end, make all the F1 board-includes/*.mk files specify what line their MCU is with an MCU_F1_LINE variable. Use that to hack libmaple/usb/rules.mk so we only try to build the USB module under appropriate circumstances. While we're at it, add a vector_symbols.inc for value line MCUs under support/ld/. We need this to get the target-config.mk modifications implied by the addition of MCU_F1_LINE. We'll fix up some other performance-line-isms under libmaple/stm32f1 in a separate commit. Also in libmaple/usb/: - Move everything into a new stm32f1 directory. Due to aforementioned rules.mk hacks, there is no immediate need for an stm32f2 directory (USB support doesn't exist there). - Update the README for style and content. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add BOARD_HAVE_SERIALUSB.Marti Bolivar2012-06-031-0/+6
| | | | | | Feature-test for SerialUSB support. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <wirish/boards.h>: Add feature test macros for SPI.Marti Bolivar2012-06-031-2/+20
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Typo fix.Marti Bolivar2012-06-031-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Globally switch style for GPIO config routines.Marti Bolivar2012-06-032-11/+7
| | | | | | | | | | | | | | | | | | | | Stupidly, spi_gpio_cfg() didn't take a spi_dev* argument on F1, because it doesn't matter there. On F2, where we need to set an alternate function when configuring GPIOs for SPI, we need to know the dev. We can't add break backwards compatibility, so we need a new function. However, we've since added a bunch of foo_gpio_cfg() routines, and we don't want confusing asymmetry in the names. So a global style change is needed. (Fortunately, the new functions weren't part of a release, so it's no problem to change their names). Change all foo_gpio_cfg() routines to foo_config_gpios() (or foo_config_gpio(), if there's only one GPIO to configure). For backwards compatibility, make spi_gpio_cfg() on F1 an __always_inline call to spi_config_gpios(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F2: Add timer_get_af().Marti Bolivar2012-06-031-31/+1
| | | | | | | | Pull some code out of the F2 pinMode() into a utility function. This feels generally useful enough to be exposed to the users (it will, for example, make it easier to implement input capture in a clean way). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>