Commit graph

116 commits

Author SHA1 Message Date
Marti Bolivar 1634a4855e /examples/ cleanups. 2011-05-04 13:31:24 -04:00
Marti Bolivar 77f707d7b8 SPI refactor.
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.
2011-04-28 14:23:30 -04:00
Marti Bolivar d63748b858 Trivial test-session.cpp bugfix 2011-04-27 17:38:33 -04:00
Marti Bolivar d5097adadf RET6 fixes 2011-04-27 15:33:06 -04:00
Marti Bolivar 2f07cb6f6c Better debug port support.
- 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.
2011-04-25 22:03:25 -04:00
Marti Bolivar bdf3258521 Minor test-session.cpp fixup 2011-04-25 17:58:37 -04:00
Marti Bolivar 61b92e1653 Requiring dac_dev* argument in DAC convenience functions. 2011-04-21 17:24:57 -04:00
Marti Bolivar 4e401e8cef Adding examples/test-print.cpp.
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.
2011-04-13 15:48:48 -04:00
Marti Bolivar ec3cf2903f DMA checkpoint; dma_attach_interrupt() is broken.
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.
2011-04-11 20:53:51 -04:00
Marti Bolivar e1a5d8edaf Resolving some FIXMEs. 2011-04-11 20:45:47 -04:00
Marti Bolivar 587ac2c077 Adding button test to examples/test-session.cpp. 2011-04-11 12:32:09 -04:00
Marti Bolivar f6f9a11227 USART refactor. 2011-04-07 13:18:36 -04:00
Marti Bolivar f5b41b3457 SysTick refactor.
For the changelog:

* util.h is free of __read(), __write(), etc. macros.

* systick_resume() was renamed systick_enable().
2011-04-05 14:13:35 -04:00
Marti Bolivar 04ce8168ae ring_buffer tweaks.
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.)
2011-04-05 13:21:06 -04:00
Marti Bolivar 1025f146d5 Redid Servo in terms of new timer.h. 2011-04-01 18:21:38 -04:00
Marti Bolivar 6cf3178996 Board-specific values; corresponding QA test generalizations.
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.
2011-03-30 07:19:13 -04:00
Marti Bolivar c5e16e9625 Final stm32_pin_info design candidate; ADC3 support on Native.
Added an adc_dev to struct stm32_pin_info.  This was necessary to add
support for the channels on the Native which are only connected to
ADC3, but it does add a bunch of NULLs to the PIN_MAPs.

