aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/include
Commit message (Collapse)AuthorAgeFilesLines
* wirish/HardwareSPI: board-specific (CPU rate) SPIFrequency entriesbryan newbold2015-06-121-8/+31
| | | | This is part of adding STM32F2-4 HardwareSPI support.
* wirish_math: explicit type casts for round()bnewbold2015-03-031-1/+2
| | | | | | | | This is to squash type promotion warnings and ambiguity (float vs. double). A roundf() macro is introduced for use with floats, matching the POSIX/C99 convention.
* wirish.h: squelch stdbool.h redefinition compiler warningsbryan newbold2015-03-011-2/+7
|
* Squash some GCC __always_inline warnings.Marti Bolivar2014-11-261-2/+2
| | | | | | | Change from __always_inline to plain inline to silence warnings about possibly non-inlinable functions. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Merge branch 'callback_interrupt_handlers'Marti Bolivar2012-09-031-0/+22
|\
| * Whitespace fixups to EXTI files.Marti Bolivar2012-09-031-3/+4
| | | | | | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
| * "Callback versions of functions now take voidArgumentFuncPtr. We can ↵Aditya Gaddam2012-09-021-1/+1
| | | | | | | | | | | | probably use voidFuncPtr instead, but this way people can see that the function expects something different. Existing functions haven't changed in signature. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com>"
| * "Added ability to set callbacks for interrupts that get an argument. This ↵Aditya Gaddam2012-08-311-0/+21
| | | | | | | | | | | | argument can be the instance that needs to handle the interrupt, or just a random argument you might find useful later. Suggestions from mbolivar and iperry from pull53 on libmaple were taken into account. Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com>"
* | 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-271-5/+0
|/ | | | | | | 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>
* 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>
* 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-261-1/+5
| | | | | | We're going to merge into master without F2 support for this. 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>
* Bring back <wirish/wirish_debug.h>.Marti Bolivar2012-06-082-7/+3
| | | | Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* isButtonPressed(): Take a pin and pressedLevel argument.Marti Bolivar2012-06-071-1/+2
| | | | | | | 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-071-1/+9
| | | | | | | | | | 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>
* Slightly improve and generify the USB infrastructure.Marti Bolivar2012-06-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Preprocessor-fu to derive BOARD_HAVE_USARTn from <board/board.h>.Marti Bolivar2012-06-011-0/+21
| | | | 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-011-1/+1
| | | | | | | | | | | | | | 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>
* Bring back HardwareSerial.Marti Bolivar2012-06-011-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* <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>
* Fix a bunch of Doxygen file-level comments.Marti Bolivar2012-05-0810-18/+15
| | | | | | | | | | | | | Fix @file in many places. Also fix up the descriptions where it's appropriate. This standardizes the @file formatting across the library to explicitly include any parent directories up to the repository root. Besides being nice, this will hopefully let us manage Doxygen's XML output so as to make extracting series-specific pieces via Breathe in the leaflabs-docs repo possible. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* [FIXME] Resurrect boards.cpp for F2 and F1.Marti Bolivar2012-04-111-5/+0
| | | | | | | | | | | | | | | | FIXME: - F1 support currently appears to be failing in start_c.c, for some unknown reason. This will need to get sorted out later. Add a new wirish namespace, and a sub-namespace wirish::priv::. Put a bunch of board setup routines in this namespace, and declare them in new wirish/boards_private.h. boards.cpp uses this to perform initialization tasks in a portable way, with two new boards_setup.cpp files under wirish/stm32f1 and wirish/stm32f2 handling the series-specific details. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
* Move public headers to include directories; related cleanups.Marti Bolivar2012-04-1117-0/+2375
Move libmaple/*.h to (new) libmaple/include/libmaple/. The new accepted way to include a libmaple header foo.h is with: #include <libmaple/foo.h> This is more polite in terms of the include namespace. It also allows us to e.g. implement the Arduino SPI library at all (which has header SPI.h; providing it was previously impossible on case-insensitive filesystems due to libmaple's spi.h). Similarly for Wirish. The old include style (#include "header.h") is now deprecated. libmaple/*.h: - Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_. - Add license headers where they're missing - Add conditional extern "C" { ... } blocks where they're missing (they aren't always necessary, but we might was well do it against the future, while we're at it.). - Change includes from #include "foo.h" to #include <libmaple/foo.h>. - Move includes after extern "C". - Remove extra trailing newlines Note that this doesn't include the headers under libmaple/usb/ or libmaple/usb/usb_lib. These will get fixed later. libmaple/*.c: - Change includes from #include "foo.h" to #include <libmaple/foo.h>. Makefile: - Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS. This allows for users (including Wirish) to migrate their code, but should go away ASAP, since it slows down compilation. Wirish: - Move wirish/**/*.h to (new) wirish/include/wirish/. This ignores the USB headers, which, as usual, are getting handled after everything else. - Similarly generify wirish/boards/ structure. For each supported board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to wirish/boards/foo/include/board/board.h and wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef hacks around the .cpp files. - wirish/rules.mk: put wirish/boards/foo/include in the include path (and add wirish/boards/foo/board.cpp to the list of sources to be compiled). This allows saying: #include <board/board.h> instead of the hack currently in place. We can allow the user to override this setting later to make adding custom board definitions easier. - Disable -Werror in libmaple/rules.mk, as the current USB warnings don't let the olimex_stm32_h103 board compile. We can re-enable -Werror once we've moved the board-specific bits out of libmaple proper. libraries, examples: - Update includes accordingly. - Miscellaneous cosmetic fixups. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>