| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Currently passing on STM32F2.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
| |
This messes with timing a little, but makes it faster to test. The
timing was never perfect anyway, due to incrementing count.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
|
|
|
|
|
|
| |
This replaces the previously undocumented 'd' option, which tested the
pin mode INPUT_PULLDOWN.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
|
| |
|
|
|
|
|
| |
Actually read a character each time we ask for one. Put pin 22 back
into OUTPUT mode when we're done.
|
|
|
|
| |
SerialUSB.read() is already blocking, so no sense looping on available().
|
| |
|
|
|
|
| |
Measure pins one at a time.
|
|
|
|
|
| |
Each call to measure_adc_noise() now does
N_ADC_NOISE_MEASUREMENTS (currently 40) samples, instead of just 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update measure_adc_noise() to actually use the Welford online
algorithm, instead of accumulating data in an array on the stack.
This allows us to increase the number of samples (to 1000).
Revised algorithm tested on host PC and compared (in Python) against
numpy with a list of 100 values in [0, 1) drawn using random.random().
Results (Python):
>>> r = [random.random() for i in xrange(100)]
>>> numpy.mean(r)
0.50073064742634854
>>> numpy.var(r)
0.083726090293309297
Results (C++, x86 host PC):
n: 100 mean: 0.500731 variance: 0.084572
So this algorithm for variance has some inaccuracies, but it appears
to be good to a couple of significant figures.
|
| |
|
| |
|
|
|
|
| |
Print input as if it were an ASCII character, not a number.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
Nonportable (Maple Mini only) test of external interrupt
functionality. When wired properly, this triggers various EXTI lines
simultaneously, keeping track of the number of times each handler is
invoked.
|
| |
|
|
|
|
|
| |
Don't modify the core FreeRTOS code; only change source that's
specific to libmaple.
|
|
|
|
| |
example blinky.
|
| |
|
|
|
|
|
|
| |
Changes make sure that base arithmetic applies correctly for various
integral types, and that floating point numbers can be printed at
various precisions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Go through overlong source code lines and convert as many of them as
appropriate to be 80-column clean. This mostly affects license
headers. Overlong lines are determined by running following from the
libmaple base directory:
$ ack-grep --nocolor --nogroup --cpp --cc --ignore-dir=usb -- '.{80}'
Note that this excludes libmaple's usb subdirectory, which is still
full of ST code that doesn't follow the libmaple source code
guidelines.
Contents of ~/.ackrc (these won't matter, but are included for
completeness):
--ignore-dir=docs
--ignore-dir=build
--type-set
ld=.ld
--type-set
rst=.rst
--type-set
txt=.txt
--type-set
mk=.mk
|
|
|
|
|
|
|
| |
Committing the results of running the following on the libmaple root
directory:
$ fromdos `grep --exclude-dir='[.]git' -Ilsr $'\r$' .`
|
| |
|
|
|
|
|
|
|
| |
It would be nice to have something like a timer_set_period() in
libmaple proper that takes the period and the clock rate as
parameters, much the same as usart_set_baud_rate() does. No time for
that now, though, so punt to 0.1.0.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Still a polling driver, but the libmaple proper interface exposes
enough that users enable the various interrupts and define their own
IRQ handlers if they feel like it.
Wirish HardwareSPI interface was largely redone; it's more like the
Arduino implementation now, although there are some differences when I
didn't like their API. The old methods are still there, but are
deprecated and slated for deletion in 0.1.0.
New board-specific values: BOARD_NR_SPI, BOARD_SPIx_NSS_PIN,
BOARD_SPIx_MOSI_PIN, BOARD_SPIx_MISO_PIN, and BOARD_SPIx_SCK_PIN, for
x from 1 to BOARD_NR_SPI.
Documentation was updated appropriately.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
- gpio.h: afio_mapr_swj_config() renamed afio_cfg_debug_ports()
- [new] wirish_debug.h: disableDebugPorts(), enableDebugPorts()
- Maple, Maple Native, and Maple RET6 PIN_MAPs are now larger by 5,
have mappings for the extra JTAG/SW pins.
Documentation was updated appropriately.
|
| |
|
| |
|
|
|
|
|
| |
This uses templates, which I don't like, but it's not going into the
core library, so I'm okay with it for now.
|
|
|
|
|
|
| |
Simple USART receiver to SRAM buffer demo partially working.
Interrupting when buffer is full fails mysteriously. GDB thinks
we ended up in an STM32 reserved exception.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
For the changelog:
* util.h is free of __read(), __write(), etc. macros.
* systick_resume() was renamed systick_enable().
|
|
|
|
|
|
|
| |
Adding basic ring_buffer test (cherry-pick from master).
Changing rb_safe_insert()'s type to match that of rb_push_insert().
(Makes it easier to pass around insertion functions.)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Various board-specific #defines and arrays of pins added.
For the changelog (some of this information predates this commit):
* wirish/boards.h now declares the following arrays of pin numbers:
* boardPWMPins - PWM-capable pins
* boardADCPins - ADC-capable pins
* boardUsedPins - pins already in use, e.g. BOARD_BUTTON_PIN
It also declares a bool boardUsesPin(uint8 pin) function for
convenient testing of whether a pin is in use.
* wirish/boards/*.h now define:
* BOARD_USART1_TX_PIN
* BOARD_USART1_RX_PIN
* BOARD_USART2_TX_PIN
* BOARD_USART2_RX_PIN
* BOARD_USART3_TX_PIN
* BOARD_USART3_RX_PIN
* BOARD_NR_GPIO_PINS (renamed from NR_GPIO_PINS)
* BOARD_NR_USARTS (renamed from NR_USARTS)
* BOARD_NR_PWM_PINS
* BOARD_NR_ADC_PINS
* BOARD_NR_USED_PINS
* wirish/boards/maple_native.h now defines:
* BOARD_UART4_TX_PIN
* BOARD_UART4_RX_PIN
* BOARD_UART5_TX_PIN
* BOARD_UART5_RX_PIN
(Unfortunately, wirish/boards/maple_RET6.h cannot, since at least
one of the UART4/UART5 pins are used already; this will require layout
changes for a wide-release Maple form factor RET6 board).
* wirish/boards/*.cpp all include the corresponding array definitions.
They all live in flash by default, thanks to the new __FLASH__ macro
in wirish/wirish_types.h, which is a synonym for the existing __attr_flash
#define in libmaple/libmaple_types.h.
The documentation was updated to include this information. It also
gained various FIXME/TODO comments related to its generalization
across boards.
The quality assurance-related examples (examples/qa-slave-shield.cpp
and examples/test-session.cpp) now make heavy use of board-specific
values to ensure portability.
|