Commit Graph

207 Commits

Author SHA1 Message Date
Damien George ffaf8be1c6 stmhal: Add example use to RTC doc; add rtc.c to gendoc.py. 2014-05-03 12:02:21 +00:00
Damien George 451f78d156 stmhal: Add documentation for RTC class. 2014-05-03 12:40:53 +01:00
Damien George 8f472ad577 Merge pull request #548 from dhylands/fix-pin-defn
Fix PB0 ADC typo.
2014-05-03 00:16:48 +01:00
Craig Barnes a0ddae86e5 Add device ID to autoflash script. 2014-05-02 23:03:23 +01:00
Dave Hylands 5788485cca Fix PB0 ADC typo.
This also adds a bunch of slashes separating pin that have multiple functions.
2014-05-02 14:01:23 -07:00
Damien George 003977a70b Merge branch 'master' of github.com:micropython/micropython 2014-05-02 16:58:32 +01:00
Damien George 3eb8163b16 stmhal: Add documentation for DAC and Timer classes. 2014-05-02 16:58:15 +01:00
Paul Sokolovsky 9b71b16a94 unix,stmhal: Make "mpconfig.h" be first included, as other headers depend on it. 2014-05-02 18:08:16 +03:00
Damien George ba742ed639 Add shell script to automatically build stmhal/ for all pyboards. 2014-05-02 13:49:44 +00:00
Damien George f2021ffe0f Merge pull request #542 from dhylands/fix-pin
Fix pin initialization when a mode argument is provided
2014-05-01 23:26:28 +01:00
Dave Hylands e911cfdb22 Fix pin initialization when a mode argument is provided 2014-05-01 12:15:37 -07:00
Andrew Scheller ed9d8d6354 Add flashboard target to the stmhal Makefile to run dfu-util
Which allows you to run "make -C stmhal flashboard" from the top-level directory.
Also ties in nicely with my configurable BUILD directory from #506
2014-05-01 02:51:29 +01:00
Damien George f4b7e9bd2e stmhal, docs: Small changes to URL links; adds list of files if none given.
This documentation is now available at micropython.org/doc/
2014-04-30 23:33:30 +01:00
Damien George 4ae52d454c stmhal: Reinstate CC3000 driver from old stm/ port.
It's not enabled by default because it doesn't fully work.  It can
connect to an AP, get an IP address and do a host-lookup, but not yet do
send or recv on a socket.
2014-04-30 20:47:50 +01:00
Damien George cab23051d9 stmhal: Make LED.intensity return the same value it was set to.
Also give proper error message when trying to construct a non-existent
LED.

Addresses issue #530.
2014-04-30 19:23:21 +01:00
Damien George da9f27103d stmhal: Oops, typo. 2014-04-29 23:00:48 +01:00
Damien George 8d09640b22 stmhal: Add documentation in comments, and script to generate HTML.
Decided to write own script to pull documentation from comments in C code.
Style for writing auto generated documentation is: start line with ///
and then use standard markdown to write the comment.  Keywords
recognised by the scraper begin with backslash.  See code for examples.

Running: python gendoc.py modpyb.c accel.c adc.c dac.c extint.c i2c.c
led.c pin.c rng.c servo.c spi.c uart.c usrsw.c, will generate a HTML
structure in gendoc-out/.

gendoc.py is crude but functional.  Needed something quick, and this was
it.
2014-04-29 22:55:34 +01:00
Damien George dbc81df5d4 Simplify names for argcheck.c / arg parsing. 2014-04-26 11:19:17 +01:00
Damien George 6d3c5e4301 Add ARRAY_SIZE macro, and use it where possible. 2014-04-26 10:47:29 +01:00
Damien George 5ea69859c9 stmhal: Update help text. 2014-04-21 20:18:22 +01:00
Damien George 350cb6bf20 stmhal: Fix bug with pin GPIO reading. 2014-04-21 20:18:06 +01:00
Damien George ef255e47c1 stmhal, usrsw: Wrap usrsw.c in #if, for when switch is not available. 2014-04-21 18:31:40 +01:00
Damien George b97c2f4c14 stmhal, accel: Add TODO comment. 2014-04-21 18:30:38 +01:00
Damien George 46e1f26615 stmhal, usrsw: Update comments for new switch API. 2014-04-21 18:28:23 +01:00
Damien George 6125ba4a7f stmhal: Make switch a class, to follow suit of all other modules.
Instead of pyb.switch() as a function, it's more consistent (with
respect to all the other modules and peripherals) to have
pyb.Switch() create a switch object.  This then generalises to having
multiple switches.  Call the object to get its state.  Use sw.callback
to set the callback function for when the switch is pressed.
2014-04-21 18:23:50 +01:00
Damien George af797f476f stmhal, servo: Rename calibrate method to calibration.
It should be a noun, since it supports getting and setting depending on
the number of arguments given.
2014-04-21 18:21:07 +01:00
Damien George 6691c9e655 stmhal, timer: Remove obsolete global variable. 2014-04-21 18:19:50 +01:00
Damien George 7fdfa93700 stmhal: Add Timer class: simple TIM control, incl callback on IRQ.
Simple but functional timer control.  More sophistication will
eventually be added, or for now just use direct register access :)

