aboutsummaryrefslogtreecommitdiff
path: root/examples
AgeCommit message (Collapse)Author
2013-07-26Merge pull request #54 from ginge/masterMarti Bolivar
Added i2c slave support
2013-01-01examples/blinky.cpp: Use toggleLED() instead of digitalWrite().Marti Bolivar
Keep things simple. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-09-05Added I2C slave echo example in examples folder. Using another maple, write ↵Barry Carter
a byte and then read. Slight tidy up. Reformatted CREDITS file to be in correct order. Added a note about buffer overrun Signed-off-by:- Barry Carter <barry.carter@gmail.com>
2012-09-03EXTI examples: whitespace fixups.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-09-03"Changed tabs to spaces. Changed some braces placement to match existing ↵Aditya Gaddam
examples Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com>"
2012-09-03"Added two examples for using attachInterrupt. One shows the use of a global ↵Aditya Gaddam
function. While the second shows the use of a static class method as the event handler. Both work on Maple REVC Signed-off-by: Aditya Gaddam <adityagaddam@gmail.com>"
2012-08-03test session: Add SerialUSB benchmark to 'U' command.Marti Bolivar
I'm currently measuring over 500 KB/sec with screen as my serial monitor. If I don't display the output at all, I get over 600 KB/sec. Nice! Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22i2c-mcp4725-dac.cpp: Fix whitespace.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-22Add I2C example for MCP4725 DAC.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15Port test-usart-dma.cpp for STM32F2.Marti Bolivar
Too ugly? Meh. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-15Port test-usart-dma.cpp to use tube API.Marti Bolivar
This is straightforward. Do it in a verbose style with lots of comments, so we can use this patch as an example for how to port existing DMA code. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13test-usart-dma.cpp: tweaks.Marti Bolivar
Touch up comments, change some function names, and don't set something to zero which already is. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13examples/test-usart-dma.cpp: Use HardwareSerial::c_dev().Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-13examples/test-usart-dma.cpp: Cleanups and comments.Marti Bolivar
Someone pointed to this example on the DMA page in the wiki, so it's probably worth making it more clear what's going on. Remove unused code, add comments, and move things around for better exposition. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-03Globally switch style for GPIO config routines.Marti Bolivar
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>
2012-06-01examples/debug-dtrrts.cpp: Cosmetics.Marti Bolivar
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-06-01Add examples/serial-echo.cpp.Marti Bolivar
Serial1 writes back what it receives. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-05-08Fix a bunch of Doxygen file-level comments.Marti Bolivar
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>
2012-04-11Update examples/test.timers.cpp.Marti Bolivar
Currently passing on STM32F2. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2012-04-11Move public headers to include directories; related cleanups.Marti Bolivar
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>
2011-09-26test-fsmc.cpp: Fixup; wait for user input before running test.Marti Bolivar
2011-09-26test-fsmc.cpp: Switch to SerialUSBMarti Bolivar
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>
2011-09-24test-session: Add test case for disabling USB.Marti Bolivar
This replaces the previously undocumented 'd' option, which tested the pin mode INPUT_PULLDOWN. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-09-12test-fsmc.cpp: Fix incorrect sram_end.Marti Bolivar
2011-09-06test-session.cpp: Fix 'd' command.Marti Bolivar
Actually read a character each time we ask for one. Put pin 22 back into OUTPUT mode when we're done.
2011-08-31test-spi-roundtrip.cpp: Remove redundant loop.Marti Bolivar
SerialUSB.read() is already blocking, so no sense looping on available().
2011-08-31test-session.cpp: Tweak output.Marti Bolivar
2011-08-31test-session.cpp: Measure ADC noise sequentially.Marti Bolivar
Measure pins one at a time.
2011-08-31test-session.cpp: Multiple ADC noise measurements by default.Marti Bolivar
Each call to measure_adc_noise() now does N_ADC_NOISE_MEASUREMENTS (currently 40) samples, instead of just 1.
2011-08-31test-session.cpp: Better analog noise readings.Marti Bolivar
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.
2011-08-31fsmc-stress-test.cpp: Eliminating unnecessary variable.Marti Bolivar
2011-08-31fsmc-stress-test.cpp: Convert to SerialUSB, don't print so much.Marti Bolivar
2011-08-30test-session.cpp: Tweak output.Marti Bolivar
Print input as if it were an ASCII character, not a number.
2011-08-30test-fsmc.cpp: Tweak output.Marti Bolivar
2011-08-30fsmc-stress-test.cpp: Eliminating unnecessary variable.Marti Bolivar
2011-08-30fsmc-stress-test.cpp: Eliminate unused variable.Marti Bolivar
2011-08-30fsmc-stress-test.cpp: Halt on error, print "all's well" message less often.Marti Bolivar
2011-08-30fsmc-stress-test.cpp: Convert to SerialUSB, don't print so much.Marti Bolivar
2011-08-18Whitespace tweak.Marti Bolivar
2011-08-18freertos-blinky.cpp: Remove executable bit.Marti Bolivar
2011-08-03examples/mini-exti-test.cpp: Comment fix.Marti Bolivar
2011-08-03Add examples/mini-exti-test.cpp.Marti Bolivar
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.
2011-07-06test-usart-dma.cpp: Change mistaken "__io" -> "volatile"Marti Bolivar
2011-06-24Make FreeRTOS changes comply with the coding standard.Marti Bolivar
Don't modify the core FreeRTOS code; only change source that's specific to libmaple.
2011-06-21FreeRTOS: Added FreeRTOS 7.0.1, including hook in libmaple/systick.c and ↵Nis Sarup
example blinky.
2011-06-20test-usart-dma.cpp: Update to demo working DMA interrupts.Marti Bolivar
2011-06-08Update test-print.cpp to exercise new behavior.Marti Bolivar
Changes make sure that base arithmetic applies correctly for various integral types, and that floating point numbers can be printed at various precisions.
2011-06-07Keep it 80-column clean.Marti Bolivar
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
2011-05-10Converting all files to UNIX newlines.Marti Bolivar
Committing the results of running the following on the libmaple root directory: $ fromdos `grep --exclude-dir='[.]git' -Ilsr $'\r$' .`
2011-05-06Updating VGA examples for use with new timer API.Marti Bolivar