I don't think any other peripherals need representation on a per-pin
basis.  Each peripheral library will be responsible for keeping track
of related GPIO ports and bits, and we can throw #defines in to
boards/*.h for other things (e.g. BOARD_SPI1_MISO_PIN).

Fleshed out the ADC refactor and brought it more in keeping with the
new design as it evolves.

A couple of other tweaks.  Notably: waitForButtonPress() now takes a
default argument meaning "wait forever".

Removed Maple-specific documentation from core functions in io.h; this
information will need to go into the individual board docs files.
2011-03-25 20:09:30 -04:00
Marti Bolivar 9d2b4e574c Adding /wirish/boards/ for easier porting; shrank PIN_MAPs.
/wirish/boards/ contains xxx.h and xxx.cpp (for xxx=maple,
maple_native, maple_mini, maple_RET6).  The headers contain the
board-specific #defines that used to live in boards.h (except
BOARD_INIT, which was removed).  The CPP files contain the PIN_MAP
definitions that used to live in boards.cpp, and a proper boardInit()
function to replace the old BOARD_INIT macro.  This will make it
easier to add new boards in the future.

struct PinMapping was renamed struct stm32_pin_info, and was moved
into a new wirish_types.h.  Its external interrupt field was moved
into struct gpio_dev, which saves memory by storing an afio_exti_port
per port, rather than one per pin.  Also rearranged the stm32_pin_info
fields to improve packing.  Maple's PIN_MAP is now down to below 500
bytes.
2011-03-24 17:31:47 -04:00
Marti Bolivar 296b1188bf Initial timer refactor.
Basic PWM works.  Had some problems in testing that might be due to
USART bugs.

HardwareTimer has been removed from the build for now; I will
re-implement it in terms of the new libmaple API, but consider it
deprecated.  Let's come up with something better.

Servo is implemented in terms of HardwareTimer, so it also has been
temporarily removed from the build.

pwmWrite() likely got a little bit less inefficient due to
indirection, but the PIN_MAPs shrank by a pointer per PinMapping.
2011-03-24 07:25:14 -04:00
Marti Bolivar 009b229d54 FSMC refactor; SRAM test code 2011-03-17 01:49:40 -04:00
Marti Bolivar 580f0b6965 Maple RET6 edition support 2011-03-16 17:56:54 -04:00
Marti Bolivar 7c5c5bb118 [WIP] GPIO refactor: seems ok, ready for review 2011-03-11 16:24:44 -05:00
Marti Bolivar f217acb73d Brought examples/ up to date; PIN_MAP bugfix for D24. 2011-03-04 23:16:32 -05:00
Marti Bolivar d6ef63b471 Cleaned out libmaple.h; this had wide-ranging implications.
Many of the #defines in libmaple.h were board-specific, not
MCU-specific.  Most of these were only used by code under
libmaple/usb/.  These were moved into usb_config.h, and are clearly
marked as being terrible hacks.  I'm going to treat the USB stack as a
black box that we'll deal with later.

Further, instead of having a variety of #defines like "How many USARTS
do I have?", we decide that based on the density of the chip.  This is
determined by testing for STM32_MEDIUM_DENSITY or STM32_HIGH_DENSITY
defines.  libmaple currently doesn't support low-density chips, so
that suffices.  The Makefile will set these automatically based on the
MCU.

Other offending #defines are ERROR_LED_PORT and ERROR_LED_PIN; these
were made optional, but they're set in the Makefile as a hack to keep
things working.
2011-02-27 11:42:56 -05:00
Perry Hung 0138947c8a Refactor DAC
DAC header and source slightly cleaned up. Test on Maple Native prototype. Add
flags parameter to allow selective enabling of channels.
2011-02-27 06:38:53 -05:00
Marti Bolivar e82e80a1a7 Refactor backup (BKP) and power (PWR) routines. 2011-02-27 06:06:12 -05:00
Perry Hung d9287cdd42 workaround to compile test-session.cpp 2011-02-27 02:55:43 -05:00
Marti Bolivar 5ea4b56515 Basic DAC functionality (high-density devices only). 2011-02-18 04:00:00 -05:00
Marti Bolivar 0713c12711 Function examples/test-session.cpp on Native 2011-02-10 17:50:26 -05:00
Marti Bolivar 93d2f84669 Updated blinky.cpp for portability 2011-02-10 16:31:23 -05:00
Marti Bolivar 0632cab102 Ported examples/test-session.cpp to work on Mini 2011-01-30 21:48:54 -05:00
bnewbold 5bfeb40e47 systick testing and simplification
ripped out marti's SystemTick for the sake of simplicity and added a
systick_resume function to libmaple. new example program demonstrates
the functionality, also demonstrates micros()/USB bug
2010-09-05 23:48:31 -04:00
bnewbold ae64a19745 improved timer test program 2010-09-05 23:00:18 -04:00
bnewbold 16b4c1fce5 fixed Serial crash bug 2010-09-05 21:43:06 -04:00
bnewbold d6a3299168 Various fixes, working with Maple 2010-09-01 00:02:36 -04:00
Marti Bolivar 9c9d6c1531 added support to enable/disable systick in wirish 2010-08-31 18:28:07 -04:00
bnewbold 1e3e0862bb simplified example headers 2010-08-31 17:45:26 -04:00
bnewbold 02d7b08f04 Merge maple-native changes into portable
This compiles for both maple and maple_native but is untested.
2010-08-31 17:39:46 -04:00
bnewbold e14aa2adb4 simplified example headers 2010-08-25 18:17:10 -04:00
bnewbold b2dd49c314 FSMC tweaks 2010-08-07 21:25:51 -04:00
bnewbold 7b391d7f76 basic working dac implementation 2010-08-07 20:29:37 -04:00
bnewbold 314846bee3 Partially working!
Documented; see ./notes/fsmc.txt. Not yet integrated into .ld scripts or
fully tested
2010-08-05 21:47:47 -04:00
bnewbold 0f55cc0d89 partial progress on FSMC for SRAM 2010-08-05 21:47:22 -04:00
bnewbold c323c8fe58 updated leaf demo 2010-07-20 22:03:32 -04:00
bnewbold 4298a45c5a test of serialN.flush() 2010-07-20 15:43:11 -04:00
bnewbold 4263903592 updated vga demos to use SerialUSB.end() 2010-07-20 15:42:05 -04:00
bnewbold c634572c2d TMP: test updates 2010-07-20 15:37:44 -04:00
bnewbold 895d2a48fa wirish implementation of timers plus test 2010-07-20 15:37:44 -04:00
bnewbold dd52d66d03 timers progress
examples code cleanup, more descriptive comments, more notes
2010-07-20 15:37:09 -04:00
bnewbold 480dad829f awesome vga demos, need vga+systick disabled 2010-07-20 15:37:09 -04:00
bnewbold f06fcac502 good quality vga leaf logo; usb+systick disabled
refactored timers and added interrupt behavior. see notes and
comments...  also includes a crude vga hack that doesn't use timers.
2010-07-20 15:36:44 -04:00
bnewbold 52cbd2f1a1 working serialUSB with timeout
as a temporary workaround for the fact that SerialUSB is often blocking,
this crude implementation makes the low-level C usbSendBytes function
non-blocking (with a return code of bytes sent) and implements a 2ms
timeout in the wirish write() function.

also adds begin(), end(), getDTR(), getRTS(), pending(). device is still
initialized the old fashioned way during init() so that, eg, autoreset
will work. includes a simple multi-test program.
2010-07-19 00:38:36 -04:00
Perry Hung 2dd4b9db68 Call init() before static constructors
Commit 70a18f96b6 forces init() to be
called before any statically allocated object constructors for the IDE.

This adds the change to the examples for users not using the IDE.
2010-06-25 21:47:27 -04:00
bnewbold cabb71f942 fixed QA test (pulldown) 2010-06-16 13:17:18 -04:00
bnewbold 6e5326e0dd new QA testing modes 2010-06-15 22:19:10 -04:00
bnewbold e9fc9d4e2a helpful debug program 2010-06-11 13:17:07 -04:00
bnewbold c8cee2368c test session serial fix 2010-06-07 14:46:48 -04:00
bnewbold 7ef5c1f749 fixed example 2010-06-05 21:57:56 -04:00
bnewbold 767bf60238 example updates... 2010-06-04 20:01:34 -04:00
Perry Hung 88d4b095e4 Preliminary wirish USBSerial implementation.
-updated examples
-removed HardwareUSB
-cleaned up a handful of includes
2010-06-04 00:43:21 -04:00
bnewbold fb3f98d165 finish cxxabi-compat refactor
perry forgot to add/edit these...
2010-04-29 07:13:16 -04:00
Perry Hung b5ddce7dc8 Fixed examples, added spi example, moved pure virtual function handler
out of main to cxxabi-compat.cpp.
2010-04-29 01:14:03 -04:00
bnewbold b9fba8a471 updated test-session with new banner art etc 2010-04-27 18:49:57 -04:00
bnewbold e9eda8f74c mostly complete new interactive hardware testing program 2010-04-21 01:36:53 -04:00
Perry Hung 87c85a6449 Licensing: Relicensed libmaple under the MIT License.
Relicensed the bulk of libmaple under the more permissive MIT License,
from GPLv3. Files that were largely or entirely derived from
the Arduino, STM, or Lanchon retain their original licenses.
2010-03-31 22:43:27 -04:00
bnewbold 1d3861ef93 Major hierarchy reorganization; see README.
copy-to-ide and Makefile updated to conform; .gitignore added;
LICENSE added
2010-03-31 09:43:10 +08:00