Commit Graph

67 Commits

Author SHA1 Message Date
Damien George
4ec803a42a all: Make static dicts use mp_rom_map_elem_t type and MP_ROM_xxx macros. 2017-08-21 21:34:23 +10:00
Alexander Steffen
55f33240f3 all: Use the name MicroPython consistently in comments
There were several different spellings of MicroPython present in comments,
when there should be only one.
2017-07-31 18:35:40 +10:00
Alexander Steffen
299bc62586 all: Unify header guard usage.
The code conventions suggest using header guards, but do not define how
those should look like and instead point to existing files. However, not
all existing files follow the same scheme, sometimes omitting header guards
altogether, sometimes using non-standard names, making it easy to
accidentally pick a "wrong" example.

This commit ensures that all header files of the MicroPython project (that
were not simply copied from somewhere else) follow the same pattern, that
was already present in the majority of files, especially in the py folder.

The rules are as follows.

Naming convention:
* start with the words MICROPY_INCLUDED
* contain the full path to the file
* replace special characters with _

In addition, there are no empty lines before #ifndef, between #ifndef and
one empty line before #endif. #endif is followed by a comment containing
the name of the guard macro.

py/grammar.h cannot use header guards by design, since it has to be
included multiple times in a single C file. Several other files also do not
need header guards as they are only used internally and guaranteed to be
included only once:
* MICROPY_MPHALPORT_H
* mpconfigboard.h
* mpconfigport.h
* mpthreadport.h
* pin_defs_*.h
* qstrdefs*.h
2017-07-18 11:57:39 +10:00
Damien George
22a6344ebe cc3200: When raising OSError's use MP_Exxx as arg instead of a string. 2017-02-22 12:58:11 +11:00
Damien George
1c35270667 cc3200: Remove util/std.h, can just use stdio.h instead. 2017-02-21 17:26:21 +11:00
Damien George
b7d27e31e8 cc3200: Refactor "ticks" functions to use common extmod implementation.
The port now uses the common mp_utime_ticks_{ms,us,cpu,add,diff} functions
from extmod/utime_mphal.c.

The mp_utime_sleep_XXX functions are still cc3200-specific because they
handle the GIL differently to the ones in extmod.

