Commit Graph

6454 Commits

Author SHA1 Message Date
Damien George f6a8e84a25 tests/basics: Add test for break from within try within a for-loop. 2016-08-15 21:28:41 +10:00
Damien George 675d1c9c60 ports: Remove typedef of machine_ptr_t, it's no longer needed.
This type was used only for the typedef of mp_obj_t, which is now defined
by the object representation.  So we can now remove this unused typedef,
to simplify the mpconfigport.h file.
2016-08-15 11:02:59 +10:00
Damien George 41fceae559 py/obj.h: For obj reprs A,B,C use void* explicitly for mp_obj_t typedef.
The machine_ptr_t type is long obsolete as the type of mp_obj_t is now
defined by the object representation, ie by MICROPY_OBJ_REPR.  So just use
void* explicitly for the typedef of mp_obj_t.

If a port wants to use something different then they should define a new
object representation.
2016-08-15 10:56:55 +10:00
Damien George b359cf2911 tests/misc/non_compliant: Add tests to improve coverage testing. 2016-08-15 10:46:46 +10:00
Damien George d5f42c9daf tests/basics: Add more list tests to improve coverage testing. 2016-08-15 10:46:35 +10:00
Damien George 3c82d1d34b tests/basics: Add more tuple tests to improve coverage testing. 2016-08-15 10:46:02 +10:00
Damien George 2196799051 py/objstr: Use mp_raise_{Type,Value}Error instead of mp_raise_msg.
This patch does further refactoring using the new mp_raise_TypeError
and mp_raise_ValueError functions.
2016-08-14 16:51:54 +10:00
Damien George 1a0d3fd632 py/runtime.h: Move comment about mp_not_implemented to correct place. 2016-08-14 16:35:10 +10:00
Damien George 4aaa5adf9f py/objtuple: In tuple_cmp_helper, use mp_check_self instead of raising.
Only tuple, namedtuple and attrtuple use the tuple_cmp_helper function,
and they all have getiter=mp_obj_tuple_getiter, so the check here is only
to ensure that the self object is consistent.  Hence use mp_check_self.
2016-08-14 16:28:05 +10:00
Paul Sokolovsky 9cf2949356 esp8266/mpconfigport.h: Enable support for all special methods. 2016-08-14 01:02:35 +03:00
Paul Sokolovsky 0be4a7712d tests: Rename zlibd_decompress.py -> uzlib_decompress.py.
To use the actual current name.
2016-08-12 22:50:45 +03:00
Paul Sokolovsky c4a8004933 py: Get rid of assert() in method argument checking functions.
Checks for number of args removes where guaranteed by function descriptor,
self checking is replaced with mp_check_self(). In few cases, exception
is raised instead of assert.
2016-08-12 22:39:03 +03:00
Paul Sokolovsky 83e0ebabb4 py/objdict: Get rid of asserts (remove/replace with mp_check_self()). 2016-08-12 22:01:11 +03:00
Paul Sokolovsky 8c50f93a41 py/runtime.h: Define mp_check_self(pred) helper macro.
Indended to replace raw asserts in bunch of files. Expands to empty
if MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG is defined, otehrwise by
default still to assert, though a particular port may define it to
something else.
2016-08-12 21:58:56 +03:00
Paul Sokolovsky 9e1b61dedd py/runtime: Factor out exception raising helpers.
Introduce mp_raise_msg(), mp_raise_ValueError(), mp_raise_TypeError()
instead of previous pattern nlr_raise(mp_obj_new_exception_msg(...)).
Save few bytes on each call, which are many.
2016-08-12 21:28:45 +03:00
Tobias Badertscher af9889f99a stmhal/adc.c: Get ADC working on STM32L4 MCUs.
Fixing Issue #2243. Main problems were:

- HAL_ADC_GetState(adcHandle) may return other bits set (not only
  HAL_ADC_STATE_EOC_REG) when called - so I AND-ed it out as proposed by
  mattbrejza in Issue #2243.
- ADC Pin has to be configured as GPIO_MODE_ANALOG_ADC_CONTROL not only
  GPIO_MODE_ANALOG.
- Resolved ADC resolution L4 specific (Use L4 define ADC_RESOLUTION_12B).
- Changed setting of Init.EOCSelection toADC_EOC_SINGLE_CONV for L4.
- Added call to ADC_MultiModeTypeDef as this is done on a STM32Cube
  generated project too.
- Clean up: Configuration of ADC is done only in ONE function not the same
  is done in two functions.

Test is done on PA5 pin of STM32L4Discovery-Kit which is connected to the
DOWN button.

Thanks to mattbrejza for discovering the bug.
2016-08-11 13:01:57 +10:00
Damien George dfb8144037 stmhal/boards: Update STM32L476 pin defs to include ADC channels.
This patch introduces proper ADC Pin definitions in stm32l476_af.csv.
Originally provided by @tobbad.
2016-08-11 13:01:57 +10:00
ilovezfs 4e36dd570b unix/mpconfigport.h: Don't include stdio.h on MacOS.
Fixes build errors such as
"../lib/utils/printf.c:43:5: error: expected parameter declarator"
2016-08-10 21:43:34 +03:00
Paul Sokolovsky 5e01fb01b3 docs/esp8266/intro: Add command to install esptool.py 1.0.1 via pip.
It used a standard BootROM programming algo and may be useful as a
fallback.
2016-08-10 21:40:40 +03:00
Damien George 72ae3c72c7 tools/mpy-tool.py: Support freezing float literals with obj-repr C.
The tool now generates code for freezing floats in obj-repr A, B or C,
with the specific representation detected at compile time using macros.
2016-08-10 13:26:11 +10:00
Damien George 8a15e0b1c7 esp8266: PULL_UP is not supported on Pin(16), so raise an exception. 2016-08-10 12:45:40 +10:00
Damien George b203c1774e esp8266: Fix reading of pin object for GPIO16.
Pin(16) now works as an input.
2016-08-10 12:44:47 +10:00
Paul Sokolovsky 2146cdab5e docs/esp8266/tutorial/pins: Fix typo in commands for pin input mode. 2016-08-09 21:13:27 +03:00
Damien George e4e4526954 docs: Bump version to 1.8.3. 2016-08-09 23:49:25 +10:00
Paul Sokolovsky 3c9510d767 esp8266/modules/flashbdev: Start filesystem at 0x90000.
To accommodate growing firmware.
2016-08-09 14:59:27 +03:00
Paul Sokolovsky 3372f69586 esp8266/esp8266.ld: Increase firmware image size to 0x90000 (576K).
Of them, 0x87000 is irom0 segment.

