aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Preprocessor-fu to derive BOARD_HAVE_USARTn from <board/board.h>.Marti Bolivar2012-06-018-44/+22
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/adc.h: Fixup for Doxygen.Marti Bolivar2012-06-011-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <wirish/HardwareTimer.h> cosmetics.Marti Bolivar2012-06-011-5/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back HardwareTimer.Marti Bolivar2012-06-013-23/+104
| | | | | | | | | | | | | | Untested, but the timers work on F2 (see exampes/test-timers.cpp), so I'm hoping this is mostly OK. Note that there's an issue with TIMER2 and TIMER5 on F2: these timers have 32-bit counters, and the HardwareTimer methods are all based on uint16 (like on F1). I'm sorely tempted to keep this as-is; exposing the extra bits is just extra documentation, and the HardwareTimer interface is already way too complicated. The interface should still _work_; it just hides the fact that you're missing out on the extra bits for some of the timers. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/stm32.h: Add STM32_TIMER_MASK, STM32_HAVE_TIMER.Marti Bolivar2012-06-013-4/+48
| | | | | | | | | | | | | | | | | | Feature-test macros for dealing with the fact that timer support has holes. STM32_TIMER_MASK is a bitmask where bit n is set when TIMERn is present. STM32_HAVE_TIMER(n) just tests whether bit n is set in STM32_TIMER_MASK. This is necessary because e.g. the STM32F100RB has timers 1-4, 6, 7, and 15-17. Because of this, the usual STM32_NR_whatever won't work, and we use a bitmask instead. For F1 performance line (F103s), STM32_TIMER_MASK can be derived from the density. For F1 value line, I'm not as sure, so just add it for the single MCU we support (the STM32F100RB). Same story for F2: add it for the STM32F207IC. We can fix this up later if necessary. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back analogRead().Marti Bolivar2012-06-012-6/+7
| | | | | | | Yay, it just worked! Still, while we're here, touch up the make-up on wirish_analog.cpp. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* examples/debug-dtrrts.cpp: Cosmetics.Marti Bolivar2012-06-011-2/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/usart.c: Change some FIXMEs to TODOs.Marti Bolivar2012-06-011-6/+7
| | | | | | I think these are probably unchanged, but we need to make sure. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Add examples/serial-echo.cpp.Marti Bolivar2012-06-011-0/+30
| | | | | | Serial1 writes back what it receives. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back HardwareSerial.Marti Bolivar2012-06-0111-56/+127
| | | | | | | | | | | | | | | | | | | | | | | | To make this happen, we need to have <board/board.h> tell us whether or not it's got each of the USARTs. Do that with BOARD_HAVE_USARTn, for n = 1,...,6. This lets us define HardwareSerial instances only when appropriate, and gets rid of some board-specific hacks we'd accumulated. The new <libmaple/usart.h> now has a convenience function for determining the bus rate by using the appropriate STM32_PCLKx macro, so we can shave a uint32 per instance, which is nice given that they're all going to be in memory. This changes the constructor arguments, but the API only specifies the semantics of the predefined instances, so this is still backwards-compatible. (We should look into storing the instances in Flash -- they don't change, after all.) We don't actually need struct usart_dev's definition in HardwareSerial.h, so replace it with a forward declaration and include <libmaple/usart.h> it in HardwareSerial.cpp instead. Assert some copyrights. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back wirish/wirish_math.cpp.Marti Bolivar2012-05-311-1/+1
| | | | | | This is portable. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish/rules.mk: Cosmetics.Marti Bolivar2012-05-311-10/+10
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Bring back wirish/Print.cpp.Marti Bolivar2012-05-311-1/+1
| | | | | | | The only nonportable parts of this file are based on the assumption that we're on ILP32. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Assert LeafLabs copyright in wirish/Print.cpp.Marti Bolivar2012-05-311-0/+1
| | | | | | | | This should get replaced with a clean-room MIT licensed version, but pieces of it are ours (notably the bugfixes to the floating point printing routines), so might as well do the copyright thing. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Replace shiftOut(), also fixing a possible bug.Marti Bolivar2012-05-312-32/+29
| | | | | | | | | | | | The current shiftOut() is borrowed from Arduino, and is in an LGPL file. Replace that file with a new MIT-licensed version containing a new implementation. The new version brings the clock line LOW before starting, to make sure that the first pulse is detected if the clock line was previously HIGH. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/gpio.c: Fix some bugs.Marti Bolivar2012-05-311-3/+3
| | | | | | | Make gpioh.regs actually point to GPIOH_BASE. Properly AND out flag bits in gpio_set_modef(). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <libmaple/gpio.h>: Fix gpio_write_bit().Marti Bolivar2012-05-311-1/+1
| | | | | | | It's exactly wrong -- val=0 makes the pin high, and val=1 makes it low. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* examples/blinky.cpp works on F2.Marti Bolivar2012-05-314-60/+227
| | | | | | | | | | | | | | | | | | | | | | Only OUTPUT mode is tested; any other modes might work, but no guarantees. Bring back: - wirish/wirish_digital.cpp - wirish/cxxabi-compat.cpp - wirish/wirish_time.cpp Add new: - wirish/stm32f1/wirish_digital.cpp - wirish/stm32f2/wirish_digital.cpp Move pinMode() from wirish/wirish_digital.cpp into the file by the same basename in wirish/stm32f1. This implementation is tied to F1. Add an F2 implementation in wirish/stm32f2/wirish_digital.cpp. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/usart_private.c: Add missing include.Marti Bolivar2012-05-311-0/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* <wirish/wirish.h>: Don't include some files.Marti Bolivar2012-05-311-2/+2
| | | | | | These don't work on F2, so leave them out for now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* wirish: Build board.cpp.Marti Bolivar2012-05-311-1/+1
| | | | | | | There's enough infrastructure for a basic board.cpp on STM32F2, so we might as well bring this back. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* STM32F1: Fix nvic_irq_disable_all() on some MCUs.Marti Bolivar2012-05-311-8/+6
| | | | | | | | | | The current implementation only disables the first 64 IRQ lines. This covers all the chips we currently support, but it'll be a nasty surprise if anyone decides to add e.g. connectivity line MCUs (which have more IRQs) in the future. We already have the infrastructure to fix it in a clean way, so we might as well do it now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* nvic.h: Doxygen: nvic_irq_num is target dependent.Marti Bolivar2012-05-312-2/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/nvic.h: Doxygen tweak.sMarti Bolivar2012-05-311-6/+18
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/nvic.h: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1/rcc.c: Move Doyxgen.Marti Bolivar2012-05-311-10/+1
| | | | | | This is a workaround for Breathe. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* series/rcc.h: Lose BIT().Marti Bolivar2012-05-312-360/+370
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/rcc.c: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/rcc.h: Doxygen.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/rcc.h: Remove a TODO.Marti Bolivar2012-05-311-7/+0
| | | | | | That never worked out. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/rcc.h: Add FIXME for rcc_rtc_divider.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/rcc.h: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Doxyfile: Add to PREDEFINED to cover libmaple_types.h.Marti Bolivar2012-05-311-0/+4
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f1/rcc.h: Add a FIXME.Marti Bolivar2012-05-311-0/+2
| | | | | | Having a separate struct is stupid. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* RCC: DoxygenMarti Bolivar2012-05-315-138/+105
| | | | | | | Various changes to Doxygen structure, to help leaflabs-docs make sense of everything. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* rcc.c: Fix typo.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/rcc.h: Doxygen workarounds.Marti Bolivar2012-05-311-3/+3
| | | | | | | We need the arguments to be the same name everywhere, or Breathe/Doxygen get confused. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/fsmc.h: Better Doxygen for memory bank bases.Marti Bolivar2012-05-311-9/+29
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/fsmc.h: Don't use BIT().Marti Bolivar2012-05-311-23/+23
| | | | | | | As fsmc.h doesn't include util.h or libmaple.h, these usages are actually in error. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* stm32f2/fsmc.c: Cosmetics.Marti Bolivar2012-05-311-1/+1
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* libmaple/iwdg.h: Remove BIT() usages.Marti Bolivar2012-05-311-3/+2
| | | | | | This cleans up another unnecessary <libmaple/util.h> dependency. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Don't try to build some libmaple files.Marti Bolivar2012-05-311-2/+2
| | | | | | We can't do these on F2 right now. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Doxygen: add the Evil Mangler.Marti Bolivar2012-05-102-1/+41
| | | | | | | | | | | | | | | | | Whenever Doxygen is running on a series header, make it run an awk script, the Evil Mangler, that pretends the file is enclosed in an appropriate namespace declaration for the series target. Doxygen chokes if two structs have the same name. This is a problem for the series headers, which commonly have data structures with the same name. However, if those structs are in different namespaces, Doxygen has no problems. We obviously can't use namespaces in C headers, so use FILTER_PATTERNS to trick Doxygen into thinking they're there. Ugly, but I can't think of a better way to handle this. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Fix .gitignore so it doesn't filter out support/doxygen/.Marti Bolivar2012-05-101-1/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Doxyfile: Disable TYPEDEF_HIDES_STRUCT to work around Breathe issues.Marti Bolivar2012-05-101-1/+1
| | | | | | | This works around a problem we're having getting the XML for the series headers into a form that we can work with in leaflabs-docs. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Lose <libmaple/util.h> dependency in series/flash.h headers.Marti Bolivar2012-05-092-48/+48
| | | | | | Switch from BIT(...) to (1U << ...). Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* flash.h: Doxygen.Marti Bolivar2012-05-093-2/+5
| | | | | | | Document FLASH_BASE once. This is due to restrictions in the documentation build system. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Change __DOXYGEN_PREDEFINED_HACK to __DOXYGEN__.Marti Bolivar2012-05-093-7/+6
| | | | | | avr-gcc does it this way. Seems ok to me. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Shut up, doxygen.Marti Bolivar2012-05-091-2/+2
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Make usart_irq() __always_inline.Marti Bolivar2012-05-081-1/+1
| | | | | | | Compiling with -Os can prevent this from inlining, and it's an IRQ handler, so the space is worth spending. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>