Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Daniel Tralamazza 2017-08-08 00:45:58 +02:00
commit b53b691314
891 changed files with 8751 additions and 3852 deletions

2
.gitignore vendored
View File

@ -9,7 +9,7 @@
*.dis
*.exe
# Packages
# Packages
############
# Logs and Databases

View File

@ -20,7 +20,8 @@ before_script:
# For teensy build
- sudo apt-get install realpath
# For coverage testing
- sudo pip install cpp-coveralls
# cpp-coveralls 0.4 conflicts with urllib3 preinstalled in Travis VM
- sudo pip install cpp-coveralls==0.3.12
- gcc --version
- arm-none-eabi-gcc --version
- python3 --version
@ -40,7 +41,7 @@ script:
- make -C qemu-arm test
- make -C stmhal
- make -C stmhal BOARD=PYBV11 MICROPY_PY_WIZNET5K=1 MICROPY_PY_CC3K=1
- make -C stmhal BOARD=STM32F7DISC
- make -C stmhal BOARD=STM32F769DISC
- make -C stmhal BOARD=STM32L476DISC
- make -C teensy
- make -C cc3200 BTARGET=application BTYPE=release

View File

@ -26,6 +26,27 @@ require such detailed description.
To get good practical examples of good commits and their messages, browse
the `git log` of the project.
MicroPython doesn't require explicit sign-off for patches ("Signed-off-by"
lines and similar). Instead, the commit message, and your name and email
address on it construes your sign-off of the following:
* That you wrote the change yourself, or took it from a project with
a compatible license (in the latter case the commit message, and possibly
source code should provide reference where the implementation was taken
from and give credit to the original author, as required by the license).
* That you are allowed to release these changes to an open-source project
(for example, changes done during paid work for a third party may require
explicit approval from that third party).
* That you (or your employer) agree to release the changes under
MicroPython's license, which is the MIT license. Note that you retain
copyright for your changes (for smaller changes, the commit message
conveys your copyright; if you make significant changes to a particular
source module, you're welcome to add your name to the file header).
* Your signature for all of the above, which is the 'Author' line in
the commit message, and which should include your full real name and
a valid and active email address by which you can be contacted in the
foreseeable future.
Python code conventions
=======================
@ -52,7 +73,7 @@ White space:
keyword and the opening parenthesis.
- Put 1 space after a comma, and 1 space around operators.
Braces:
Braces:
- Use braces for all blocks, even no-line and single-line pieces of
code.
- Put opening braces on the end of the line it belongs to, not on
@ -114,3 +135,76 @@ Type declarations:
int member;
void *data;
} my_struct_t;
Documentation conventions
=========================
MicroPython generally follows CPython in documentation process and
conventions. reStructuredText syntax is used for the documention.
Specific conventions/suggestions:
* Use `*` markup to refer to arguments of a function, e.g.:
```
.. method:: poll.unregister(obj)
Unregister *obj* from polling.
```
* Use following syntax for cross-references/cross-links:
```
:func:`foo` - function foo in current module
:func:`module1.foo` - function foo in module "module1"
(similarly for other referent types)
:class:`Foo` - class Foo
:meth:`Class.method1` - method1 in Class
:meth:`~Class.method1` - method1 in Class, but rendered just as "method1()",
not "Class.method1()"
:meth:`title <method1>` - reference method1, but render as "title" (use only
if really needed)
:mod:`module1` - module module1
`symbol` - generic xref syntax which can replace any of the above in case
the xref is unambiguous. If there's ambiguity, there will be a warning
during docs generation, which need to be fixed using one of the syntaxes
above
```
* Cross-referencing arbitrary locations
~~~
.. _xref_target:
Normal non-indented text.
This is :ref:`reference <xref_target>`.
(If xref target is followed by section title, can be just
:ref:`xref_target`).
~~~
* Linking to external URL:
```
`link text <http://foo.com/...>`_
```
* Referencing builtin singleton objects:
```
``None``, ``True``, ``False``
```
* Use following syntax to create common description for more than one element:
~~~
.. function:: foo(x)
bar(y)
Description common to foo() and bar().
~~~
More detailed guides and quickrefs:
* http://www.sphinx-doc.org/en/stable/rest.html
* http://www.sphinx-doc.org/en/stable/markup/inline.html
* http://docutils.sourceforge.net/docs/user/rst/quickref.html

View File

@ -22,12 +22,18 @@ Builtin modules include `sys`, `time`, and `struct`, etc. Select ports have
support for `_thread` module (multithreading). Note that only a subset of
Python 3 functionality is implemented for the data types and modules.
See the repository www.github.com/micropython/pyboard for the MicroPython
MicroPython can execute scripts in textual source form or from precompiled
bytecode, in both cases either from an on-device filesystem or "frozen" into
the MicroPython executable.
See the repository http://github.com/micropython/pyboard for the MicroPython
board (PyBoard), the officially supported reference electronic circuit board.
Major components in this repository:
- py/ -- the core Python implementation, including compiler, runtime, and
core library.
- mpy-cross/ -- the MicroPython cross-compiler which is used to turn scripts
into precompiled bytecode.
- unix/ -- a version of MicroPython that runs on Unix.
- stmhal/ -- a version of MicroPython that runs on the PyBoard and similar
STM32 boards (using ST's Cube HAL drivers).

View File

@ -1,6 +1,6 @@
#include <stdint.h>
// options to control how Micro Python is built
// options to control how MicroPython is built
#define MICROPY_QSTR_BYTES_IN_HASH (1)
#define MICROPY_ALLOC_PATH_MAX (512)

View File

@ -11,7 +11,7 @@ MEMORY
CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 0x010000 /* 64 KiB */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x020000 /* 128 KiB */
}
/* top end of the stack */
_estack = ORIGIN(RAM) + LENGTH(RAM);
@ -30,7 +30,7 @@ SECTIONS
. = ALIGN(4);
} >FLASH_ISR
/* The program code and other data goes into FLASH */
.text :
{
@ -46,7 +46,7 @@ SECTIONS
_etext = .; /* define a global symbol at end of code */
_sidata = _etext; /* This is used by the startup in order to initialize the .data secion */
} >FLASH_TEXT
/*
.ARM.extab :
{
@ -60,7 +60,7 @@ SECTIONS
__exidx_end = .;
} >FLASH
*/
/* This is the initialized data section
The program executes knowing that the data is in the RAM
but the loader puts the initial values in the FLASH (inidata).
@ -76,7 +76,7 @@ SECTIONS
. = ALIGN(4);
_edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
} >RAM
/* Uninitialized data section */
.bss :
{

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -37,7 +37,7 @@ ENTRY(ResetISR)
SECTIONS
{
/* place the FreeRTOS heap (the micropython stack will live here) */
/* place the FreeRTOS heap (the MicroPython stack will live here) */
.rtos_heap (NOLOAD) :
{
. = ALIGN(8);
@ -83,7 +83,7 @@ SECTIONS
} > SRAM
/* place here functions that are only called during boot up, */
/* that way, we can re-use this area for the micropython heap */
/* that way, we can re-use this area for the MicroPython heap */
.boot :
{
. = ALIGN(8);
@ -93,7 +93,7 @@ SECTIONS
_eboot = .;
} > SRAM
/* allocate the micropython heap */
/* allocate the MicroPython heap */
.heap :
{
. = ALIGN(8);

View File

@ -147,12 +147,12 @@ APP_LIB_SRC_C = $(addprefix lib/,\
netutils/netutils.c \
timeutils/timeutils.c \
utils/pyexec.c \
utils/sys_stdio_mphal.c \
)
APP_STM_SRC_C = $(addprefix stmhal/,\
bufhelper.c \
irq.c \
pybstdio.c \
)
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(APP_FATFS_SRC_C:.c=.o) $(APP_RTOS_SRC_C:.c=.o) $(APP_FTP_SRC_C:.c=.o) $(APP_HAL_SRC_C:.c=.o) $(APP_MISC_SRC_C:.c=.o))

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __BOOTMGR_H__
#define __BOOTMGR_H__
#ifndef MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
#define MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H
//****************************************************************************
//
@ -66,4 +65,4 @@ extern void Run(unsigned long);
}
#endif
#endif //__BOOTMGR_H__
#endif // MICROPY_INCLUDED_CC3200_BOOTMGR_BOOTMGR_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __FLC_H__
#define __FLC_H__
#ifndef MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
#define MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H
/******************************************************************************
@ -93,4 +92,4 @@ typedef struct _sBootInfo_t
}
#endif
#endif /* __FLC_H__ */
#endif // MICROPY_INCLUDED_CC3200_BOOTMGR_FLC_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -335,7 +335,7 @@ void ftp_run (void) {
ftp_data.loggin.uservalid = false;
ftp_data.loggin.passvalid = false;
strcpy (ftp_path, "/");
ftp_send_reply (220, "Micropython FTP Server");
ftp_send_reply (220, "MicroPython FTP Server");
break;
}
}

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef FTP_H_
#define FTP_H_
#ifndef MICROPY_INCLUDED_CC3200_FTP_FTP_H
#define MICROPY_INCLUDED_CC3200_FTP_FTP_H
/******************************************************************************
DECLARE EXPORTED FUNCTIONS
@ -36,4 +35,4 @@ extern void ftp_enable (void);
extern void ftp_disable (void);
extern void ftp_reset (void);
#endif /* FTP_H_ */
#endif // MICROPY_INCLUDED_CC3200_FTP_FTP_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,10 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef UPDATER_H_
#define UPDATER_H_
#ifndef MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
#define MICROPY_INCLUDED_CC3200_FTP_UPDATER_H
extern void updater_pre_init (void);
extern bool updater_check_path (void *path);
@ -35,4 +33,4 @@ extern bool updater_write (uint8_t *buf, uint32_t len);
extern void updater_finnish (void);
extern bool updater_verify (uint8_t *rbuff, uint8_t *hasbuff);
#endif /* UPDATER_H_ */
#endif // MICROPY_INCLUDED_CC3200_FTP_UPDATER_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,6 @@
* THE SOFTWARE.
*/
#ifndef CC3200_LAUNCHXL_HAL_CC3200_HAL_H_
#define CC3200_LAUNCHXL_HAL_CC3200_HAL_H_
#include <stdint.h>
#include <stdbool.h>
@ -69,5 +66,3 @@ extern void mp_hal_set_interrupt_char (int c);
#define mp_hal_delay_us(usec) UtilsDelay(UTILS_DELAY_US_TO_COUNT(usec))
#define mp_hal_ticks_cpu() (SysTickPeriodGet() - SysTickValueGet())
#endif /* CC3200_LAUNCHXL_HAL_CC3200_HAL_H_ */

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -89,7 +89,7 @@ int main (void) {
#ifndef DEBUG
OsiTaskHandle mpTaskHandle;
#endif
mpTaskHandle = xTaskCreateStatic(TASK_Micropython, "MicroPy",
mpTaskHandle = xTaskCreateStatic(TASK_MicroPython, "MicroPy",
MICROPY_TASK_STACK_LEN, NULL, MICROPY_TASK_PRIORITY, mpTaskStack, &mpTaskTCB);
ASSERT(mpTaskHandle != NULL);

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef _ANTENNA_H_
#define _ANTENNA_H_
#ifndef MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
#define MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H
typedef enum {
ANTENNA_TYPE_INTERNAL = 0,
@ -35,4 +34,4 @@ typedef enum {
extern void antenna_init0 (void);
extern void antenna_select (antenna_type_t antenna_type);
#endif /* _ANTENNA_H_ */
#endif // MICROPY_INCLUDED_CC3200_MISC_ANTENNA_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MPERROR_H_
#define MPERROR_H_
#ifndef MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
#define MICROPY_INCLUDED_CC3200_MISC_MPERROR_H
extern void NORETURN __fatal_error(const char *msg);
@ -39,4 +38,4 @@ void mperror_heartbeat_signal (void);
void mperror_enable_heartbeat (bool enable);
bool mperror_is_heartbeat_enabled (void);
#endif // MPERROR_H_
#endif // MICROPY_INCLUDED_CC3200_MISC_MPERROR_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MPEXCEPTION_H_
#define MPEXCEPTION_H_
#ifndef MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
#define MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H
extern const char mpexception_value_invalid_arguments[];
extern const char mpexception_num_type_invalid_arguments[];
@ -40,4 +39,4 @@ extern void mpexception_set_interrupt_char (int c);
extern void mpexception_nlr_jump (void *o);
extern void mpexception_keyboard_nlr_jump (void);
#endif /* MPEXCEPTION_H_ */
#endif // MICROPY_INCLUDED_CC3200_MISC_MPEXCEPTION_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -143,7 +143,7 @@ void mp_irq_handler (mp_obj_t self_in) {
}
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
STATIC mp_obj_t mp_irq_init (mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
mp_irq_obj_t *self = pos_args[0];

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MPIRQ_H_
#define MPIRQ_H_
#ifndef MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
#define MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H
/******************************************************************************
DEFINE CONSTANTS
@ -72,4 +71,4 @@ void mp_irq_remove (const mp_obj_t parent);
void mp_irq_handler (mp_obj_t self_in);
uint mp_irq_translate_priority (uint priority);
#endif /* MPIRQ_H_ */
#endif // MICROPY_INCLUDED_CC3200_MISC_MPIRQ_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -72,7 +72,7 @@ extern OsiTaskHandle xSimpleLinkSpawnTaskHndl;
///
/******************************************************************************/
// Micro Python bindings;
// MicroPython bindings;
STATIC mp_obj_t machine_reset(void) {
// disable wlan

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MODNETWORK_H_
#define MODNETWORK_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
#define MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H
/******************************************************************************
DEFINE CONSTANTS
@ -52,7 +51,7 @@ typedef struct _mod_network_socket_base_t {
} u_param;
int16_t sd;
};
bool has_timeout;
uint32_t timeout_ms; // 0 for no timeout
bool cert_req;
} mod_network_socket_base_t;
@ -71,4 +70,4 @@ extern const mod_network_nic_type_t mod_network_nic_type_wlan;
******************************************************************************/
void mod_network_init0(void);
#endif // MODNETWORK_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_MODNETWORK_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -44,7 +44,7 @@
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
STATIC const mp_map_elem_t mp_module_binascii_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_ubinascii) },

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MODUBINASCII_H_
#define MODUBINASCII_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
#define MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H
#endif /* MODUBINASCII_H_ */
#endif // MICROPY_INCLUDED_CC3200_MODS_MODUBINASCII_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -117,7 +117,7 @@ STATIC mp_obj_t hash_read (mp_obj_t self_in) {
}
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
/// \classmethod \constructor([data[, block_size]])
/// initial data must be given if block_size wants to be passed

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -78,7 +78,7 @@ void osmount_unmount_all (void) {
}
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
//
STATIC const qstr os_uname_info_fields[] = {

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MODUOS_H_
#define MODUOS_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
#define MICROPY_INCLUDED_CC3200_MODS_MODUOS_H
#include "py/obj.h"
@ -45,4 +44,4 @@ typedef struct _os_term_dup_obj_t {
******************************************************************************/
void osmount_unmount_all (void);
#endif // MODUOS_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_MODUOS_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -34,6 +34,7 @@
#include "py/objstr.h"
#include "py/runtime.h"
#include "py/stream.h"
#include "py/mphal.h"
#include "lib/netutils/netutils.h"
#include "modnetwork.h"
#include "modusocket.h"
@ -68,6 +69,31 @@
ip[2] = addr.sa_data[3]; \
ip[3] = addr.sa_data[2];
#define SOCKET_TIMEOUT_QUANTA_MS (20)
STATIC int convert_sl_errno(int sl_errno) {
return -sl_errno;
}
// This function is left as non-static so it's not inlined.
int check_timedout(mod_network_socket_obj_t *s, int ret, uint32_t *timeout_ms, int *_errno) {
if (*timeout_ms == 0 || ret != SL_EAGAIN) {
if (s->sock_base.timeout_ms > 0 && ret == SL_EAGAIN) {
*_errno = MP_ETIMEDOUT;
} else {
*_errno = convert_sl_errno(ret);
}
return -1;
}
mp_hal_delay_ms(SOCKET_TIMEOUT_QUANTA_MS);
if (*timeout_ms < SOCKET_TIMEOUT_QUANTA_MS) {
*timeout_ms = 0;
} else {
*timeout_ms -= SOCKET_TIMEOUT_QUANTA_MS;
}
return 0;
}
STATIC int wlan_gethostbyname(const char *name, mp_uint_t len, uint8_t *out_ip, uint8_t family) {
uint32_t ip;
int result = sl_NetAppDnsGetHostByName((_i8 *)name, (_u16)len, (_u32*)&ip, (_u8)family);
@ -122,70 +148,111 @@ STATIC int wlan_socket_accept(mod_network_socket_obj_t *s, mod_network_socket_ob
SlSockAddr_t addr;
SlSocklen_t addr_len = sizeof(addr);
sd = sl_Accept(s->sock_base.sd, &addr, &addr_len);
// save the socket descriptor
s2->sock_base.sd = sd;
if (sd < 0) {
*_errno = sd;
return -1;
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
sd = sl_Accept(s->sock_base.sd, &addr, &addr_len);
if (sd >= 0) {
// save the socket descriptor
s2->sock_base.sd = sd;
// return ip and port
UNPACK_SOCKADDR(addr, ip, *port);
return 0;
}
if (check_timedout(s, sd, &timeout_ms, _errno)) {
return -1;
}
}
// return ip and port
UNPACK_SOCKADDR(addr, ip, *port);
return 0;
}
STATIC int wlan_socket_connect(mod_network_socket_obj_t *s, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
int ret = sl_Connect(s->sock_base.sd, &addr, sizeof(addr));
if (ret != 0) {
*_errno = ret;
return -1;
uint32_t timeout_ms = s->sock_base.timeout_ms;
// For a non-blocking connect the CC3100 will return SL_EALREADY while the
// connection is in progress.
for (;;) {
int ret = sl_Connect(s->sock_base.sd, &addr, sizeof(addr));
if (ret == 0) {
return 0;
}
// Check if we are in non-blocking mode and the connection is in progress
if (s->sock_base.timeout_ms == 0 && ret == SL_EALREADY) {
// To match BSD we return EINPROGRESS here
*_errno = MP_EINPROGRESS;
return -1;
}
// We are in blocking mode, so if the connection isn't in progress then error out
if (ret != SL_EALREADY) {
*_errno = convert_sl_errno(ret);
return -1;
}
if (check_timedout(s, SL_EAGAIN, &timeout_ms, _errno)) {
return -1;
}
}
return 0;
}
STATIC int wlan_socket_send(mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, int *_errno) {
mp_int_t bytes = 0;
if (len > 0) {
bytes = sl_Send(s->sock_base.sd, (const void *)buf, len, 0);
if (len == 0) {
return 0;
}
if (bytes <= 0) {
*_errno = bytes;
return -1;
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
int ret = sl_Send(s->sock_base.sd, (const void *)buf, len, 0);
if (ret > 0) {
return ret;
}
if (check_timedout(s, ret, &timeout_ms, _errno)) {
return -1;
}
}
return bytes;
}
STATIC int wlan_socket_recv(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, int *_errno) {
int ret = sl_Recv(s->sock_base.sd, buf, MIN(len, WLAN_MAX_RX_SIZE), 0);
if (ret < 0) {
*_errno = ret;
return -1;
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
int ret = sl_Recv(s->sock_base.sd, buf, MIN(len, WLAN_MAX_RX_SIZE), 0);
if (ret >= 0) {
return ret;
}
if (check_timedout(s, ret, &timeout_ms, _errno)) {
return -1;
}
}
return ret;
}
STATIC int wlan_socket_sendto( mod_network_socket_obj_t *s, const byte *buf, mp_uint_t len, byte *ip, mp_uint_t port, int *_errno) {
MAKE_SOCKADDR(addr, ip, port)
int ret = sl_SendTo(s->sock_base.sd, (byte*)buf, len, 0, (SlSockAddr_t*)&addr, sizeof(addr));
if (ret < 0) {
*_errno = ret;
return -1;
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
int ret = sl_SendTo(s->sock_base.sd, (byte*)buf, len, 0, (SlSockAddr_t*)&addr, sizeof(addr));
if (ret >= 0) {
return ret;
}
if (check_timedout(s, ret, &timeout_ms, _errno)) {
return -1;
}
}
return ret;
}
STATIC int wlan_socket_recvfrom(mod_network_socket_obj_t *s, byte *buf, mp_uint_t len, byte *ip, mp_uint_t *port, int *_errno) {
SlSockAddr_t addr;
SlSocklen_t addr_len = sizeof(addr);
mp_int_t ret = sl_RecvFrom(s->sock_base.sd, buf, MIN(len, WLAN_MAX_RX_SIZE), 0, &addr, &addr_len);
if (ret < 0) {
*_errno = ret;
return -1;
uint32_t timeout_ms = s->sock_base.timeout_ms;
for (;;) {
int ret = sl_RecvFrom(s->sock_base.sd, buf, MIN(len, WLAN_MAX_RX_SIZE), 0, &addr, &addr_len);
if (ret >= 0) {
UNPACK_SOCKADDR(addr, ip, *port);
return ret;
}
if (check_timedout(s, ret, &timeout_ms, _errno)) {
return -1;
}
}
UNPACK_SOCKADDR(addr, ip, *port);
return ret;
}
STATIC int wlan_socket_setsockopt(mod_network_socket_obj_t *s, mp_uint_t level, mp_uint_t opt, const void *optval, mp_uint_t optlen, int *_errno) {
@ -198,10 +265,8 @@ STATIC int wlan_socket_setsockopt(mod_network_socket_obj_t *s, mp_uint_t level,
}
STATIC int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout_s, int *_errno) {
int ret;
bool has_timeout;
SlSockNonblocking_t option;
if (timeout_s == 0 || timeout_s == -1) {
SlSockNonblocking_t option;
if (timeout_s == 0) {
// set non-blocking mode
option.NonblockingEnabled = 1;
@ -209,23 +274,19 @@ STATIC int wlan_socket_settimeout(mod_network_socket_obj_t *s, mp_uint_t timeout
// set blocking mode
option.NonblockingEnabled = 0;
}
ret = sl_SetSockOpt(s->sock_base.sd, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &option, sizeof(option));
has_timeout = false;
timeout_s = 0;
} else {
// set timeout
struct SlTimeval_t timeVal;
timeVal.tv_sec = timeout_s; // seconds
timeVal.tv_usec = 0; // microseconds. 10000 microseconds resolution
ret = sl_SetSockOpt(s->sock_base.sd, SL_SOL_SOCKET, SL_SO_RCVTIMEO, &timeVal, sizeof(timeVal));
has_timeout = true;
// synthesize timeout via non-blocking behaviour with a loop
option.NonblockingEnabled = 1;
}
int ret = sl_SetSockOpt(s->sock_base.sd, SL_SOL_SOCKET, SL_SO_NONBLOCKING, &option, sizeof(option));
if (ret != 0) {
*_errno = ret;
*_errno = convert_sl_errno(ret);
return -1;
}
s->sock_base.has_timeout = has_timeout;
s->sock_base.timeout_ms = timeout_s * 1000;
return 0;
}
@ -379,7 +440,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t
s->sock_base.u_param.type = SL_SOCK_STREAM;
s->sock_base.u_param.proto = SL_IPPROTO_TCP;
s->sock_base.u_param.fileno = -1;
s->sock_base.has_timeout = false;
s->sock_base.timeout_ms = 0;
s->sock_base.cert_req = false;
if (n_args > 0) {
@ -462,7 +523,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
mp_uint_t port = 0;
int _errno = 0;
if (wlan_socket_accept(self, socket2, ip, &port, &_errno) != 0) {
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
// add the socket to the list
@ -490,7 +551,7 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
if (!self->sock_base.cert_req && _errno == SL_ESECSNOVERIFY) {
return mp_const_none;
}
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
return mp_const_none;
}
@ -504,7 +565,7 @@ STATIC mp_obj_t socket_send(mp_obj_t self_in, mp_obj_t buf_in) {
int _errno;
mp_int_t ret = wlan_socket_send(self, bufinfo.buf, bufinfo.len, &_errno);
if (ret < 0) {
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
return mp_obj_new_int_from_uint(ret);
}
@ -519,10 +580,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
int _errno;
mp_int_t ret = wlan_socket_recv(self, (byte*)vstr.buf, len, &_errno);
if (ret < 0) {
if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {
mp_raise_OSError(MP_ETIMEDOUT);
}
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
if (ret == 0) {
return mp_const_empty_bytes;
@ -549,7 +607,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
int _errno = 0;
mp_int_t ret = wlan_socket_sendto(self, bufinfo.buf, bufinfo.len, ip, port, &_errno);
if (ret < 0) {
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
return mp_obj_new_int(ret);
}
@ -565,10 +623,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
int _errno = 0;
mp_int_t ret = wlan_socket_recvfrom(self, (byte*)vstr.buf, vstr.len, ip, &port, &_errno);
if (ret < 0) {
if (_errno == MP_EAGAIN && self->sock_base.has_timeout) {
mp_raise_OSError(MP_ETIMEDOUT);
}
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
mp_obj_t tuple[2];
if (ret == 0) {
@ -624,9 +679,9 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
} else {
timeout = mp_obj_get_int(timeout_in);
}
int _errno;
int _errno = 0;
if (wlan_socket_settimeout(self, timeout, &_errno) != 0) {
mp_raise_OSError(-_errno);
mp_raise_OSError(_errno);
}
return mp_const_none;
}
@ -643,17 +698,8 @@ STATIC mp_obj_t socket_setblocking(mp_obj_t self_in, mp_obj_t blocking) {
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_setblocking_obj, socket_setblocking);
STATIC mp_obj_t socket_makefile(mp_uint_t n_args, const mp_obj_t *args) {
// TODO: CPython explicitly says that closing the returned object doesn't
// close the original socket (Python2 at all says that fd is dup()ed). But
// we save on the bloat.
mod_network_socket_obj_t *self = args[0];
if (n_args > 1) {
const char *mode = mp_obj_str_get_str(args[1]);
if (strcmp(mode, "rb") && strcmp(mode, "wb")) {
mp_raise_ValueError(mpexception_value_invalid_arguments);
}
}
return self;
(void)n_args;
return args[0];
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 6, socket_makefile);
@ -675,7 +721,7 @@ STATIC const mp_map_elem_t socket_locals_dict_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_makefile), (mp_obj_t)&socket_makefile_obj },
// stream methods
{ MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read1_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&mp_stream_readinto_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj},
{ MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj },
@ -689,10 +735,8 @@ STATIC mp_uint_t socket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *e
if (ret < 0) {
// we need to ignore the socket closed error here because a read() without params
// only returns when the socket is closed by the other end
if (*errcode != SL_ESECCLOSED) {
if (*errcode != -SL_ESECCLOSED) {
ret = MP_STREAM_ERROR;
// needed to convert simplelink's negative error codes to POSIX
(*errcode) *= -1;
} else {
ret = 0;
}
@ -705,8 +749,6 @@ STATIC mp_uint_t socket_write(mp_obj_t self_in, const void *buf, mp_uint_t size,
mp_int_t ret = wlan_socket_send(self, buf, size, errcode);
if (ret < 0) {
ret = MP_STREAM_ERROR;
// needed to convert simplelink's negative error codes to POSIX
(*errcode) *= -1;
}
return ret;
}

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MODUSOCKET_H_
#define MODUSOCKET_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
#define MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H
extern const mp_obj_dict_t socket_locals_dict;
extern const mp_stream_p_t socket_stream_p;
@ -36,4 +35,4 @@ extern void modusocket_socket_delete (int16_t sd);
extern void modusocket_enter_sleep (void);
extern void modusocket_close_all_user_sockets (void);
#endif /* MODUSOCKET_H_ */
#endif // MICROPY_INCLUDED_CC3200_MODS_MODUSOCKET_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -57,7 +57,7 @@ typedef struct _mp_obj_ssl_socket_t {
STATIC const mp_obj_type_t ssl_socket_type;
/******************************************************************************/
// Micro Python bindings; SSL class
// MicroPython bindings; SSL class
// ssl sockets inherit from normal socket, so we take its
// locals and stream methods

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -51,7 +51,7 @@
/// and for sleeping.
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
/// \function localtime([secs])
/// Convert a time expressed in seconds since Jan 1, 2000 into an 8-tuple which

View File

@ -5,7 +5,7 @@
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
STATIC mp_obj_t mod_wipy_heartbeat (mp_uint_t n_args, const mp_obj_t *args) {
if (n_args) {

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -763,7 +763,7 @@ STATIC bool wlan_scan_result_is_unique (const mp_obj_list_t *nets, _u8 *bssid) {
}
/******************************************************************************/
// Micro Python bindings; WLAN class
// MicroPython bindings; WLAN class
/// \class WLAN - WiFi driver

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MODWLAN_H_
#define MODWLAN_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
#define MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H
/******************************************************************************
DEFINE CONSTANTS
@ -97,4 +96,4 @@ extern bool wlan_is_connected (void);
extern void wlan_set_current_time (uint32_t seconds_since_2000);
extern void wlan_off_on (void);
#endif /* MODWLAN_H_ */
#endif // MICROPY_INCLUDED_CC3200_MODS_MODWLAN_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -126,7 +126,7 @@ STATIC void pyb_adc_deinit_all_channels (void) {
}
/******************************************************************************/
/* Micro Python bindings : adc object */
/* MicroPython bindings : adc object */
STATIC void adc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_adc_obj_t *self = self_in;

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,10 +24,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBADC_H_
#define PYBADC_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBADC_H
extern const mp_obj_type_t pyb_adc_type;
#endif /* PYBADC_H_ */
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBADC_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -281,7 +281,7 @@ STATIC void pyb_i2c_readmem_into (mp_arg_val_t *args, vstr_t *vstr) {
}
/******************************************************************************/
/* Micro Python bindings */
/* MicroPython bindings */
/******************************************************************************/
STATIC void pyb_i2c_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_i2c_obj_t *self = self_in;

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,10 +24,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBI2C_H_
#define PYBI2C_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H
extern const mp_obj_type_t pyb_i2c_type;
#endif // PYBI2C_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBI2C_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -519,7 +519,7 @@ STATIC void EXTI_Handler(uint port) {
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
STATIC const mp_arg_t pin_init_args[] = {
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBPIN_H_
#define PYBPIN_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H
enum {
PORT_A0 = GPIOA0_BASE,
@ -138,4 +137,4 @@ uint8_t pin_find_peripheral_unit (const mp_obj_t pin, uint8_t fn, uint8_t type);
uint8_t pin_find_peripheral_type (const mp_obj_t pin, uint8_t fn, uint8_t unit);
int8_t pin_find_af_index (const pin_obj_t* pin, uint8_t fn, uint8_t unit, uint8_t type);;
#endif // PYBPIN_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBPIN_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -278,7 +278,7 @@ STATIC void rtc_msec_add (uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2) {
}
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
STATIC const mp_arg_t pyb_rtc_init_args[] = {
{ MP_QSTR_id, MP_ARG_INT, {.u_int = 0} },

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBRTC_H_
#define PYBRTC_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H
// RTC triggers
#define PYB_RTC_ALARM0 (0x01)
@ -56,4 +55,4 @@ extern void pyb_rtc_calc_future_time (uint32_t a_mseconds, uint32_t *f_seconds,
extern void pyb_rtc_repeat_alarm (pyb_rtc_obj_t *self);
extern void pyb_rtc_disable_alarm (void);
#endif // PYBRTC_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBRTC_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -118,7 +118,7 @@ STATIC mp_obj_t pyb_sd_init_helper (pybsd_obj_t *self, const mp_arg_val_t *args)
}
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
//
STATIC const mp_arg_t pyb_sd_init_args[] = {

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,8 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBSD_H_
#define PYBSD_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBSD_H
/******************************************************************************
DEFINE PUBLIC TYPES
@ -41,4 +41,4 @@ typedef struct {
extern pybsd_obj_t pybsd_obj;
extern const mp_obj_type_t pyb_sd_type;
#endif // PYBSD_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSD_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBSLEEP_H_
#define PYBSLEEP_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H
/******************************************************************************
DEFINE CONSTANTS
@ -70,4 +69,4 @@ void pyb_sleep_deepsleep (void);
pybsleep_reset_cause_t pyb_sleep_get_reset_cause (void);
pybsleep_wake_reason_t pyb_sleep_get_wake_reason (void);
#endif /* PYBSLEEP_H_ */
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSLEEP_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -144,7 +144,7 @@ STATIC void pybspi_transfer (pyb_spi_obj_t *self, const char *txdata, char *rxda
}
/******************************************************************************/
/* Micro Python bindings */
/* MicroPython bindings */
/******************************************************************************/
STATIC void pyb_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_spi_obj_t *self = self_in;

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,10 +24,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBSPI_H_
#define PYBSPI_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H
extern const mp_obj_type_t pyb_spi_type;
#endif // PYBSPI_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBSPI_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -264,7 +264,7 @@ STATIC void timer_channel_init (pyb_timer_channel_obj_t *ch) {
}
/******************************************************************************/
/* Micro Python bindings */
/* MicroPython bindings */
STATIC void pyb_timer_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_timer_obj_t *tim = self_in;

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,6 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H
/******************************************************************************
DECLARE EXPORTED DATA
@ -35,3 +37,4 @@ extern const mp_obj_type_t pyb_timer_type;
******************************************************************************/
void timer_init0 (void);
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBTIMER_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -27,7 +27,6 @@
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "py/mpconfig.h"
@ -312,7 +311,7 @@ STATIC int uart_irq_flags (mp_obj_t self_in) {
}
/******************************************************************************/
/* Micro Python bindings */
/* MicroPython bindings */
STATIC void pyb_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pyb_uart_obj_t *self = self_in;

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,9 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBUART_H_
#define PYBUART_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBUART_H
typedef enum {
PYB_UART_0 = 0,
@ -43,4 +42,4 @@ int uart_rx_char(pyb_uart_obj_t *uart_obj);
bool uart_tx_char(pyb_uart_obj_t *self, int c);
bool uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len);
#endif // PYBUART_H_
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBUART_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -87,7 +87,7 @@ void pybwdt_sl_alive (void) {
}
/******************************************************************************/
// Micro Python bindings
// MicroPython bindings
STATIC const mp_arg_t pyb_wdt_init_args[] = {
{ MP_QSTR_id, MP_ARG_OBJ, {.u_obj = mp_const_none} },

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef PYBWDT_H_
#define PYBWDT_H_
#ifndef MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
#define MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H
#include "py/obj.h"
@ -36,4 +35,4 @@ void pybwdt_srv_alive (void);
void pybwdt_srv_sleeping (bool state);
void pybwdt_sl_alive (void);
#endif /* PYBWDT_H_ */
#endif // MICROPY_INCLUDED_CC3200_MODS_PYBWDT_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -25,9 +25,6 @@
* THE SOFTWARE.
*/
#ifndef __INCLUDED_MPCONFIGPORT_H
#define __INCLUDED_MPCONFIGPORT_H
#include <stdint.h>
#ifndef BOOTLOADER
@ -35,7 +32,7 @@
#include "semphr.h"
#endif
// options to control how Micro Python is built
// options to control how MicroPython is built
#define MICROPY_ALLOC_PATH_MAX (128)
#define MICROPY_PERSISTENT_CODE_LOAD (1)
@ -235,5 +232,3 @@ typedef long mp_off_t;
#define MICROPY_PORT_WLAN_AP_KEY "www.wipy.io"
#define MICROPY_PORT_WLAN_AP_SECURITY SL_SEC_TYPE_WPA_WPA2
#define MICROPY_PORT_WLAN_AP_CHANNEL 5
#endif // __INCLUDED_MPCONFIGPORT_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -112,7 +112,7 @@ static const char fresh_boot_py[] = "# boot.py -- run on boot-up\r\n"
DECLARE PUBLIC FUNCTIONS
******************************************************************************/
void TASK_Micropython (void *pvParameters) {
void TASK_MicroPython (void *pvParameters) {
// get the top of the stack to initialize the garbage collector
uint32_t sp = gc_helper_get_sp();

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MPTASK_H_
#define MPTASK_H_
#ifndef MICROPY_INCLUDED_CC3200_MPTASK_H
#define MICROPY_INCLUDED_CC3200_MPTASK_H
/******************************************************************************
DEFINE CONSTANTS
@ -42,6 +41,6 @@ extern StackType_t mpTaskStack[];
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
******************************************************************************/
extern void TASK_Micropython (void *pvParameters);
extern void TASK_MicroPython (void *pvParameters);
#endif /* MPTASK_H_ */
#endif // MICROPY_INCLUDED_CC3200_MPTASK_H

View File

@ -23,8 +23,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
#define __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__
#ifndef BOOTLOADER
#include "FreeRTOS.h"
@ -39,5 +37,3 @@ typedef struct _mp_thread_mutex_t {
void mp_thread_init(void);
void mp_thread_gc_others(void);
#endif // __MICROPY_INCLUDED_CC3200_MPTHREADPORT_H__

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef SERVERSTASK_H_
#define SERVERSTASK_H_
#ifndef MICROPY_INCLUDED_CC3200_SERVERSTASK_H
#define MICROPY_INCLUDED_CC3200_SERVERSTASK_H
/******************************************************************************
DEFINE CONSTANTS
@ -73,4 +72,4 @@ extern void server_sleep_sockets (void);
extern void servers_set_timeout (uint32_t timeout);
extern uint32_t servers_get_timeout (void);
#endif /* SERVERSTASK_H_ */
#endif // MICROPY_INCLUDED_CC3200_SERVERSTASK_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef TELNET_H_
#define TELNET_H_
#ifndef MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
#define MICROPY_INCLUDED_CC3200_TELNET_TELNET_H
/******************************************************************************
DECLARE EXPORTED FUNCTIONS
@ -39,4 +38,4 @@ extern void telnet_enable (void);
extern void telnet_disable (void);
extern void telnet_reset (void);
#endif /* TELNET_H_ */
#endif // MICROPY_INCLUDED_CC3200_TELNET_TELNET_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef CRYPTOHASH_H_
#define CRYPTOHASH_H_
#ifndef MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
#define MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
/******************************************************************************
DECLARE PUBLIC FUNCTIONS
@ -35,4 +34,4 @@ extern void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen);
extern void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
extern void CRYPTOHASH_SHAMD5Read (uint8_t *hash);
#endif /* CRYPTOHASH_H_ */
#endif // MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef FIFO_H_
#define FIFO_H_
#ifndef MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
#define MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
typedef struct {
void *pvElements;
@ -47,4 +46,4 @@ extern bool FIFO_IsEmpty (FIFO_t *fifo);
extern bool FIFO_IsFull (FIFO_t *fifo);
extern void FIFO_Flush (FIFO_t *fifo);
#endif /* FIFO_H_ */
#endif // MICROPY_INCLUDED_CC3200_UTIL_FIFO_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,6 +24,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
#define MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
// variables defining memory layout
extern uint32_t _etext;
@ -39,3 +41,5 @@ extern uint32_t _stack;
extern uint32_t _estack;
void gc_collect(void);
#endif // MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -24,11 +24,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef GC_HELPER_H_
#define GC_HELPER_H_
#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
#define MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
extern mp_uint_t gc_helper_get_sp(void);
extern mp_uint_t gc_helper_get_regs_and_sp(mp_uint_t *regs);
#endif /* GC_HELPER_H_ */
#endif // MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -67,7 +67,7 @@ STATIC uint32_t lfsr (uint32_t input) {
}
/******************************************************************************/
// Micro Python bindings;
// MicroPython bindings;
STATIC mp_obj_t machine_rng_get(void) {
return mp_obj_new_int(rng_get());

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,13 +23,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef __RANDOM_H
#define __RANDOM_H
#ifndef MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
#define MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
void rng_init0 (void);
uint32_t rng_get (void);
MP_DECLARE_CONST_FUN_OBJ_0(machine_rng_get_obj);
#endif // __RANDOM_H
#endif // MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,11 +23,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef SLEEPRESTORE_H_
#define SLEEPRESTORE_H_
#ifndef MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
#define MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
extern void sleep_store(void);
extern void sleep_restore(void);
#endif /* SLEEPRESTORE_H_ */
#endif // MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,9 +23,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef SOCKETFIFO_H_
#define SOCKETFIFO_H_
#ifndef MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
#define MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
/*----------------------------------------------------------------------------
** Imports
@ -60,4 +59,4 @@ extern bool SOCKETFIFO_IsFull (void);
extern void SOCKETFIFO_Flush (void);
extern unsigned int SOCKETFIFO_Count (void);
#endif /* SOCKETFIFO_H_ */
#endif // MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H

View File

@ -1,5 +1,5 @@
/*
* This file is part of the Micro Python project, http://micropython.org/
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
@ -23,10 +23,9 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef VERSION_H_
#define VERSION_H_
#ifndef MICROPY_INCLUDED_CC3200_VERSION_H
#define MICROPY_INCLUDED_CC3200_VERSION_H
#define WIPY_SW_VERSION_NUMBER "1.2.0"
#endif /* VERSION_H_ */
#endif // MICROPY_INCLUDED_CC3200_VERSION_H

View File

@ -96,10 +96,9 @@ copyright = '2014-2017, Damien P. George, Paul Sokolovsky, and contributors'
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.9'
# The full version, including alpha/beta/rc tags.
release = '1.9'
# We don't follow "The short X.Y version" vs "The full version, including alpha/beta/rc tags"
# breakdown, so use the same version identifier for both to avoid confusion.
version = release = '1.9.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -113,11 +112,11 @@ release = '1.9'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['build']
exclude_patterns = ['build', '.venv']
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
default_role = 'any'
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
@ -139,6 +138,12 @@ pygments_style = 'sphinx'
# If true, keep warnings as "system message" paragraphs in the built documents.
#keep_warnings = False
# Global include files. Sphinx docs suggest using rst_epilog in preference
# of rst_prolog, so we follow. Absolute paths below mean "from the base
# of the doctree".
rst_epilog = """
.. include:: /templates/replace.inc
"""
# -- Options for HTML output ----------------------------------------------
@ -246,6 +251,8 @@ latex_elements = {
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Include 3 levels of headers in PDF ToC
'preamble': '\setcounter{tocdepth}{2}',
}
# Grouping the document tree into LaTeX files. List of tuples
@ -315,7 +322,7 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {'python': ('http://docs.python.org/3', None)}
# Append the other ports' specific folders/files to the exclude pattern
exclude_patterns.extend([port + '*' for port in ports if port != micropy_port])

View File

@ -1,4 +1,6 @@
MicroPython Differences from CPython
.. _cpython_diffs:
MicroPython differences from CPython
====================================
The operations listed in this section produce conflicting results in MicroPython when compared to standard Python.

View File

@ -116,9 +116,32 @@ Real-time clock
RTC in ESP8266 has very bad accuracy, drift may be seconds per minute. As
a workaround, to measure short enough intervals you can use
``utime.time()``, etc. functions, and for wall clock time, synchronize from
the net using included ``ntpdate.py`` module.
the net using included ``ntptime.py`` module.
Due to limitations of the ESP8266 chip the internal real-time clock (RTC)
will overflow every 7:45h. If a long-term working RTC time is required then
``time()`` or ``localtime()`` must be called at least once within 7 hours.
MicroPython will then handle the overflow.
Sockets and WiFi buffers overflow
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Socket instances remain active until they are explicitly closed. This has two
consequences. Firstly they occupy RAM, so an application which opens sockets
without closing them may eventually run out of memory. Secondly not properly
closed socket can cause the low-level part of the vendor WiFi stack to emit
``Lmac`` errors. This occurs if data comes in for a socket and is not
processed in a timely manner. This can overflow the WiFi stack input queue
and lead to a deadlock. The only recovery is by a hard reset.
The above may also happen after an application terminates and quits to the REPL
for any reason including an exception. Subsequent arrival of data provokes the
failure with the above error message repeatedly issued. So, sockets should be
closed in any case, regardless whether an application terminates successfully
or by an exeption, for example using try/finally::
sock = socket(...)
try:
# Use sock
finally:
sock.close()

View File

@ -50,12 +50,16 @@ From here, you have 3 main choices
* Daily firmware builds for 1024kb modules and above.
* Daily firmware builds for 512kb modules.
The best bet is nearly always to go for the Stable firmware builds.
An exception to this though is if you have an ESP8266 module with only 512kb
of onboard storage. You can easily tell by trying to load a Stable firmware
build and if you get the error below, then you may have to use the Daily
firmware builds for 512kb modules.
WARNING: Unlikely to work as data goes beyond end of flash.
If you are just starting with MicroPython, the best bet is to go for the Stable
firmware builds. If you are an advanced, experienced MicroPython ESP8266 user
who would like to follow development closely and help with testing new
features, there are daily builds (note: you actually may need some
development experience, e.g. being ready to follow git history to know
what new changes and features were introduced).
Support for 512kb modules is provided on a feature preview basis. For end
users, it's recommended to use modules with flash of 1024kb or more. As
such, only daily builds for 512kb modules are provided.
Deploying the firmware
----------------------
@ -161,7 +165,9 @@ after it, here are troubleshooting recommendations:
* If lower baud rate didn't help, you may want to try older version of
esptool.py, which had a different programming algorithm::
pip install esptool==1.0.1
This version doesn't support ``--flash_size=detect`` option, so you will
need to specify FlashROM size explicitly (in megabits). It also requires
Python 2.7, so you may need to use ``pip2`` instead of ``pip`` in the
@ -176,8 +182,10 @@ after it, here are troubleshooting recommendations:
* Additionally, you can check the firmware integrity from a MicroPython REPL
prompt (assuming you were able to flash it and ``--verify`` option doesn't
report errors)::
import esp
esp.check_fw()
If the last output value is True, the firmware is OK. Otherwise, it's
corrupted and need to be reflashed correctly.

View File

@ -22,7 +22,7 @@ processing power, at the expense of current consumption::
160000000
You can change to the higher frequency just while your code does the heavy
processing and then change back when its finished.
processing and then change back when it's finished.
Deep-sleep mode
---------------

View File

@ -1,12 +0,0 @@
MicroPython documentation contents
==================================
.. toctree::
esp8266/quickref.rst
esp8266/general.rst
esp8266/tutorial/index.rst
library/index.rst
reference/index.rst
genrst/index.rst
license.rst

View File

@ -4,14 +4,9 @@ MicroPython documentation and references
.. toctree::
esp8266/quickref.rst
esp8266/general.rst
esp8266/tutorial/index.rst
library/index.rst
reference/index.rst
genrst/index.rst
license.rst
esp8266_contents.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

View File

@ -4,8 +4,7 @@
.. module:: array
:synopsis: efficient arrays of numeric data
See `Python array <https://docs.python.org/3/library/array.html>`_ for more
information.
|see_cpython_module| :mod:`python:array`.
Supported format codes: ``b``, ``B``, ``h``, ``H``, ``i``, ``I``, ``l``,
``L``, ``q``, ``Q``, ``f``, ``d`` (the latter 2 depending on the

View File

@ -22,8 +22,14 @@ Example::
# First, we need to open a stream which holds a database
# This is usually a file, but can be in-memory database
# using uio.BytesIO, a raw flash section, etc.
f = open("mydb", "w+b")
# using uio.BytesIO, a raw flash partition, etc.
# Oftentimes, you want to create a database file if it doesn't
# exist and open if it exists. Idiom below takes care of this.
# DO NOT open database with "a+b" access mode.
try:
f = open("mydb", "r+b")
except OSError:
f = open("mydb", "w+b")
# Now open a database itself
db = btree.open(f)
@ -33,6 +39,11 @@ Example::
db[b"1"] = b"one"
db[b"2"] = b"two"
# Assume that any changes are cached in memory unless
# explicitly flushed (or database closed). Flush database
# at the end of each "transaction".
db.flush()
# Prints b'two'
print(db[b"2"])
@ -71,18 +82,18 @@ Functions
other parameters are optional and keyword-only, and allow to tweak advanced
parameters of the database operation (most users will not need them):
* `flags` - Currently unused.
* `cachesize` - Suggested maximum memory cache size in bytes. For a
* *flags* - Currently unused.
* *cachesize* - Suggested maximum memory cache size in bytes. For a
board with enough memory using larger values may improve performance.
The value is only a recommendation, the module may use more memory if
values set too low.
* `pagesize` - Page size used for the nodes in BTree. Acceptable range
* *pagesize* - Page size used for the nodes in BTree. Acceptable range
is 512-65536. If 0, underlying I/O block size will be used (the best
compromise between memory usage and performance).
* `minkeypage` - Minimum number of keys to store per page. Default value
* *minkeypage* - Minimum number of keys to store per page. Default value
of 0 equivalent to 2.
Returns a `BTree` object, which implements a dictionary protocol (set
Returns a BTree object, which implements a dictionary protocol (set
of methods), and some additional methods described below.
Methods
@ -92,7 +103,7 @@ Methods
Close the database. It's mandatory to close the database at the end of
processing, as some unwritten data may be still in the cache. Note that
this does not close underlying streamw with which the database was opened,
this does not close underlying stream with which the database was opened,
it should be closed separately (which is also mandatory to make sure that
data flushed from buffer to the underlying storage).
@ -101,10 +112,10 @@ Methods
Flush any data in cache to the underlying stream.
.. method:: btree.__getitem__(key)
.. method:: btree.get(key, default=None)
.. method:: btree.__setitem__(key, val)
.. method:: btree.__detitem__(key)
.. method:: btree.__contains__(key)
btree.get(key, default=None)
btree.__setitem__(key, val)
btree.__detitem__(key)
btree.__contains__(key)
Standard dictionary methods.
@ -114,20 +125,20 @@ Methods
to get access to all keys in order.
.. method:: btree.keys([start_key, [end_key, [flags]]])
.. method:: btree.values([start_key, [end_key, [flags]]])
.. method:: btree.items([start_key, [end_key, [flags]]])
btree.values([start_key, [end_key, [flags]]])
btree.items([start_key, [end_key, [flags]]])
These methods are similar to standard dictionary methods, but also can
take optional parameters to iterate over a key sub-range, instead of
the entire database. Note that for all 3 methods, `start_key` and
`end_key` arguments represent key values. For example, ``values()``
the entire database. Note that for all 3 methods, *start_key* and
*end_key* arguments represent key values. For example, `values()`
method will iterate over values corresponding to they key range
given. None values for `start_key` means "from the first key", no
`end_key` or its value of None means "until the end of database".
By default, range is inclusive of `start_key` and exclusive of
`end_key`, you can include `end_key` in iteration by passing `flags`
given. None values for *start_key* means "from the first key", no
*end_key* or its value of None means "until the end of database".
By default, range is inclusive of *start_key* and exclusive of
*end_key*, you can include *end_key* in iteration by passing *flags*
of `btree.INCL`. You can iterate in descending key direction
by passing `flags` of `btree.DESC`. The flags values can be ORed
by passing *flags* of `btree.DESC`. The flags values can be ORed
together.
Constants

Some files were not shown because too many files have changed in this diff Show More