This is required to ship increasing number of modules and examples
developed in teh course of ESP8266 port project.
2016-08-09 14:54:26 +03:00
Paul Sokolovsky 6d11918d49 lib/berkeley-db-1.xx: Update, sets default page size to 4096.
This both good default for 4096 and makes less chance to see overflow page
issues.
2016-08-09 02:09:59 +03:00
Paul Sokolovsky 5c73de0337 docs/uio: Mention seek()/flush() support for io.BytesIO. 2016-08-09 01:52:56 +03:00
Paul Sokolovsky 3e5534caf7 docs/esp8266/intro: Focus on hazards of unearthed power wrt electronics. 2016-08-07 22:41:34 +03:00
Paul Sokolovsky 1bc2911174 py/mpconfig.h: Define MP_ALWAYSINLINE for reuse.
Similar to existing MP_NOINLINE.
2016-08-07 22:36:05 +03:00
Paul Sokolovsky d2cab0b7be docs/esp8266/tutorial/intro: Add anchor for link from quickeref. 2016-08-07 22:16:40 +03:00
Paul Sokolovsky 8897dcb2a1 tests/basics: bytes/str.partition/rpartition are now optional.
Skip tests if not available.
2016-08-07 22:14:34 +03:00
Paul Sokolovsky f84dda7111 docs/esp8266/quickref: Link to installation instructions. 2016-08-07 17:46:27 +03:00
Paul Sokolovsky a9923d190e docs/esp8266/intro: Add troubleshooting section.
Tries to summarize most of the issues we've seen so far.
2016-08-07 17:28:33 +03:00
Paul Sokolovsky 919c54f750 docs/esp8266/intro: Rename to "Getting started" from "Introduction".
People tend to skip introductions (everyone knows what esp8266 is, right?),
so try to do A/B testing with a title inviting to read it.
2016-08-07 17:28:23 +03:00
Paul Sokolovsky 1966745689 esp8266/tutorial/intro: Reword para abou -fm dio switch.
Not all NodeMCU boards require it.
2016-08-07 16:31:09 +03:00
Paul Sokolovsky 31ad1bb606 esp8266/modmachine: Implement dummy sleep() function. 2016-08-07 16:20:01 +03:00
Paul Sokolovsky 541e76fa45 esp8266/modutime: Actually implement ticks_cpu(). 2016-08-07 16:13:51 +03:00
Paul Sokolovsky f71f37e426 esp8266/esp_mphal.h: Add mp_hal_ticks_cpu() for reuse. 2016-08-07 16:03:00 +03:00
Paul Sokolovsky c2070d771a esp8266/modmachine: Implement idle() function. 2016-08-07 15:51:04 +03:00
Paul Sokolovsky 1563388001 py/objstr,objstrunicode: Fix inconistent #if indentation. 2016-08-07 15:24:57 +03:00
Paul Sokolovsky 56eb25f049 py/objstr: Make .partition()/.rpartition() methods configurable.
Default is disabled, enabled for unix port. Saves 600 bytes on x86.
2016-08-07 06:46:55 +03:00
Paul Sokolovsky a4aaf82421 unix/moduselect: Allow poll.register(), etc. accept fd-like objects.
This includes file and socket objects, backed by Unix file descriptor.
This improves compatibility with stmhal's uselect (and convenience of
use), though not completely: return value from poll.poll() is still
raw file descriptor.
2016-08-07 01:25:59 +03:00
Paul Sokolovsky fdb411a8c5 docs/library/index: Include array module in ToC. 2016-08-07 00:16:41 +03:00
Paul Sokolovsky 8a0b6f561c docs/array: Document array module. 2016-08-07 00:13:48 +03:00
Paul Sokolovsky e15fb33e10 extmod/modwebrepl: Add GET_VER operation to query MicroPython version. 2016-08-07 00:01:25 +03:00
Paul Sokolovsky cbef0dba2e extmod/modwebsocket: Use mp_rom_map_elem_t and friends. 2016-08-06 16:18:03 +03:00
Paul Sokolovsky e0d49b7e1b extmod/modwebsocket: Make compatible with non-default object models. 2016-08-06 15:53:16 +03:00
Paul Sokolovsky 6de37864a2 esp8266/scripts/inisetup: Add commented-out call to esp.osdebug(None).
That apparently will only help folks who read the docs on how to disable,
but could use a quick reminder straight in boot.py. For the developers,
it's important to have debug logging enabled in development branch
(master).
2016-08-06 15:27:38 +03:00
Paul Sokolovsky ca59f5f208 esp8266/flashbdev: Reserve extra sysparam sector for SDK 2.0.0 compatibility. 2016-08-06 15:21:49 +03:00