The files misc/mpsystick.[ch] have been removed because they contain 2
unused functions, and the other remaining function is renamed to
mp_hal_ticks_us and moved to hal/cc3200_hal.c.
2017-02-06 11:14:16 +11:00
Damien George
4d7fba83a6 cc3200: Convert to use builtin help function. 2017-01-22 11:56:16 +11:00
Paul Sokolovsky
eac22e29a5 all: Consistently update signatures of .make_new and .call methods.
Otherwise, they serve reoccurring source of copy-paste mistakes and
breaking nanbox build.
2017-01-04 16:10:42 +03:00
Damien George
50ddaafa6a cc3200: Use mp_raise_XXX helper functions to reduce code size.
Reduces code size by 632 bytes.
2016-10-18 09:53:43 +11:00
Damien George
d862a7b811 cc3200: Remove obsolete singleton heart-beat object. 2016-06-28 11:28:53 +01:00
Colin Hogben
104aa26271 cc3200, stmhal, teensy: Use pyhelp_print_obj function.
Update the help() implementations in the cc3200, stmhal and teensy
ports to use the pyhelp_print_obj function.
2016-04-25 18:54:59 +03:00
danicampora
73c9f85b4c cc3200: Simplify the Timer API and correct the documents.
Make the PWM duty cycle configurable from 0.00 to 100.00 by
accepting values from 0 to 10000.
Add automatic Pin assignment when operating in PWM mode.
2016-02-21 21:53:16 +01:00
danicampora
056cb288d9 cc3200: Remove includes of rom.h (must be included via rom_map.h). 2015-11-01 23:33:12 +01:00
Damien George
731f359292 all: Add py/mphal.h and use it in all ports.
py/mphal.h contains declarations for generic mp_hal_XXX functions, such
as stdio and delay/ticks, which ports should provide definitions for.  A
port will also provide mphalport.h with further HAL declarations.
2015-10-31 19:14:30 +03:00
Paul Sokolovsky
9b12bc788f cc3200: Switch from HAL_GetTick() to mp_hal_ticks_ms(). 2015-10-29 20:43:11 +03:00
danicampora
1f2daf4304 cc3200: Correct ticks_cpu and ticks_us functions in time module. 2015-10-21 15:30:57 +02:00
danicampora
d8137178bb cc3200: Create wipy module, remove HeartBeat class.
The heartbeat is now controllable via a single function within the
wipy module.
2015-10-19 21:17:15 +02:00
Damien George
0334058fa4 Rename "Micro Python" to "MicroPython" in REPL, help, readme's and misc. 2015-10-12 00:06:25 +01:00
Daniel Campora
dbdcb58d64 cc3200: New irq API, affects all classes that provide the irq method. 2015-09-27 01:48:20 +02:00
Daniel Campora
dffa9f6da6 cc3200: New SD and RTC API plus os and time modules' extensions. 2015-09-21 22:30:32 +02:00
Daniel Campora
c69642a460 cc3200: Increase error led blynk period to 100ms 2015-09-16 10:10:17 +02:00
Daniel Campora
f91f212d9f cc3200: New UART API plus related test. 2015-09-10 07:59:47 +02:00
Daniel Campora
36821d095a cc3200: Add alternate functions list to Pin object.
Also remove pin.high() and pin.low() methods.
2015-09-10 07:59:41 +02:00
Daniel Campora
598aad2140 cc3200: Fix bug in pybsleep remove. 2015-09-10 07:59:23 +02:00
Daniel Campora
e3f8777ee8 cc3200: Implement new Pin API. 2015-09-10 07:59:03 +02:00
Daniel Campora
aa8e8acb7d cc3200: Change HeartBeat period from 5 to 4 seconds. 2015-08-16 20:18:09 +02:00
Daniel Campora
9249242119 cc3200: Remove unneeded loops in the FreeRTOS hooks. 2015-08-16 20:18:05 +02:00
Daniel Campora
ea5061e409 cc3200: Improve callback API.
Rename "wakes" param to "wake_from" and make "value" an object
instead of an integer.
2015-08-16 20:17:52 +02:00
Daniel Campora
2673374d18 cc3200: Refactor PRCM special user bits implementation. 2015-08-09 22:15:18 +02:00
Daniel Campora
d18ced9cdd cc3200: Use alternative HAL_Delay also when interrupts are disabled. 2015-07-08 12:48:35 +02:00
Daniel Campora
fa655ce196 cc3200: Improve interrupt handling and fix bug in HAL_Delay(). 2015-07-07 16:11:05 +02:00
Daniel Campora
813b581127 cc3200: Add Pin.name() method. 2015-06-28 14:14:22 +02:00
Daniel Campora
330e21c986 cc3200: Use the pull up/down resistors on the antenna selection pins. 2015-06-10 23:35:38 +02:00
Daniel Campora
f960d753e4 cc3200: Fix bootloader build error. 2015-06-10 23:35:36 +02:00
Daniel Campora
6148f8b7d2 cc3200: Add contructor to the HeartBeat class. 2015-06-10 23:35:28 +02:00
Daniel Campora
491c321720 cc3200: Re-config antenna selection when waking from suspended mode. 2015-06-07 13:28:47 +02:00
Daniel Campora
b4a41a8f70 cc3200: Add missing antenna diversity source files. 2015-06-07 00:42:40 +02:00
Daniel Campora
a3acaa000c cc3200: Add antenna selection feature to WLAN. 2015-06-07 00:06:27 +02:00
Daniel Campora
a3cf4ea2f6 cc3200: Do not kick the watchdog inside the idle task. 2015-06-04 10:13:55 +02:00
Daniel Campora
90d7c4ef3d cc3200: Make HeartBeat.disable() thread safe. 2015-05-25 21:14:31 +02:00
Daniel Campora
c27dc38e85 cc3200: Re-name 'intmode' to 'mode' in the callback API. 2015-05-17 14:49:17 +02:00
Daniel Campora
8e611e8414 cc3200: Add Timer module. Supports free running, PWM and capture modes. 2015-05-17 12:34:49 +02:00
Daniel Campora
8c8d7f3c60 cc3200: Clean up pyb.Pin
Remove unused and unneeded functions, also create Pin.get_config() that
returns the whole configuration of the pin.

This reduces code size by ~500 bytes.
2015-05-03 11:26:56 +02:00
Damien George
259eaab9a9 cc3200: Clean up and reduce use/include of std.h. 2015-04-18 14:29:28 +01:00
Daniel Campora
c1a77a0c9f cc3200: Use new %q format to print qstr's where appropiate. 2015-04-17 10:15:55 +02:00
Damien George
7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
2015-04-16 14:30:16 +00:00
Daniel Campora
4be44014ab cc3200: Reenable active interrupts when waking from suspended mode. 2015-03-26 13:58:58 +01:00
Daniel Campora
2d717ad97a cc3200: Add callback support to the UART for RX interrupts. 2015-03-26 10:28:43 +01:00
Daniel Campora
26d230419c cc3200: Add GPIO25 to the pins list of the WiPy and the WiPy-SD.
This allows to properly initialize the system led and add it
to the sleep module so that it can be restored when resuming
from suspended mode.
2015-03-25 15:22:32 +01:00
danicampora
c1c23e2f6a cc3200: Remove superfluous code in pybsleep. 2015-03-21 11:27:26 +01:00