Damien George
ee3fd46f13
Rename configuration variables controling Python features.
...
Now of the form MICROPY_PY_*. See issue #35 .
2014-05-24 23:03:12 +01:00
Damien George
58ebde4664
Tidy up some configuration options.
...
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*
See issue #35 .
2014-05-21 20:32:59 +01:00
Damien George
6ac5dced24
py: Rename MP_OBJ_NOT_SUPPORTED to MP_OBJ_NULL.
...
See issue #608 for justification.
2014-05-21 19:42:43 +01:00
Damien George
6d197740cf
stmhal: Stop USB before entering DFU by software.
2014-05-21 19:25:34 +01:00
Paul Sokolovsky
9e29666bf9
py: Implement proper separation between io.FileIO and io.TextIOWrapper.
...
io.FileIO is binary I/O, ans actually optional. Default file type is
io.TextIOWrapper, which provides str results. CPython3 explicitly describes
io.TextIOWrapper as buffered I/O, but we don't have buffering support yet
anyway.
2014-05-19 21:56:07 +03:00
Damien George
eee31288dd
stmhal: Fix DAC documentation: need to convert float to int for buf.
2014-05-19 19:08:12 +01:00
Damien George
2de4d59171
stmhal: Fix write_timed function for DAC(2).
...
Addresses issue #617 .
2014-05-19 18:58:53 +01:00
Damien George
f905ebb173
stmhal: Make pyb.bootloader take no arguments.
2014-05-19 18:26:51 +01:00
Sven Wegener
9bf4f7e3d3
stmhal: Remap system flash and adjust addresses
...
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-05-18 13:15:02 +02:00
Sven Wegener
7ae8e4b679
stmhal: Activate bootloader with pyb.bootloader()
...
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
2014-05-18 12:51:21 +02:00
Damien George
89755ae67f
py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.
...
For consistency with MICROPY_MOD_SYS_STDFILES, etc.
2014-05-11 17:35:43 +01:00
Damien George
f92a0d4d16
stmhal: Enable frozenset. Takes 292 text bytes in ROM.
2014-05-11 17:27:31 +01:00
Damien George
a7a1a38df4
stmhal: Update CC3000 driver to newer version.
...
Still not working properly.
2014-05-11 12:09:13 +01:00
Damien George
50073ed5d6
stmhal/cc3k: Remove spaces and tabs at end of lines.
2014-05-10 21:28:40 +01:00
Damien George
3793830ed9
tools: Move gendoc.py to tools, and make it a little more generic.
2014-05-10 19:12:47 +01:00
Damien George
09bbe7215a
stmhal: Fix USB CDC not flushing packets when an exact multiple of 64.
...
Need to send a zero-sized packet after sending an exact multiple of 64
bytes (not just after sending 64 bytes exactly).
Addresses issue #494 , part 2.
2014-05-10 18:56:16 +01:00
Damien George
b0edec61ac
stmhal: Improve handling of out-of-memory in REPL.
...
Addresses issue #558 , but it's likely that other out-of-memory errors
could crash the pyboard. Reason is that qstrs use m_new and can raise
an exception within the parser.
2014-05-10 17:48:46 +01:00
Paul Sokolovsky
deaeaac469
modsys: Enable sys.exit() per port after all.
2014-05-10 17:26:47 +03:00
Paul Sokolovsky
0f14fdea0c
stmhal: Implement draft version of sys.exit().
2014-05-10 16:56:21 +03:00
Damien George
04b7cc4df0
stmhal: Fix setting of RTC: was BCD now BIN encoded.
...
Addresses issue #592 .
2014-05-10 11:56:58 +01:00
Damien George
8c1c7488b2
Add gc.enable, gc.disable; remove pyb.gc.
2014-05-08 23:04:49 +01:00
Damien George
d6cbbc51ab
stmhal: Add time.time() and time.localtime().
...
time.time: returns seconds since 1/1/2000, as an integer.
time.localtime: Returns 8-tuple: (year, month, date, hour, minute,
second, weekday, yearday).
2014-05-08 22:25:49 +01:00
Dave Hylands
117c46d9eb
Add input command for unix
2014-05-07 07:19:51 -07:00
Damien George
491cbd6a7c
py: Add keyword arg support to enumerate constructor.
...
Need to have a policy as to how far we go adding keyword support to
built ins. It's nice to have, and gets better CPython compatibility,
but hurts the micro nature of uPy.
Addresses issue #577 .
2014-05-06 16:38:54 +00:00
Paul Sokolovsky
33b3a6905d
stmhal: pyb: Use gc() function as defined by standard module "gc".
...
TODO: Get rid of this compatibility define and rely on standard module.
2014-05-06 02:28:49 +03:00
Dave Hylands
1145a0706c
Change references (in comments) of pyb.GPIO to be pyb.Pin
...
The documentation at http://micropython.org/doc/module/pyb/ExtInt should also be
updated.
2014-05-05 10:58:38 -07:00
Damien George
5fc400ccdb
stmhal: Document physical pins for SPI, I2C, UART busses.
2014-05-04 14:28:11 +01:00
Damien George
04b9147e15
Add license header to (almost) all files.
...
Blanket wide to all .c and .h files. Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.
Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
2014-05-03 23:27:38 +01:00
Damien George
d5f5b2f766
py, stream: Implement readlines for a stream.
2014-05-03 22:01:32 +01:00
Craig Barnes
c9f9e547d6
Add device ID to deploy make target for stmhal.
2014-05-03 19:51:47 +01:00
Damien George
6ec835dfef
Don't print git hash as well as git tag in banner.
2014-05-03 19:08:02 +01:00
Damien George
977a0ce287
py: Print tag/version/git describe in uPy banner.
2014-05-03 19:02:14 +01:00
Damien George
b4bb3fdb9c
Merge pull request #555 from lurch/patch-1
...
RTC doc fix
2014-05-03 18:44:02 +01:00
Damien George
93e51b594a
stmhal: Enable cmath module.
2014-05-03 18:40:50 +01:00
Andrew Scheller
86a9a88632
Fix incorrect fix ;)
2014-05-03 18:28:11 +01:00
Damien George
bb8ba7fc90
stmhal: Add .gitignore to ignore the new build dir names.
2014-05-03 18:26:03 +01:00
Andrew Scheller
e9ff5570c3
Updated doc fix
2014-05-03 17:50:46 +01:00
Damien George
aad1204b8e
stmhal: Change names: flash to firmware, flashboard to deploy.
...
Since firmware lives in a build directory which already specifies the
board name, no real reason to also have the firmware have the board
name.
2014-05-03 17:46:45 +01:00
Damien George
51315614e1
stmhal: Default build directory now includes board name.
...
BUILD is build-$(BOARD) by default.
2014-05-03 17:39:07 +01:00
Andrew Scheller
b569d690f5
RTC doc fix
2014-05-03 17:34:19 +01:00
Damien George
ae8feac598
stmhal: Wrap CC3000 driver in MICROPY_HW_ENABLE_CC3K.
...
This renames MICROPY_HW_HAS_WLAN to MICROPY_HW_ENABLE_CC3K (since it's a
driver, not a board feature) and wraps all CC3000 code in this #if.
It's disabled for all boards.
2014-05-03 17:32:55 +01:00
Damien George
baa2afbb58
stmhal: Fix typos in class documentation.
2014-05-03 16:42:27 +01:00
Damien George
bff1ff28ee
stmhal: Fix bug where negative delay/udelay lead to huge delays.
...
A negative ms/us is now treated as a delay of 0 ms/us. This patch also
improves the calibration of udelay.
2014-05-03 14:11:56 +01:00
Damien George
5874c1c92b
stmhal: Remove #include <stdint.h> from mpconfigport.h.
...
Make include dependencies neater, and adheres to the coding convention
that headers should not include headers.
2014-05-03 13:24:21 +01:00
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
Damien George
a8f5d15fc6
stmhal: Update help and comments re gpio changing to Pin.
2014-04-18 22:48:59 +01:00
Damien George
c66d86c5ce
stmhal: Big cleanup; merge gpio into Pin; make names consistent.
...
This is an attempt to clean up the Micro Python API on the pyboard.
Gpio functionality is now in the Pin object, which seems more natural.
Constants for MODE and PULL are now in pyb.Pin. Names of some
classes have been adjusted to conform to CamelCase. Other
miscellaneous changes and clean up here and there.
2014-04-18 22:38:09 +01:00
Damien George
906d383850
stmhal: Remove non-ascii character from include file.
2014-04-18 16:17:40 +01:00
Damien George
5b65f0c7d3
py: Rename USE_COMPUTED_GOTOS to USE_COMPUTED_GOTO and enable on stmhal.
...
On stmhal, computed gotos make the binary about 1k bigger, but makes it
run faster, and we have the room, so why not. All tests pass on
pyboard using computed gotos.
2014-04-17 23:24:13 +01:00
Damien George
d0f9f6cd3f
py: Fix pfenv_print_strn to return correct number of chars printed.
...
With this fix, all tests in tests/basics pass on pyboard.
2014-04-17 18:58:09 +01:00
Damien George
d553be5982
build: Simplify build directory layout by putting all headers in genhdr.
...
Any generated headers go in $(BUILD)/genhdr/, and are #included as
'genhdr/xxx.h'.
2014-04-17 18:03:27 +01:00