Also added pyb.freq() function to get MCU clock frequencies.
2014-04-21 16:48:16 +01:00
Damien George 764af4b7c5 stmhal: Make DAC dynamically allocate instances; rename dma->write_timed. 2014-04-21 13:06:19 +01:00
Damien George 83407ad082 stmhal: Clean up rtc.c a bit. 2014-04-21 12:45:59 +01:00
Damien George 7533700393 stmhal: Rename USART to UART.
It's really a UART because there is no external clock line (and hence no
synchronous ability, at least in the implementation of this module).
USART should be reserved for a module that has "S"ynchronous capabilities.

Also, UART is shorter and easier to type :)
2014-04-21 12:03:09 +01:00
Damien George 34f01c2ca1 stmhal: Add some documentation to I2C, SPI and USART modules. 2014-04-21 01:59:43 +01:00
Damien George 3771a097da stmhal: Improve USART class, to be more like SPI and I2C.
The three classes I2C, SPI and USART now have a fairly uniform (Python)
API.  All are constructed, initialised and deinitialised in the same
way.  They can have most of their parameters set, using keyword arguments.
All have send and recv (although slightly different with I2C requiring an
address in master mode).  recv can do inplace receiving (ie store the
data in a previously-created bytearray).

It's just polling mode at the moment, but interrupt and DMA would be
nice to add.
2014-04-21 01:14:14 +01:00
Damien George eb8bdf4df3 stmhal, SPI and I2C: Improvements to functionality and consistency. 2014-04-21 00:10:04 +01:00
Damien George ff91156d34 stmhal: Improved configurability for I2C and SPI busses.
The HAL handles for the I2C/SPI objects are rather large, so we don't
want to unnecessarily include them.
2014-04-20 19:06:15 +01:00
Dave Hylands f70630c58f Fix i2c and spi to compile for Netduino Plus 2 2014-04-20 00:06:03 -07:00
Damien George fd6925b4b9 stmhal: Small bug fixes and simplifications. 2014-04-20 01:25:58 +01:00
Damien George 13c19c57a0 stmhal: Only init RNG if it's used. 2014-04-20 00:45:59 +01:00
Damien George 0a6e9f562f stmhal: Update ExtInt to allow keyword arguments in constructor. 2014-04-20 00:38:50 +01:00
Damien George 57e415859a stmhal: Tidy up and improve consistency across modules. 2014-04-20 00:30:09 +01:00
Damien George d689430e79 stmhal: Add SPI class.
Also some updates to compile with latest changes to core py.
2014-04-20 00:16:30 +01:00
Damien George 27dd471098 Merge branch 'master' of github.com:micropython/micropython 2014-04-19 02:18:19 +01:00
Damien George 3d19137442 stmhal: Add pyb.Pin.init method to re-init GPIO pin mode. 2014-04-19 02:17:57 +01:00
Damien George 6e44381cce stmhal: Improve RTC class; make fatfs use RTC for time stamping files. 2014-04-19 02:17:30 +01:00
Damien George ed5117f6a8 stmhal: Add pyb.unique_id, to get unique id of MCU. 2014-04-19 01:28:18 +01:00
Paul Sokolovsky 206dd2a905 stmhal: Update for mp_binary_get_size() refactor. 2014-04-19 03:27:37 +03:00
Damien George 44ee42de50 stmhal: Rename pyb.Led to pyb.LED to conform to naming rules.
It's Light Emitting Diode, so should be LED.
2014-04-19 00:54:33 +01:00
Damien George 8cf08a58a1 stmhal: Remove pyb.input (use sys.stdio.read(1) instead). 2014-04-19 00:50:50 +01:00
Damien George f20e093b9b stmhal: Add lots of constants to stm module. 2014-04-19 00:32:25 +01:00
Damien George 38ae014e42 stmhal: Update ADC, DAC and I2C objects to use new buffer protocol.
Main reason for expanding buffer protocol API was to support writes to a
buffer in ADC module (see read_timed).  With this change you can now
create an array of arbitrary type and ADC.read_timed will store into
that array in the correct format (byte, int, float).  I wonder though if
all these changes were really worth it to support just this function.
Hopefully this enhanced buffer protocol API (with typecode specified)
will be used elsewhere.
2014-04-18 23:28:56 +01:00