Damien George
8594ce2280
py: Implement divmod, % and proper // for floating point.
...
Tested and working on unix and pyboard.
2014-09-13 18:43:09 +01:00
Damien George
32781cce6d
stmhal: Slightly improved memcpy; memset uses word store when aligned.
2014-09-13 00:12:41 +01:00
Damien George
5792500ccc
Merge branch 'memcpy' of github.com:iabdalkader/micropython into iabdalkader-memcpy
2014-09-12 23:23:49 +01:00
Damien George
89ab3be0b1
Merge branch 'master' of github.com:micropython/micropython
2014-09-11 22:28:58 +01:00
Damien George
20beff9ae3
py and libm: Add asinf,acosf; print higher precision for float.
...
Also use less stack space when printing single precision float.
Addition of asinf and acosf addresses issue #851 .
2014-09-11 22:24:45 +01:00
iabdalkader
d60580eb5e
Optimize memcpy more
2014-09-11 19:01:48 +02:00
Hirotaka Kawata
2b4af54992
Add LIS3DSH accelometer support to staccel.py
2014-09-11 16:40:53 +09:00
iabdalkader
81b2ddf5d1
Memcpy: copy words
2014-09-11 07:49:21 +02:00
Damien George
5c00757a5c
stmhal: uart ioctl uses EINVAL, and checks TXE bit for write-ability.
2014-09-07 20:57:18 +01:00
Damien George
013d53c0b4
Remove skeletal modselect from extmod and just put it in stmhal.
2014-09-07 20:42:01 +01:00
Damien George
e2a618615d
stmhal: Fix modselect so non-hashable objects can be polled.
2014-09-07 20:41:09 +01:00
Damien George
a2f55fe12b
stmhal: Add polling ability to UART object.
2014-09-07 20:40:32 +01:00
Damien George
6c9c7bc75a
stmhal: Implement generic select.select and select.poll.
2014-09-07 20:40:32 +01:00
Damien George
bad2df3e95
stmhal, modwiznet5k: Add very minimal documentation.
2014-09-01 22:58:22 +01:00
Damien George
bcf041f1a3
stmhal: Add wiznet5k module, to control WIZnet ethernet adaptor.
...
Allows to create socket objects that support TCP and UDP in server and
client mode. Interface is very close to standard Python socket class,
except bind and accept do not work the same (due to hardware not
supporting them in the usual way).
Not compiled by default. To compile this module, use:
make MICROPY_PY_WIZNET5K=1
2014-09-01 22:52:38 +01:00
Damien George
ecc88e949c
Change some parts of the core API to use mp_uint_t instead of uint/int.
...
Addressing issue #50 , still some way to go yet.
2014-08-30 00:35:11 +01:00
Damien George
8707ea3421
lib: Add lib and libm, moving current files from stmhal.
...
Top-level lib directory is for standard C libraries that we want to
provide our own versions of (for efficiency and stand-alone reasons).
It currently has libm in it for math functions.
Also add atanf and atan2f, which addresses issue #837 .
2014-08-29 22:42:26 +01:00
Damien George
f05b87bd63
Merge pull request #824 from dhylands/sdcard-power
...
Fix sdcard_power_on to not do anything if the card is already powered on...
2014-08-26 22:58:54 +01:00
Damien George
3b72da674e
stmhal, STM32F4DISC: Small changes to ST accel driver.
2014-08-26 22:41:27 +01:00
Damien George
e00fb08f99
stmhal, staccel.py: Style cleanup.
2014-08-26 17:30:48 +01:00
David Siorpaes
f4ce26de5c
Added LIS302DL ID check
2014-08-26 18:23:00 +02:00
Damien George
3bb7efc943
stmhal: Hookup USB_VCP.any().
...
Thanks to Dave Hylands for this patch.
2014-08-26 14:18:22 +01:00
Damien George
cd021bfe56
stmhal: Fix build issues with (old) CC3000 driver.
...
Addresses issue #825 .
2014-08-26 14:13:53 +01:00
Dave Hylands
994bb4a839
Fix sdcard_power_on to not do anything if the card is already powered on.
2014-08-25 10:16:52 -07:00
Damien George
34e43c7ee9
stmhal: Improve efficiency of SysTick IRQ and HAL_Delay.
...
SysTick IRQ now increases millisecond counter directly (ie without
calling HAL_IncTick). Provide our own version of HAL_Delay that does a
wfi while waiting. This more than halves power consumption when running
a loop containing a pyb.delay call. It used to be like this, but new
version of HAL library regressed this feature.
2014-08-25 18:12:44 +01:00
Damien George
29c92a407c
stmhal: Use MP_OBJ_NEW_SMALL_INT directly in pyb.micros/millis.
...
Also some whitespace cleanup.
2014-08-25 17:38:55 +01:00
Dave Hylands
2bf044442e
Add support for pyb.micros() by using the systick timer.
...
I also removed trailing spaces from modpyb.c which affected a couple
of lines technically not part of this patch.
Tested using: https://github.com/dhylands/upy-examples/blob/master/micros_test.py
which eventually fails due to wraparound issues (I could fix the test to compensate
but didn't bother)
2014-08-25 17:38:55 +01:00
Damien George
e5cbb70328
stmhal: Make enable_irq and disable_irq inline functions.
...
These functions are generally 1 machine instruction, and are used in
critical code, so makes sense to have them inline.
Also leave these functions uninverted (ie 0 means enable, 1 means
disable) and provide macro constants if you really need to distinguish
the states. This makes for smaller code as well (combined with
inlining).
Applied to teensy port as well.
2014-08-25 13:24:33 +01:00
Dave Hylands
9480138f0c
Add save/restore_irq
...
Factored irq functions into a separate file.
2014-08-25 12:22:11 +01:00
Damien George
2c4e67e32d
stmhal, pin: Update documentation.
2014-08-24 18:30:22 +01:00
Dave Hylands
3d945559d4
Added python script to map AF to a pin name
...
Added some functions to Pin class to query mode, pull, and af
2014-08-24 18:21:08 +01:00
Damien George
8ba832456e
stmhal, modtime: Small changes, reduced code size by around 80 bytes.
...
Also added test for modtime.
2014-08-24 17:40:24 +01:00
Dave Hylands
6678595e7e
Add time.mktime and enhance time.localtime (for stmhal)
...
Now you can use time.localtime on the timestamps presented by os.stat
2014-08-24 17:00:03 +01:00
Damien George
3c658a4e75
py: Fix bug where GC collected native/viper/asm function data.
...
Because (for Thumb) a function pointer has the LSB set, pointers to
dynamic functions in RAM (eg native, viper or asm functions) were not
being traced by the GC. This patch is a comprehensive fix for this.
Addresses issue #820 .
2014-08-24 16:28:17 +01:00
Dave Hylands
3688414d9d
Put some code into the first 16K of flash
...
This basically shrinks the remaining size of flash in the portion
that goes after the internal flash drive.
2014-08-16 08:00:12 -07:00
Damien George
b63be37be1
stmhal: In safe mode, still mount SD card and present as MSD over USB.
...
It's still "safe" because no scripts are run. Remove the SD card if you
want to access the internal flash filesystem. Addresses issue #616 .
Also: remove obsolete pyb.source_dir setting, and reset pyb.main and
pyb.usb_mode settings on soft-reset.
2014-08-16 14:23:22 +01:00
Damien George
b0accc8571
stmhal: Fix printing of pin name in error message.
2014-08-16 13:56:19 +01:00
Damien George
244476e3e6
stmhal: For non-debug compile, enable CC/LD opt to remove dead code.
...
Saves over 35k ROM due to elimination of unused HAL functions. All
tests pass.
Addresses issue #702 .
2014-08-16 13:37:05 +01:00
Damien George
bf133f7737
stmhal: Resolve question in comment about timer clock.
2014-08-14 00:30:14 +01:00
Damien George
1ddd844815
extmod: Finish rename of zlib to zlibd; enable zlibd on stmhal.
2014-08-12 23:23:53 +01:00
Damien George
105e32f1a5
stmhal: Enable moductypes by default.
...
Also fixes compiler error in moductypes when compiled without debugging.
Addresses issue #778 .
2014-08-12 20:02:26 +01:00
Damien George
101d87da6a
stmhal: Working STM32F4DISC accelerometer, via Python script.
...
Thanks to David Siorpaes.
2014-08-10 22:26:20 +01:00
Damien George
30dd23aa7f
doc: Document gc, sys, math, cmath.
2014-08-10 17:50:28 +01:00
Damien George
0c64c634ca
stmhal: Add sys.platform string to PYBv1.0 (it's "pyboard").
2014-08-10 17:49:52 +01:00
Damien George
2605df3346
stmhal, pin: Save 140 bytes ROM by simplifying pin_print function.
2014-08-09 09:19:37 +01:00
Damien George
04019e365f
stmhal, pin: Simplify default value for alternate function init.
2014-08-09 08:51:12 +01:00
Damien George
ea439e59d9
stmhal: Start of documentation for modos and modtime.
2014-08-08 23:30:01 +01:00
Damien George
284efa89ae
stmhal/teensy: Use _ instead of - in source file names.
...
Trying to move towards consistency, let's use _ exclusively in names of
source files (eg .c, .h, .csv).
2014-08-08 22:34:06 +01:00
Damien George
4b67463be1
stmhal: Fix documentation; remove ability to specify af by str.
2014-08-08 22:26:53 +01:00
Damien George
5b7c0c437b
stmhal: Comment out unused functions.
2014-08-08 22:25:46 +01:00