Commit Graph

47 Commits

Author SHA1 Message Date
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
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
Damien George 5b3f0b7f39 py: Change first arg of type.make_new from mp_obj_t to mp_obj_type_t*.
The first argument to the type.make_new method is naturally a uPy type,
and all uses of this argument cast it directly to a pointer to a type
structure.  So it makes sense to just have it a pointer to a type from
the very beginning (and a const pointer at that).  This patch makes
such a change, and removes all unnecessary casting to/from mp_obj_t.
2016-01-11 00:49:27 +00: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
danicampora 1950295735 cc3200: Set pin direction first, then value. Fixes #1542. 2015-10-26 23:26:43 +01:00
danicampora a654914de4 cc3200: Allow to read pin value when in OPEN_DRAIN mode. 2015-10-25 21:31:43 +01:00
Daniel Campora c92e6a45eb cc3200: Rename pyb module to machine. 2015-09-27 16:50:27 +02: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 22b4c28f85 cc3200: New ADC API. 2015-09-16 10:10:38 +02:00
Daniel Campora d5ec336eef cc3200: Replace Pin.PULL_NONE with None. 2015-09-16 10:10:24 +02:00
Daniel Campora 7d6b6f6681 cc3200: Make UART choose default id when not given. 2015-09-16 10:10:13 +02:00
Daniel Campora 359b4e9ed9 cc3200: Refactor pin af assigment functions. 2015-09-10 08:00:24 +02:00
Daniel Campora 4d7fa05b43 cc3200: Improve Pin and UART implementation.
Deassign pins af before assigning. Make uart.any() return the
correct value everytime, this requires interrupts to be always
enabled.
2015-09-10 08:00:12 +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 d5e256486e cc3200: Re-work Pin class according to the new API.
Also add relevant test.
2015-09-10 07:59:35 +02:00
Daniel Campora 475c60eefc cc3200: Add alt param to Pin constructor. 2015-09-10 07:59:16 +02:00
Daniel Campora e3f8777ee8 cc3200: Implement new Pin API. 2015-09-10 07:59:03 +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 007878781c cc3200: Rename pins from GPIO to just GP.
This is how the names will be printed on the sticker that goes on top
of the EMI shield. The shorter names also help saving a few bytes of
RAM and ROM.
2015-07-30 00:43:08 +02:00
Daniel Campora 7c1c9af5d4 cc3200: Code clean-up on pybpin. 2015-07-02 16:29:51 +02:00
Daniel Campora 813b581127 cc3200: Add `Pin.name()` method. 2015-06-28 14:14:22 +02:00
Daniel Campora 2abb58d758 cc3200: Rename Pin.get_config() to Pin.info(). 2015-05-28 13:10:46 +02:00
Daniel Campora fabe79f7af cc3200: Clean up exception handling. 2015-05-26 12:29:20 +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 cd3f2523f1 cc3200: Disable WLAN.urn() by default.
Can be enabled by defining MICROPY_PORT_WLAN_URN=1 in mpconfigport.h.
2015-05-17 14:20:24 +02:00
Daniel Campora a379b6ed11 cc3200: Add optional timeout param to WLAN.connect(). 2015-05-17 14:05:44 +02:00
Daniel Campora fb9e4cf463 cc3200: Make sure to handle all pending pin interrupts.
When entering the interrupt handler of a given GPIO port, more than
one pin could have pending interrupts, therefore care must be taken
to service each interrupt one by one before leaving.
2015-05-17 13:42:15 +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
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
danicampora 0e96d1b3f1 cc3200: Add parameter to wlan_stop() for custom timeout values. 2015-03-18 21:55:08 +01:00
danicampora 005a7f4190 cc3200: Fix extint_enable behaviour when the callback is updated. 2015-03-17 13:26:09 +01:00
danicampora 98b8568362 cc3200: Assign GPIO10 and GPIO11 to the GPIO peripheral on start-up. 2015-03-17 13:26:05 +01:00
danicampora b2cb75efb7 cc3200: Remove double administration of callback objects. 2015-03-16 00:42:09 +01:00
danicampora 04749e677f cc3200: Allow separate selection of the power mode in Pin callbacks. 2015-03-12 16:22:17 +01:00
danicampora 9e44383e3f cc3200: Add power management framework. Add mpcallback class.
Supports suspend and hibernate modes. Waking is possible throug GPIO
and WLAN.
The mpcallback class is generic and can be reused by other classes.
2015-03-11 17:00:33 +01:00
danicampora 73aee8da54 cc3200: Merge ExtInt class into Pin class.
Also add another method to change the pin's interrupt mode
on the fly.
2015-03-11 17:00:28 +01:00
danicampora d226dd2f59 cc3200: Add preliminary low power deep sleep support. 2015-03-11 16:54:09 +01:00
Damien George 4a23a01945 cc3200: Add explicit py/ path-prefix for py includes.
This is how it should be, so one knows exactly where the includes are
coming from.
2015-02-21 18:58:43 +00:00
danicampora c020109cfa cc3200: Add SD module and disable SD card support for the LAUNCHXL. 2015-02-21 14:19:40 +01:00
danicampora 868fa82ea4 cc3200: Add ADC module. 2015-02-20 16:40:59 +01:00
danicampora 99f3f6b5de cc3200: Add I2C module. Only master mode is currently supported. 2015-02-13 17:54:04 +01:00
danicampora 53716fcc3e cc3200: Rename GPIO module to Pin.
This change helps making the cc3200 port API a bit closer to stmhal.
The ramaining differences are due to the specific hardware details
of each chip. One feature that has been deliberately disabled is the
possibility to add custom names and custom pin mappings. Those
features are nice and convenient, but in this port, code size is a
major concern.
2015-02-09 20:01:54 +01:00