all: Fix spelling mistakes based on codespell check.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
e160fe7bc6
commit
b1229efbd1
2
.github/ISSUE_TEMPLATE/security.md
vendored
2
.github/ISSUE_TEMPLATE/security.md
vendored
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Security report
|
||||
about: Report a security issue or vunerability in MicroPython
|
||||
about: Report a security issue or vulnerability in MicroPython
|
||||
title: ''
|
||||
labels: security
|
||||
assignees: ''
|
||||
|
@ -255,7 +255,7 @@ Documentation conventions
|
||||
=========================
|
||||
|
||||
MicroPython generally follows CPython in documentation process and
|
||||
conventions. reStructuredText syntax is used for the documention.
|
||||
conventions. reStructuredText syntax is used for the documentation.
|
||||
|
||||
Specific conventions/suggestions:
|
||||
|
||||
|
@ -53,7 +53,7 @@ A MicroPython user C module is a directory with the following files:
|
||||
``SRC_USERMOD_C`` or ``SRC_USERMOD_LIB_C`` variables. The former will be
|
||||
processed for ``MP_QSTR_`` and ``MP_REGISTER_MODULE`` definitions, the latter
|
||||
will not (e.g. helpers and library code that isn't MicroPython-specific).
|
||||
These paths should include your expaned copy of ``$(USERMOD_DIR)``, e.g.::
|
||||
These paths should include your expanded copy of ``$(USERMOD_DIR)``, e.g.::
|
||||
|
||||
SRC_USERMOD_C += $(EXAMPLE_MOD_DIR)/modexample.c
|
||||
SRC_USERMOD_LIB_C += $(EXAMPLE_MOD_DIR)/utils/algorithm.c
|
||||
|
@ -17,7 +17,7 @@ Requirements
|
||||
The first thing you need is a board with an ESP32 chip. The MicroPython
|
||||
software supports the ESP32 chip itself and any board should work. The main
|
||||
characteristic of a board is how the GPIO pins are connected to the outside
|
||||
world, and whether it includes a built-in USB-serial convertor to make the
|
||||
world, and whether it includes a built-in USB-serial converter to make the
|
||||
UART available to your PC.
|
||||
|
||||
Names of pins will be given in this tutorial using the chip names (eg GPIO2)
|
||||
@ -59,7 +59,7 @@ bootloader mode, and second you need to copy across the firmware. The exact
|
||||
procedure for these steps is highly dependent on the particular board and you will
|
||||
need to refer to its documentation for details.
|
||||
|
||||
Fortunately, most boards have a USB connector, a USB-serial convertor, and the DTR
|
||||
Fortunately, most boards have a USB connector, a USB-serial converter, and the DTR
|
||||
and RTS pins wired in a special way then deploying the firmware should be easy as
|
||||
all steps can be done automatically. Boards that have such features
|
||||
include the Adafruit Feather HUZZAH32, M5Stack, Wemos LOLIN32, and TinyPICO
|
||||
@ -104,7 +104,7 @@ Serial prompt
|
||||
|
||||
Once you have the firmware on the device you can access the REPL (Python prompt)
|
||||
over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
|
||||
convertor, depending on your board. The baudrate is 115200.
|
||||
converter, depending on your board. The baudrate is 115200.
|
||||
|
||||
From here you can now follow the ESP8266 tutorial, because these two Espressif chips
|
||||
are very similar when it comes to using MicroPython on them. The ESP8266 tutorial
|
||||
@ -124,7 +124,7 @@ after it, here are troubleshooting recommendations:
|
||||
|
||||
* The flashing instructions above use flashing speed of 460800 baud, which is
|
||||
good compromise between speed and stability. However, depending on your
|
||||
module/board, USB-UART convertor, cables, host OS, etc., the above baud
|
||||
module/board, USB-UART converter, cables, host OS, etc., the above baud
|
||||
rate may be too high and lead to errors. Try a more common 115200 baud
|
||||
rate instead in such cases.
|
||||
|
||||
|
@ -18,7 +18,7 @@ The first thing you need is a board with an ESP8266 chip. The MicroPython
|
||||
software supports the ESP8266 chip itself and any board should work. The main
|
||||
characteristic of a board is how much flash it has, how the GPIO pins are
|
||||
connected to the outside world, and whether it includes a built-in USB-serial
|
||||
convertor to make the UART available to your PC.
|
||||
converter to make the UART available to your PC.
|
||||
|
||||
The minimum requirement for flash size is 1Mbyte. There is also a special
|
||||
build for boards with 512KB, but it is highly limited comparing to the
|
||||
@ -70,7 +70,7 @@ need to put your device in boot-loader mode, and second you need to copy across
|
||||
the firmware. The exact procedure for these steps is highly dependent on the
|
||||
particular board and you will need to refer to its documentation for details.
|
||||
|
||||
If you have a board that has a USB connector, a USB-serial convertor, and has
|
||||
If you have a board that has a USB connector, a USB-serial converter, and has
|
||||
the DTR and RTS pins wired in a special way then deploying the firmware should
|
||||
be easy as all steps can be done automatically. Boards that have such features
|
||||
include the Adafruit Feather HUZZAH and NodeMCU boards.
|
||||
@ -128,7 +128,7 @@ Serial prompt
|
||||
|
||||
Once you have the firmware on the device you can access the REPL (Python prompt)
|
||||
over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
|
||||
convertor, depending on your board. The baudrate is 115200. The next part of
|
||||
converter, depending on your board. The baudrate is 115200. The next part of
|
||||
the tutorial will discuss the prompt in more detail.
|
||||
|
||||
WiFi
|
||||
@ -169,7 +169,7 @@ after it, here are troubleshooting recommendations:
|
||||
|
||||
* The flashing instructions above use flashing speed of 460800 baud, which is
|
||||
good compromise between speed and stability. However, depending on your
|
||||
module/board, USB-UART convertor, cables, host OS, etc., the above baud
|
||||
module/board, USB-UART converter, cables, host OS, etc., the above baud
|
||||
rate may be too high and lead to errors. Try a more common 115200 baud
|
||||
rate instead in such cases.
|
||||
|
||||
|
@ -13,7 +13,7 @@ REPL over the serial port
|
||||
|
||||
The REPL is always available on the UART0 serial peripheral, which is connected
|
||||
to the pins GPIO1 for TX and GPIO3 for RX. The baudrate of the REPL is 115200.
|
||||
If your board has a USB-serial convertor on it then you should be able to access
|
||||
If your board has a USB-serial converter on it then you should be able to access
|
||||
the REPL directly from your PC. Otherwise you will need to have a way of
|
||||
communicating with the UART.
|
||||
|
||||
|
@ -75,7 +75,7 @@ Classes
|
||||
Returns the string representation of the array, called as ``str(a)`` or ``repr(a)```
|
||||
(where ``a`` is an ``array``). Returns the string ``"array(<type>, [<elements>])"``,
|
||||
where ``<type>`` is the type code letter for the array and ``<elements>`` is a comma
|
||||
seperated list of the elements of the array.
|
||||
separated list of the elements of the array.
|
||||
|
||||
**Note:** ``__repr__`` cannot be called directly (``a.__repr__()`` fails) and
|
||||
is not present in ``__dict__``, however ``str(a)`` and ``repr(a)`` both work.
|
||||
|
@ -44,7 +44,7 @@ Configuration
|
||||
|
||||
Get or set configuration values of the BLE interface. To get a value the
|
||||
parameter name should be quoted as a string, and just one parameter is
|
||||
queried at a time. To set values use the keyword syntax, and one ore more
|
||||
queried at a time. To set values use the keyword syntax, and one or more
|
||||
parameter can be set at a time.
|
||||
|
||||
Currently supported values are:
|
||||
|
@ -126,7 +126,7 @@ methods to enable over-the-air (OTA) updates.
|
||||
and an ``OSError(-261)`` is raised if called on firmware that doesn't have the
|
||||
feature enabled.
|
||||
It is OK to call ``mark_app_valid_cancel_rollback`` on every boot and it is not
|
||||
necessary when booting firmare that was loaded using esptool.
|
||||
necessary when booting firmware that was loaded using esptool.
|
||||
|
||||
Constants
|
||||
~~~~~~~~~
|
||||
|
@ -4,7 +4,7 @@
|
||||
class ADC -- analog to digital conversion
|
||||
=========================================
|
||||
|
||||
The ADC class provides an interface to analog-to-digital convertors, and
|
||||
The ADC class provides an interface to analog-to-digital converters, and
|
||||
represents a single endpoint that can sample a continuous voltage and
|
||||
convert it to a discretised value.
|
||||
|
||||
|
@ -94,7 +94,7 @@ General Methods
|
||||
- *freq* is the SCL clock rate
|
||||
|
||||
In the case of hardware I2C the actual clock frequency may be lower than the
|
||||
requested frequency. This is dependant on the platform hardware. The actual
|
||||
requested frequency. This is dependent on the platform hardware. The actual
|
||||
rate may be determined by printing the I2C object.
|
||||
|
||||
.. method:: I2C.deinit()
|
||||
|
@ -103,7 +103,7 @@ Constructor
|
||||
- ``ibuf`` specifies internal buffer length (bytes)
|
||||
|
||||
For all ports, DMA runs continuously in the background and allows user applications to perform other operations while
|
||||
sample data is transfered between the internal buffer and the I2S peripheral unit.
|
||||
sample data is transferred between the internal buffer and the I2S peripheral unit.
|
||||
Increasing the size of the internal buffer has the potential to increase the time that user applications can perform non-I2S operations
|
||||
before underflow (e.g. ``write`` method) or overflow (e.g. ``readinto`` method).
|
||||
|
||||
|
@ -98,7 +98,7 @@ Methods
|
||||
specify them as a tuple of ``pins`` parameter.
|
||||
|
||||
In the case of hardware SPI the actual clock frequency may be lower than the
|
||||
requested baudrate. This is dependant on the platform hardware. The actual
|
||||
requested baudrate. This is dependent on the platform hardware. The actual
|
||||
rate may be determined by printing the SPI object.
|
||||
|
||||
.. method:: SPI.deinit()
|
||||
|
@ -73,7 +73,7 @@ Methods
|
||||
- ``callback`` - The callable to call upon expiration of the timer period.
|
||||
The callback must take one argument, which is passed the Timer object.
|
||||
The ``callback`` argument shall be specified. Otherwise an exception
|
||||
will occurr upon timer expiration:
|
||||
will occur upon timer expiration:
|
||||
``TypeError: 'NoneType' object isn't callable``
|
||||
|
||||
.. method:: Timer.deinit()
|
||||
|
@ -86,7 +86,7 @@ Filesystem access
|
||||
|
||||
.. function:: statvfs(path)
|
||||
|
||||
Get the status of a fileystem.
|
||||
Get the status of a filesystem.
|
||||
|
||||
Returns a tuple with the filesystem information in the following order:
|
||||
|
||||
|
@ -272,7 +272,7 @@ Methods
|
||||
- *fdf* for CAN FD controllers, if set to True, the frame will have an FD
|
||||
frame format, which supports data payloads up to 64 bytes.
|
||||
- *brs* for CAN FD controllers, if set to True, the bitrate switching mode
|
||||
is enabled, in which the data phase is transmitted at a differet bitrate.
|
||||
is enabled, in which the data phase is transmitted at a different bitrate.
|
||||
See :meth:`CAN.init` for the data bit timing configuration parameters.
|
||||
|
||||
If timeout is 0 the message is placed in a buffer in one of three hardware
|
||||
|
@ -97,7 +97,7 @@ Methods
|
||||
errors properly)
|
||||
|
||||
The actual clock frequency may be lower than the requested frequency.
|
||||
This is dependant on the platform hardware. The actual rate may be determined
|
||||
This is dependent on the platform hardware. The actual rate may be determined
|
||||
by printing the I2C object.
|
||||
|
||||
.. method:: I2C.is_ready(addr)
|
||||
|
@ -46,7 +46,7 @@ Functions
|
||||
.. function:: settrace(tracefunc)
|
||||
|
||||
Enable tracing of bytecode execution. For details see the `CPython
|
||||
documentaion <https://docs.python.org/3/library/sys.html#sys.settrace>`_.
|
||||
documentation <https://docs.python.org/3/library/sys.html#sys.settrace>`_.
|
||||
|
||||
This function requires a custom MicroPython build as it is typically not
|
||||
present in pre-built firmware (due to it affecting performance). The relevant
|
||||
|
@ -163,7 +163,7 @@ Functions
|
||||
However, values returned by `ticks_ms()`, etc. functions may wrap around, so
|
||||
directly using subtraction on them will produce incorrect result. That is why
|
||||
`ticks_diff()` is needed, it implements modular (or more specifically, ring)
|
||||
arithmetics to produce correct result even for wrap-around values (as long as they not
|
||||
arithmetic to produce correct result even for wrap-around values (as long as they not
|
||||
too distant in between, see below). The function returns **signed** value in the range
|
||||
[*-TICKS_PERIOD/2* .. *TICKS_PERIOD/2-1*] (that's a typical range definition for
|
||||
two's-complement signed binary integers). If the result is negative, it means that
|
||||
|
@ -32,7 +32,7 @@ Functions
|
||||
* *CPU utilization is only printed if runtime statistics are configured via the ``CONFIG_THREAD_RUNTIME_STATS`` kconfig*
|
||||
|
||||
This function can only be accessed if ``CONFIG_THREAD_ANALYZER`` is configured for the port in ``zephyr/prj.conf``.
|
||||
For more infomation, see documentation for Zephyr `thread analyzer
|
||||
For more information, see documentation for Zephyr `thread analyzer
|
||||
<https://docs.zephyrproject.org/latest/guides/debug_tools/thread-analyzer.html#thread-analyzer>`_.
|
||||
|
||||
.. function:: shell_exec(cmd_in)
|
||||
|
@ -75,7 +75,7 @@ Execute the next instruction if <condition> is true:
|
||||
|
||||
* ite(<condition>) If then else
|
||||
|
||||
If <condtion> is true, execute the next instruction, otherwise execute the
|
||||
If <condition> is true, execute the next instruction, otherwise execute the
|
||||
subsequent one. Thus:
|
||||
|
||||
::
|
||||
|
@ -264,7 +264,7 @@ were a string.
|
||||
|
||||
**Runtime compiler execution**
|
||||
|
||||
The Python funcitons `eval` and `exec` invoke the compiler at runtime, which
|
||||
The Python functions `eval` and `exec` invoke the compiler at runtime, which
|
||||
requires significant amounts of RAM. Note that the ``pickle`` library from
|
||||
`micropython-lib` employs `exec`. It may be more RAM efficient to use the
|
||||
`json` library for object serialisation.
|
||||
@ -403,7 +403,7 @@ Control of garbage collection
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
A GC can be demanded at any time by issuing `gc.collect()`. It is advantageous
|
||||
to do this at intervals, firstly to pre-empt fragmentation and secondly for
|
||||
to do this at intervals, firstly to preempt fragmentation and secondly for
|
||||
performance. A GC can take several milliseconds but is quicker when there is
|
||||
little work to do (about 1ms on the Pyboard). An explicit call can minimise that
|
||||
delay while ensuring it occurs at points in the program when it is acceptable.
|
||||
|
@ -30,7 +30,7 @@ The peripherals include:
|
||||
|
||||
* 2 UARTs
|
||||
* 2 SPI controllers
|
||||
* 2 I2C contollers
|
||||
* 2 I2C controllers
|
||||
* 16 PWM channels
|
||||
* USB 1.1 controller
|
||||
* 8 PIO state machines
|
||||
|
@ -96,7 +96,7 @@ Programmable IO (PIO)
|
||||
---------------------
|
||||
|
||||
PIO is useful to build low-level IO interfaces from scratch. See the :mod:`rp2` module
|
||||
for detailed explaination of the assembly instructions.
|
||||
for detailed explanation of the assembly instructions.
|
||||
|
||||
Example using PIO to blink an LED at 1Hz::
|
||||
|
||||
|
@ -10,7 +10,7 @@ REPL over the serial port
|
||||
|
||||
The REPL is available on a UART serial peripheral specified for the board by
|
||||
the ``zephyr,console`` devicetree node. The baudrate of the REPL is 115200.
|
||||
If your board has a USB-serial convertor on it then you should be able to access
|
||||
If your board has a USB-serial converter on it then you should be able to access
|
||||
the REPL directly from your PC.
|
||||
|
||||
To access the prompt over USB-serial you will need to use a terminal emulator
|
||||
|
@ -67,7 +67,7 @@ STATIC int cywbt_hci_cmd_raw(size_t len, uint8_t *buf) {
|
||||
buf[i] = uart_rx_char(&mp_bluetooth_hci_uart_obj);
|
||||
}
|
||||
|
||||
// expect a comand complete event (event 0x0e)
|
||||
// expect a command complete event (event 0x0e)
|
||||
if (buf[0] != 0x04 || buf[1] != 0x0e) {
|
||||
printf("unknown response: %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]);
|
||||
return -1;
|
||||
|
@ -105,7 +105,7 @@ typedef enum {
|
||||
NINA_CMD_AP_GET_BSSID = 0x3C,
|
||||
NINA_CMD_AP_GET_CHANNEL = 0x3D,
|
||||
|
||||
// Disonnect/status commands.
|
||||
// Disconnect/status commands.
|
||||
NINA_CMD_DISCONNECT = 0x30,
|
||||
NINA_CMD_CONN_STATUS = 0x20,
|
||||
NINA_CMD_CONN_REASON = 0x1F,
|
||||
|
@ -23,7 +23,7 @@ To build the example project, based on `main.c`, use:
|
||||
|
||||
$ make
|
||||
|
||||
That will create an exacutable called `embed` which you can run:
|
||||
That will create an executable called `embed` which you can run:
|
||||
|
||||
$ ./embed
|
||||
|
||||
|
@ -5,7 +5,7 @@ which would work from a board to board, from a system to another systems.
|
||||
This is inherently a hard problem, because hardware is different from one
|
||||
board type to another, and even from examplar of board to another. For
|
||||
example, if your app requires an external LED, one user may connect it
|
||||
to one GPIO pin, while another user may find it much more convinient to
|
||||
to one GPIO pin, while another user may find it much more convenient to
|
||||
use another pin. This of course applies to relays, buzzers, sensors, etc.
|
||||
|
||||
With complications above in mind, it's still possible to write portable
|
||||
|
@ -1,6 +1,6 @@
|
||||
from machine import Pin, Signal
|
||||
|
||||
# Red LED on pin LED_RED also kown as A13
|
||||
# Red LED on pin LED_RED also known as A13
|
||||
LED = Signal("LED_RED", Pin.OUT)
|
||||
|
||||
# Green LED on pin LED_GREEN also known as A14
|
||||
|
@ -88,7 +88,7 @@ mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *a
|
||||
// This must be first, it sets up the globals dict and other things
|
||||
MP_DYNRUNTIME_INIT_ENTRY
|
||||
|
||||
// Messages can be printed as usualy
|
||||
// Messages can be printed as usual
|
||||
mp_printf(&mp_plat_print, "initialising module self=%p\n", self);
|
||||
|
||||
// Make the functions available in the module's namespace
|
||||
|
@ -883,7 +883,7 @@ int mp_bluetooth_gatts_register_service_begin(bool append) {
|
||||
|
||||
if (!append) {
|
||||
// This will reset the DB.
|
||||
// Becase the DB is statically allocated, there's no problem with just re-initing it.
|
||||
// Because the DB is statically allocated, there's no problem with just re-initing it.
|
||||
// Note this would be a memory leak if we enabled HAVE_MALLOC (there's no API to free the existing db).
|
||||
att_db_util_init();
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "py/misc.h" // For MP_STRINGIFY.
|
||||
#include "py/mpconfig.h"
|
||||
|
||||
// Preprocessor directives indentifying the platform.
|
||||
// Preprocessor directives identifying the platform.
|
||||
// The (u)platform module itself is guarded by MICROPY_PY_UPLATFORM, see the
|
||||
// .c file, but these are made available because they're generally usable.
|
||||
// TODO: Add more architectures, compilers and libraries.
|
||||
|
@ -208,7 +208,7 @@ STATIC mp_uint_t ussl_socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int
|
||||
// default is to perform complete handshake in constructor, so
|
||||
// this should not happen in blocking mode. On the other hand,
|
||||
// in nonblocking mode EAGAIN (comparing to the alternative of
|
||||
// looping) is really preferrable.
|
||||
// looping) is really preferable.
|
||||
if (o->blocking) {
|
||||
continue;
|
||||
} else {
|
||||
|
@ -333,7 +333,7 @@ STATIC mp_uint_t socket_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *errc
|
||||
} else if (ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
|
||||
// If handshake is not finished, read attempt may end up in protocol
|
||||
// wanting to write next handshake message. The same may happen with
|
||||
// renegotation.
|
||||
// renegotiation.
|
||||
ret = MP_EWOULDBLOCK;
|
||||
o->poll_mask = MP_STREAM_POLL_WR;
|
||||
} else {
|
||||
@ -361,7 +361,7 @@ STATIC mp_uint_t socket_write(mp_obj_t o_in, const void *buf, mp_uint_t size, in
|
||||
} else if (ret == MBEDTLS_ERR_SSL_WANT_READ) {
|
||||
// If handshake is not finished, write attempt may end up in protocol
|
||||
// wanting to read next handshake message. The same may happen with
|
||||
// renegotation.
|
||||
// renegotiation.
|
||||
ret = MP_EWOULDBLOCK;
|
||||
o->poll_mask = MP_STREAM_POLL_RD;
|
||||
} else {
|
||||
|
@ -84,7 +84,7 @@ void hal_uart_start_tx(uint32_t port) {
|
||||
mp_bluetooth_hci_uart_write(mp_bluetooth_hci_cmd_buf, len);
|
||||
|
||||
if (len > 0) {
|
||||
// Allow modbluetooth bindings to hook "sent packet" (e.g. to unstall l2cap channels).
|
||||
// Allow modbluetooth bindings to hook "sent packet" (e.g. to un-stall l2cap channels).
|
||||
mp_bluetooth_nimble_sent_hci_packet();
|
||||
}
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ int mp_bluetooth_init(void) {
|
||||
// By default, just register the default gap/gatt service.
|
||||
ble_svc_gap_init();
|
||||
ble_svc_gatt_init();
|
||||
// The preceeding two calls allocate service definitions on the heap,
|
||||
// The preceding two calls allocate service definitions on the heap,
|
||||
// then we must now call gatts_start to register those services
|
||||
// and free the heap memory.
|
||||
// Otherwise it will be realloc'ed on the next stack startup.
|
||||
@ -1537,7 +1537,7 @@ STATIC void destroy_l2cap_channel() {
|
||||
|
||||
STATIC void unstall_l2cap_channel(void) {
|
||||
// Whenever we send an HCI packet and the sys mempool is now less than 1/4 full,
|
||||
// we can unstall the L2CAP channel if it was marked as "mem_stalled" by
|
||||
// we can un-stall the L2CAP channel if it was marked as "mem_stalled" by
|
||||
// mp_bluetooth_l2cap_send. (This happens if the pool is half-empty).
|
||||
mp_bluetooth_nimble_l2cap_channel_t *chan = MP_STATE_PORT(bluetooth_nimble_root_pointers)->l2cap_chan;
|
||||
if (!chan || !chan->mem_stalled) {
|
||||
@ -1644,7 +1644,7 @@ STATIC int l2cap_channel_event(struct ble_l2cap_event *event, void *arg) {
|
||||
case BLE_L2CAP_EVENT_COC_TX_UNSTALLED: {
|
||||
DEBUG_printf("l2cap_channel_event: tx_unstalled: conn_handle=%d status=%d\n", event->tx_unstalled.conn_handle, event->tx_unstalled.status);
|
||||
assert(event->tx_unstalled.conn_handle == chan->chan->conn_handle);
|
||||
// Don't unstall if we're still waiting for room in the sys pool.
|
||||
// Don't un-stall if we're still waiting for room in the sys pool.
|
||||
if (!chan->mem_stalled) {
|
||||
ble_l2cap_get_chan_info(event->receive.chan, &info);
|
||||
// Map status to {0,1} (i.e. "sent everything", or "partial send").
|
||||
@ -1802,7 +1802,7 @@ int mp_bluetooth_l2cap_send(uint16_t conn_handle, uint16_t cid, const uint8_t *b
|
||||
err = ble_l2cap_send(chan->chan, sdu_tx);
|
||||
if (err == BLE_HS_ESTALLED) {
|
||||
// Stalled means that this one will still send but any future ones
|
||||
// will fail until we receive an unstalled event.
|
||||
// will fail until we receive an un-stalled event.
|
||||
DEBUG_printf("mp_bluetooth_l2cap_send: credit stall\n");
|
||||
*stalled = true;
|
||||
err = 0;
|
||||
|
@ -256,7 +256,7 @@ static bool wait_while_blinking (uint32_t wait_time, uint32_t period, bool force
|
||||
_u32 count;
|
||||
for (count = 0; (force_wait || MAP_GPIOPinRead(MICROPY_SAFE_BOOT_PORT, MICROPY_SAFE_BOOT_PORT_PIN)) &&
|
||||
((period * count) < wait_time); count++) {
|
||||
// toogle the led
|
||||
// toggle the led
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, ~MAP_GPIOPinRead(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN));
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(period * 1000));
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ DSTATUS sd_disk_init (void) {
|
||||
// Fill in the RCA
|
||||
sd_disk_info.usRCA = (ulResp[0] >> 16);
|
||||
|
||||
// Get tha card capacity
|
||||
// Get the card capacity
|
||||
CardCapacityGet(&sd_disk_info);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ typedef enum {
|
||||
typedef struct {
|
||||
bool uservalid : 1;
|
||||
bool passvalid : 1;
|
||||
} ftp_loggin_t;
|
||||
} ftp_login_t;
|
||||
|
||||
typedef enum {
|
||||
E_FTP_NOTHING_OPEN = 0,
|
||||
@ -127,8 +127,8 @@ typedef struct {
|
||||
uint8_t state;
|
||||
uint8_t substate;
|
||||
uint8_t txRetries;
|
||||
uint8_t logginRetries;
|
||||
ftp_loggin_t loggin;
|
||||
uint8_t loginRetries;
|
||||
ftp_login_t login;
|
||||
uint8_t e_open;
|
||||
bool closechild;
|
||||
bool enabled;
|
||||
@ -329,10 +329,10 @@ void ftp_run (void) {
|
||||
if (ftp_data.c_sd < 0 && ftp_data.substate == E_FTP_STE_SUB_DISCONNECTED) {
|
||||
if (E_FTP_RESULT_OK == ftp_wait_for_connection(ftp_data.lc_sd, &ftp_data.c_sd)) {
|
||||
ftp_data.txRetries = 0;
|
||||
ftp_data.logginRetries = 0;
|
||||
ftp_data.loginRetries = 0;
|
||||
ftp_data.ctimeout = 0;
|
||||
ftp_data.loggin.uservalid = false;
|
||||
ftp_data.loggin.passvalid = false;
|
||||
ftp_data.login.uservalid = false;
|
||||
ftp_data.login.passvalid = false;
|
||||
strcpy (ftp_path, "/");
|
||||
ftp_send_reply (220, "MicroPython FTP Server");
|
||||
break;
|
||||
@ -684,7 +684,7 @@ static void ftp_process_cmd (void) {
|
||||
if (E_FTP_RESULT_OK == (result = ftp_recv_non_blocking(ftp_data.c_sd, ftp_cmd_buffer, FTP_MAX_PARAM_SIZE + FTP_CMD_SIZE_MAX, &len))) {
|
||||
// bufptr is moved as commands are being popped
|
||||
ftp_cmd_index_t cmd = ftp_pop_command(&bufptr);
|
||||
if (!ftp_data.loggin.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT && cmd != E_FTP_CMD_FEAT)) {
|
||||
if (!ftp_data.login.passvalid && (cmd != E_FTP_CMD_USER && cmd != E_FTP_CMD_PASS && cmd != E_FTP_CMD_QUIT && cmd != E_FTP_CMD_FEAT)) {
|
||||
ftp_send_reply(332, NULL);
|
||||
return;
|
||||
}
|
||||
@ -754,16 +754,16 @@ static void ftp_process_cmd (void) {
|
||||
case E_FTP_CMD_USER:
|
||||
ftp_pop_param (&bufptr, ftp_scratch_buffer);
|
||||
if (!memcmp(ftp_scratch_buffer, servers_user, MAX(strlen(ftp_scratch_buffer), strlen(servers_user)))) {
|
||||
ftp_data.loggin.uservalid = true && (strlen(servers_user) == strlen(ftp_scratch_buffer));
|
||||
ftp_data.login.uservalid = true && (strlen(servers_user) == strlen(ftp_scratch_buffer));
|
||||
}
|
||||
ftp_send_reply(331, NULL);
|
||||
break;
|
||||
case E_FTP_CMD_PASS:
|
||||
ftp_pop_param (&bufptr, ftp_scratch_buffer);
|
||||
if (!memcmp(ftp_scratch_buffer, servers_pass, MAX(strlen(ftp_scratch_buffer), strlen(servers_pass))) &&
|
||||
ftp_data.loggin.uservalid) {
|
||||
ftp_data.loggin.passvalid = true && (strlen(servers_pass) == strlen(ftp_scratch_buffer));
|
||||
if (ftp_data.loggin.passvalid) {
|
||||
ftp_data.login.uservalid) {
|
||||
ftp_data.login.passvalid = true && (strlen(servers_pass) == strlen(ftp_scratch_buffer));
|
||||
if (ftp_data.login.passvalid) {
|
||||
ftp_send_reply(230, NULL);
|
||||
break;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void mperror_deinit_sfe_pin (void) {
|
||||
void mperror_signal_error (void) {
|
||||
uint32_t count = 0;
|
||||
while ((MPERROR_TOOGLE_MS * count++) < MPERROR_SIGNAL_ERROR_MS) {
|
||||
// toogle the led
|
||||
// toggle the led
|
||||
MAP_GPIOPinWrite(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN, ~MAP_GPIOPinRead(MICROPY_SYS_LED_PORT, MICROPY_SYS_LED_PORT_PIN));
|
||||
UtilsDelay(UTILS_DELAY_US_TO_COUNT(MPERROR_TOOGLE_MS * 1000));
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void wlan_sl_init (int8_t mode, const char *ssid, uint8_t ssid_len, uint8_t auth
|
||||
// switch to the requested mode
|
||||
wlan_set_mode(mode);
|
||||
|
||||
// stop and start again (we need to in the propper mode from now on)
|
||||
// stop and start again (we need to be in the proper mode from now on)
|
||||
wlan_reenable(mode);
|
||||
|
||||
// Set Tx power level for station or AP mode
|
||||
@ -608,7 +608,7 @@ STATIC void wlan_set_ssid (const char *ssid, uint8_t len, bool add_mac) {
|
||||
// save the ssid
|
||||
memcpy(&wlan_obj.ssid, ssid, len);
|
||||
// append the last 2 bytes of the MAC address, since the use of this functionality is under our control
|
||||
// we can assume that the lenght of the ssid is less than (32 - 5)
|
||||
// we can assume that the length of the ssid is less than (32 - 5)
|
||||
if (add_mac) {
|
||||
snprintf((char *)&wlan_obj.ssid[len], sizeof(wlan_obj.ssid) - len, "-%02x%02x", wlan_obj.mac[4], wlan_obj.mac[5]);
|
||||
len += 5;
|
||||
|
@ -113,7 +113,7 @@ STATIC pybpin_wake_pin_t pybpin_wake_pin[PYBPIN_NUM_WAKE_PINS] =
|
||||
DEFINE PUBLIC FUNCTIONS
|
||||
******************************************************************************/
|
||||
void pin_init0(void) {
|
||||
// this initalization also reconfigures the JTAG/SWD pins
|
||||
// this initialization also reconfigures the JTAG/SWD pins
|
||||
#ifndef DEBUG
|
||||
// assign all pins to the GPIO module so that peripherals can be connected to any
|
||||
// pins without conflicts after a soft reset
|
||||
@ -560,7 +560,7 @@ STATIC mp_obj_t pin_obj_init_helper(pin_obj_t *self, size_t n_args, const mp_obj
|
||||
}
|
||||
}
|
||||
|
||||
// get the strenght
|
||||
// get the strength
|
||||
uint strength = args[3].u_int;
|
||||
pin_validate_drive(strength);
|
||||
|
||||
|
@ -76,7 +76,7 @@ STATIC void rtc_msec_add(uint16_t msecs_1, uint32_t *secs, uint16_t *msecs_2);
|
||||
******************************************************************************/
|
||||
__attribute__ ((section (".boot")))
|
||||
void pyb_rtc_pre_init(void) {
|
||||
// only if comming out of a power-on reset
|
||||
// only if coming out of a power-on reset
|
||||
if (MAP_PRCMSysResetCauseGet() == PRCM_POWER_ON) {
|
||||
// Mark the RTC in use first
|
||||
MAP_PRCMRTCInUseSet();
|
||||
@ -118,7 +118,7 @@ void pyb_rtc_repeat_alarm (pyb_rtc_obj_t *self) {
|
||||
|
||||
pyb_rtc_get_time(&c_seconds, &c_mseconds);
|
||||
|
||||
// substract the time elapsed between waking up and setting up the alarm again
|
||||
// subtract the time elapsed between waking up and setting up the alarm again
|
||||
int32_t wake_ms = ((c_seconds * 1000) + c_mseconds) - ((self->alarm_time_s * 1000) + self->alarm_time_ms);
|
||||
int32_t next_alarm = self->alarm_ms - wake_ms;
|
||||
next_alarm = next_alarm > 0 ? next_alarm : PYB_RTC_MIN_ALARM_TIME_MS;
|
||||
|
@ -71,7 +71,7 @@ STATIC mp_obj_t pyb_sd_deinit (mp_obj_t self_in);
|
||||
/******************************************************************************
|
||||
DEFINE PRIVATE FUNCTIONS
|
||||
******************************************************************************/
|
||||
/// Initalizes the sd card hardware driver
|
||||
/// Initializes the sd card hardware driver
|
||||
STATIC void pyb_sd_hw_init (pybsd_obj_t *self) {
|
||||
if (self->pin_clk) {
|
||||
// Configure the clock pin as output only
|
||||
|
@ -160,13 +160,13 @@ void pyb_sleep_init0 (void) {
|
||||
// register and enable the PRCM interrupt
|
||||
osi_InterruptRegister(INT_PRCM, (P_OSI_INTR_ENTRY)PRCMInterruptHandler, INT_PRIORITY_LVL_1);
|
||||
|
||||
// disable all LPDS and hibernate wake up sources (WLAN is disabed/enabled before entering LDPS mode)
|
||||
// disable all LPDS and hibernate wake up sources (WLAN is disabled/enabled before entering LDPS mode)
|
||||
MAP_PRCMLPDSWakeupSourceDisable(PRCM_LPDS_GPIO);
|
||||
MAP_PRCMLPDSWakeupSourceDisable(PRCM_LPDS_TIMER);
|
||||
MAP_PRCMHibernateWakeupSourceDisable(PRCM_HIB_SLOW_CLK_CTR | PRCM_HIB_GPIO2 | PRCM_HIB_GPIO4 | PRCM_HIB_GPIO13 |
|
||||
PRCM_HIB_GPIO17 | PRCM_HIB_GPIO11 | PRCM_HIB_GPIO24 | PRCM_HIB_GPIO26);
|
||||
|
||||
// check the reset casue (if it's soft reset, leave it as it is)
|
||||
// check the reset cause (if it's soft reset, leave it as it is)
|
||||
if (pybsleep_reset_cause != PYB_SLP_SOFT_RESET) {
|
||||
switch (MAP_PRCMSysResetCauseGet()) {
|
||||
case PRCM_POWER_ON:
|
||||
|
@ -158,7 +158,7 @@ soft_reset:
|
||||
// to enable simplelink and leave it as is
|
||||
wlan_first_start();
|
||||
} else {
|
||||
// only if not comming out of hibernate or a soft reset
|
||||
// only if not coming out of hibernate or a soft reset
|
||||
mptask_enter_ap_mode();
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ STATIC void mptask_init_sflash_filesystem(void) {
|
||||
// create empty main.py
|
||||
mptask_create_main_py();
|
||||
} else if (res == FR_OK) {
|
||||
// mount sucessful
|
||||
// mount successful
|
||||
if (FR_OK != f_stat(&vfs_fat->fatfs, "/main.py", &fno)) {
|
||||
// create empty main.py
|
||||
mptask_create_main_py();
|
||||
|
@ -111,7 +111,7 @@ void TASK_Servers(void *pvParameters) {
|
||||
ftp_reset();
|
||||
}
|
||||
// and we should also close all user sockets. We do it here
|
||||
// for convinience and to save on code size.
|
||||
// for convenience and to save on code size.
|
||||
modusocket_close_all_user_sockets();
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ static void telnet_process (void) {
|
||||
_i16 rxLen;
|
||||
_i16 maxLen = (telnet_data.rxWindex >= telnet_data.rxRindex) ? (TELNET_RX_BUFFER_SIZE - telnet_data.rxWindex) :
|
||||
((telnet_data.rxRindex - telnet_data.rxWindex) - 1);
|
||||
// to avoid an overrrun
|
||||
// to avoid an overrun
|
||||
maxLen = (telnet_data.rxRindex == 0) ? (maxLen - 1) : maxLen;
|
||||
|
||||
if (maxLen > 0) {
|
||||
|
@ -59,7 +59,7 @@ void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
|
||||
HWREG(SHAMD5_BASE + SHAMD5_O_MODE) |= SHAMD5_MODE_CLOSE_HASH;
|
||||
}
|
||||
|
||||
// set the lenght
|
||||
// set the length
|
||||
HWREG(SHAMD5_BASE + SHAMD5_O_LENGTH) = blocklen;
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) {
|
||||
/*
|
||||
// Bug: Sometimes duty is not set right now.
|
||||
// Not a bug. It's a feature. The duty is applied at the beginning of the next signal period.
|
||||
// Bug: It has been experimentally established that the duty is setted during 2 signal periods, but 1 period is expected.
|
||||
// Bug: It has been experimentally established that the duty is set during 2 signal periods, but 1 period is expected.
|
||||
// See https://github.com/espressif/esp-idf/issues/7288
|
||||
if (duty != get_duty_u16(self)) {
|
||||
PWM_DBG("set_duty_u16(%u), get_duty_u16():%u, channel_duty:%d, duty_resolution:%d, freq_hz:%d", duty, get_duty_u16(self), channel_duty, timer.duty_resolution, timer.freq_hz);
|
||||
@ -510,7 +510,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self,
|
||||
}
|
||||
}
|
||||
if ((freq <= 0) || (freq > 40000000)) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("freqency must be from 1Hz to 40MHz"));
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("frequency must be from 1Hz to 40MHz"));
|
||||
}
|
||||
|
||||
int timer_idx;
|
||||
@ -607,7 +607,7 @@ STATIC void mp_machine_pwm_deinit(machine_pwm_obj_t *self) {
|
||||
self->duty_x = 0;
|
||||
}
|
||||
|
||||
// Set's and get's methods of PWM class
|
||||
// Set and get methods of PWM class
|
||||
|
||||
STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
|
||||
pwm_is_active(self);
|
||||
@ -617,7 +617,7 @@ STATIC mp_obj_t mp_machine_pwm_freq_get(machine_pwm_obj_t *self) {
|
||||
STATIC void mp_machine_pwm_freq_set(machine_pwm_obj_t *self, mp_int_t freq) {
|
||||
pwm_is_active(self);
|
||||
if ((freq <= 0) || (freq > 40000000)) {
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("freqency must be from 1Hz to 40MHz"));
|
||||
mp_raise_ValueError(MP_ERROR_TEXT("frequency must be from 1Hz to 40MHz"));
|
||||
}
|
||||
if (freq == timers[TIMER_IDX(self->mode, self->timer)].freq_hz) {
|
||||
return;
|
||||
|
@ -165,7 +165,7 @@ pwm_start(void) {
|
||||
}
|
||||
}
|
||||
PWM_DBG("2channel:%d,single[0]:%d,[1]:%d,[2]:%d,[3]:%d\n", *local_channel, local_single[0].h_time, local_single[1].h_time, local_single[2].h_time, local_single[3].h_time);
|
||||
// step 4: cacl delt time
|
||||
// step 4: calc delta time
|
||||
for (i = *local_channel - 1; i > 0; i--) {
|
||||
local_single[i].h_time -= local_single[i - 1].h_time;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@
|
||||
#define SPI_MOSI_DELAY_NUM 0x00000007
|
||||
#define SPI_MOSI_DELAY_NUM_S 23
|
||||
#define SPI_MOSI_DELAY_MODE 0x00000003 //mode 0 : posedge; data set at positive edge of clk
|
||||
//mode 1 : negedge + 1 cycle delay, only if freq<10MHz ; data set at negitive edge of clk
|
||||
//mode 1 : negedge + 1 cycle delay, only if freq<10MHz ; data set at negative edge of clk
|
||||
//mode 2 : Do not use this mode.
|
||||
#define SPI_MOSI_DELAY_MODE_S 21
|
||||
#define SPI_MISO_DELAY_NUM 0x00000007
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* FileName: uart.c
|
||||
*
|
||||
* Description: Two UART mode configration and interrupt handler.
|
||||
* Description: Two UART mode configuration and interrupt handler.
|
||||
* Check your hardware connection while use this mode.
|
||||
*
|
||||
* Modification history:
|
||||
@ -164,7 +164,7 @@ uart_os_config(int uart) {
|
||||
*******************************************************************************/
|
||||
|
||||
static void uart0_rx_intr_handler(void *para) {
|
||||
/* uart0 and uart1 intr combine togther, when interrupt occur, see reg 0x3ff20020, bit2, bit0 represents
|
||||
/* uart0 and uart1 intr combine together, when interrupt occur, see reg 0x3ff20020, bit2, bit0 represents
|
||||
* uart1 and uart0 respectively
|
||||
*/
|
||||
|
||||
|
@ -172,7 +172,7 @@ void BOARD_BootClockRUN(void) {
|
||||
(ANADIG_OSC->OSC_24M_CTRL & ANADIG_OSC_OSC_24M_CTRL_OSC_24M_STABLE_MASK)) {
|
||||
}
|
||||
|
||||
/* Swicth both core, M7 Systick and Bus_Lpsr to OscRC48MDiv2 first */
|
||||
/* Switch both core, M7 Systick and Bus_Lpsr to OscRC48MDiv2 first */
|
||||
rootCfg.mux = kCLOCK_M7_ClockRoot_MuxOscRc48MDiv2;
|
||||
rootCfg.div = 1;
|
||||
#if __CORTEX_M == 7
|
||||
|
@ -11,7 +11,7 @@ or for Teensy 4.1:
|
||||
teensy_loader_cli --mcu=imxrt1062 -v -w TEENSY41-<date_version_tag>.hex
|
||||
```
|
||||
|
||||
Instead of imxrt1062 with the --mcu option, you can as well use the board specic names
|
||||
Instead of imxrt1062 with the --mcu option, you can as well use the board specific names
|
||||
TEENSY40, TEENSY41 or TEENSY_MICROMOD. When loading the firmware the PJRC boot loader
|
||||
will erase the board file system.
|
||||
|
||||
|
@ -123,7 +123,7 @@ enum
|
||||
kFlexSpiDeviceType_SerialNAND = 2, // !< Flash devices are Serial NAND
|
||||
kFlexSpiDeviceType_SerialRAM = 3, // !< Flash devices are Serial RAM/HyperFLASH
|
||||
kFlexSpiDeviceType_MCP_NOR_NAND = 0x12, // !< Flash device is MCP device, A1 is Serial NOR, A2 is Serial NAND
|
||||
kFlexSpiDeviceType_MCP_NOR_RAM = 0x13, // !< Flash deivce is MCP device, A1 is Serial NOR, A2 is Serial RAMs
|
||||
kFlexSpiDeviceType_MCP_NOR_RAM = 0x13, // !< Flash device is MCP device, A1 is Serial NOR, A2 is Serial RAMs
|
||||
};
|
||||
|
||||
// !@brief Flash Pad Definitions
|
||||
@ -184,7 +184,7 @@ typedef struct _FlexSPIConfig
|
||||
// ! details
|
||||
uint8_t deviceType; // !< [0x044-0x044] Device Type: See Flash Type Definition for more details
|
||||
uint8_t sflashPadType; // !< [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal
|
||||
uint8_t serialClkFreq; // !< [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot
|
||||
uint8_t serialClkFreq; // !< [0x046-0x046] Serial Flash Frequency, device specific definitions, See System Boot
|
||||
// ! Chapter for more details
|
||||
uint8_t lutCustomSeqEnable; // !< [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot
|
||||
// ! be done using 1 LUT sequence, currently, only applicable to HyperFLASH
|
||||
@ -245,7 +245,7 @@ typedef struct _flexspi_nor_config
|
||||
uint8_t serialNorType; // !< Serial NOR Flash type: 0/1/2/3
|
||||
uint8_t needExitNoCmdMode; // !< Need to exit NoCmd mode before other IP command
|
||||
uint8_t halfClkForNonReadCmd; // !< Half the Serial Clock for non-read command: true/false
|
||||
uint8_t needRestoreNoCmdMode; // !< Need to Restore NoCmd mode after IP commmand execution
|
||||
uint8_t needRestoreNoCmdMode; // !< Need to Restore NoCmd mode after IP command execution
|
||||
uint32_t blockSize; // !< Block size
|
||||
uint32_t reserve2[11]; // !< Reserved for future use
|
||||
} flexspi_nor_config_t;
|
||||
|
@ -97,7 +97,7 @@ typedef struct _boot_data_ {
|
||||
uint32_t start; /* boot start location */
|
||||
uint32_t size; /* size */
|
||||
uint32_t plugin; /* plugin flag - 1 if downloaded application is plugin */
|
||||
uint32_t placeholder; /* placehoder to make even 0x10 size */
|
||||
uint32_t placeholder; /* placeholder to make even 0x10 size */
|
||||
}BOOT_DATA_T;
|
||||
|
||||
#if defined(BOARD_FLASH_SIZE)
|
||||
|
@ -117,7 +117,7 @@ status_t PHY_DP83825_GetLinkStatus(phy_handle_t *handle, bool *status);
|
||||
* @brief Gets the PHY link speed and duplex.
|
||||
*
|
||||
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
||||
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
||||
* and duplex address parameter and set the other as NULL if only wants to get one of them.
|
||||
*
|
||||
* @param handle PHY device handle.
|
||||
* @param speed The address of PHY link speed.
|
||||
|
@ -117,7 +117,7 @@ status_t PHY_DP83848_GetLinkStatus(phy_handle_t *handle, bool *status);
|
||||
* @brief Gets the PHY link speed and duplex.
|
||||
*
|
||||
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
||||
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
||||
* and duplex address parameter and set the other as NULL if only wants to get one of them.
|
||||
*
|
||||
* @param handle PHY device handle.
|
||||
* @param speed The address of PHY link speed.
|
||||
|
@ -117,7 +117,7 @@ status_t PHY_KSZ8081_GetLinkStatus(phy_handle_t *handle, bool *status);
|
||||
* @brief Gets the PHY link speed and duplex.
|
||||
*
|
||||
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
||||
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
||||
* and duplex address parameter and set the other as NULL if only wants to get one of them.
|
||||
*
|
||||
* @param handle PHY device handle.
|
||||
* @param speed The address of PHY link speed.
|
||||
|
@ -117,7 +117,7 @@ status_t PHY_LAN8720_GetLinkStatus(phy_handle_t *handle, bool *status);
|
||||
* @brief Gets the PHY link speed and duplex.
|
||||
*
|
||||
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
||||
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
||||
* and duplex address parameter and set the other as NULL if only wants to get one of them.
|
||||
*
|
||||
* @param handle PHY device handle.
|
||||
* @param speed The address of PHY link speed.
|
||||
|
@ -117,7 +117,7 @@ status_t PHY_RTL8211F_GetLinkStatus(phy_handle_t *handle, bool *status);
|
||||
* @brief Gets the PHY link speed and duplex.
|
||||
*
|
||||
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
||||
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
||||
* and duplex address parameter and set the other as NULL if only wants to get one of them.
|
||||
*
|
||||
* @param handle PHY device handle.
|
||||
* @param speed The address of PHY link speed.
|
||||
|
@ -207,7 +207,7 @@ static inline status_t PHY_GetLinkStatus(phy_handle_t *handle, bool *status) {
|
||||
* @brief Gets the PHY link speed and duplex.
|
||||
*
|
||||
* @brief This function gets the speed and duplex mode of PHY. User can give one of speed
|
||||
* and duplex address paramter and set the other as NULL if only wants to get one of them.
|
||||
* and duplex address parameter and set the other as NULL if only wants to get one of them.
|
||||
*
|
||||
* @param handle PHY device handle.
|
||||
* @param speed The address of PHY link speed.
|
||||
|
@ -60,7 +60,7 @@ Reset_Handler:
|
||||
* linker script.
|
||||
* __etext: End of code section, i.e., begin of data sections to copy from.
|
||||
* __data_start__/__data_end__: RAM address range that data should be
|
||||
* __noncachedata_start__/__noncachedata_end__ : none cachable region
|
||||
* __noncachedata_start__/__noncachedata_end__ : non-cacheable region
|
||||
* __ram_function_start__/__ram_function_end__ : ramfunction region
|
||||
* copied to. Both must be aligned to 4 bytes boundary. */
|
||||
|
||||
@ -80,7 +80,7 @@ Reset_Handler:
|
||||
str r0, [r2, r3]
|
||||
bgt .LC0
|
||||
.LC1:
|
||||
#else /* code size implemenation */
|
||||
#else /* code size implementation */
|
||||
.LC0:
|
||||
cmp r2, r3
|
||||
ittt lt
|
||||
@ -103,7 +103,7 @@ Reset_Handler:
|
||||
str r0, [r2, r3]
|
||||
bgt .LC_ramfunc_copy_start
|
||||
.LC_ramfunc_copy_end:
|
||||
#else /* code size implemenation */
|
||||
#else /* code size implementation */
|
||||
.LC_ramfunc_copy_start:
|
||||
cmp r2, r3
|
||||
ittt lt
|
||||
@ -127,7 +127,7 @@ Reset_Handler:
|
||||
str r0, [r2, r3]
|
||||
bgt .LC2
|
||||
.LC3:
|
||||
#else /* code size implemenation */
|
||||
#else /* code size implementation */
|
||||
.LC2:
|
||||
cmp r2, r3
|
||||
ittt lt
|
||||
|
@ -826,7 +826,7 @@ STATIC bool i2s_init(machine_i2s_obj_t *self) {
|
||||
|
||||
memset(self->edmaTcd, 0, sizeof(edma_tcd_t));
|
||||
|
||||
// continuous DMA operation is acheived using the scatter/gather feature, with one TCD linked back to itself
|
||||
// continuous DMA operation is achieved using the scatter/gather feature, with one TCD linked back to itself
|
||||
EDMA_TcdSetTransferConfig(self->edmaTcd, &transferConfig, self->edmaTcd);
|
||||
EDMA_TcdEnableInterrupts(self->edmaTcd, kEDMA_MajorInterruptEnable | kEDMA_HalfInterruptEnable);
|
||||
EDMA_InstallTCD(DMA0, self->dma_channel, self->edmaTcd);
|
||||
|
@ -137,7 +137,7 @@ STATIC uint8_t channel_decode(char channel) {
|
||||
}
|
||||
}
|
||||
|
||||
// decode the AF objects module and Port numer. Returns NULL if it is not a FLEXPWM object
|
||||
// decode the AF objects module and Port number. Returns NULL if it is not a FLEXPWM object
|
||||
STATIC const machine_pin_af_obj_t *af_name_decode_flexpwm(const machine_pin_af_obj_t *af_obj,
|
||||
uint8_t *module, uint8_t *submodule, uint8_t *channel) {
|
||||
const char *str;
|
||||
@ -171,7 +171,7 @@ STATIC uint8_t qtmr_decode(char channel) {
|
||||
}
|
||||
}
|
||||
|
||||
// decode the AF objects module and Port numer. Returns NULL if it is not a QTMR object
|
||||
// decode the AF objects module and Port number. Returns NULL if it is not a QTMR object
|
||||
STATIC const machine_pin_af_obj_t *af_name_decode_qtmr(const machine_pin_af_obj_t *af_obj, uint8_t *module, uint8_t *channel) {
|
||||
const char *str;
|
||||
size_t len;
|
||||
@ -558,7 +558,7 @@ void machine_pwm_deinit_all(void) {
|
||||
|
||||
for (int i = 1; i < ARRAY_SIZE(pwm_bases); i++) {
|
||||
PWM_StopTimer(pwm_bases[i], 0x0f); // Stop all submodules
|
||||
pwm_bases[i]->OUTEN = 0; // Disable ouput on all submodules, all channels
|
||||
pwm_bases[i]->OUTEN = 0; // Disable output on all submodules, all channels
|
||||
}
|
||||
|
||||
#ifdef FSL_FEATURE_SOC_TMR_COUNT
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define MP_HAL_PIN_FMT "%q"
|
||||
extern ringbuf_t stdin_ringbuf;
|
||||
|
||||
// Define an alias fo systick_ms, because the shared softtimer.c uses
|
||||
// Define an alias for systick_ms, because the shared softtimer.c uses
|
||||
// the symbol uwTick for the systick ms counter.
|
||||
#define uwTick systick_ms
|
||||
|
||||
|
@ -223,7 +223,7 @@ void sdcard_card_removed_callback(USDHC_Type *base, void *userData);
|
||||
void sdcard_transfer_complete_callback(USDHC_Type *base, usdhc_handle_t *handle, status_t status, void *userData);
|
||||
void sdcard_dummy_callback(USDHC_Type *base, void *userData);
|
||||
|
||||
// SD Card commmands
|
||||
// SD Card commands
|
||||
static bool sdcard_cmd_go_idle_state(mimxrt_sdcard_obj_t *card);
|
||||
static bool sdcard_cmd_oper_cond(mimxrt_sdcard_obj_t *card);
|
||||
static bool sdcard_cmd_app_cmd(mimxrt_sdcard_obj_t *card);
|
||||
|
@ -28,7 +28,7 @@ SECTIONS
|
||||
|
||||
. = ALIGN(4);
|
||||
_etext = .; /* define a global symbol at end of code */
|
||||
_sidata = _etext; /* This is used by the startup in order to initialize the .data secion */
|
||||
_sidata = _etext; /* This is used by the startup in order to initialize the .data section */
|
||||
} >FLASH
|
||||
|
||||
/* This is the initialized data section
|
||||
|
@ -98,7 +98,7 @@ Note: further tuning of features to include in bluetooth or even setting up the
|
||||
|
||||
## Compile with freeze manifest
|
||||
|
||||
Freeze manifests can be used by definining `FROZEN_MANIFEST` pointing to a
|
||||
Freeze manifests can be used by defining `FROZEN_MANIFEST` pointing to a
|
||||
`manifest.py`. This can either be done by a `make` invocation or by defining
|
||||
it in the specific target board's `mpconfigboard.mk`.
|
||||
|
||||
@ -132,8 +132,8 @@ For example:
|
||||
## Set file system size
|
||||
|
||||
The size of the file system on the internal flash is configured by the linker
|
||||
script parameter `_fs_size`. This can either be overriden by the linker script
|
||||
or dynamically through the makefile. By seting a value to the `FS_SIZE`.
|
||||
script parameter `_fs_size`. This can either be overridden by the linker script
|
||||
or dynamically through the makefile. By setting a value to the `FS_SIZE`.
|
||||
The number will be passed directly to the linker scripts in order to calculate
|
||||
the start and end of the file system. Note that the parameter value must be in
|
||||
linker script syntax as it is passed directly.
|
||||
@ -215,7 +215,7 @@ Install the necessary Python packages that will be used for flashing using the b
|
||||
The `intelhex` provides the `hexmerge.py` utility which is used by the Makefile
|
||||
to trim of the MBR in case SoftDevice flashing is requested.
|
||||
|
||||
`nrfutil` as flashing backend also requires a serial port paramter to be defined
|
||||
`nrfutil` as flashing backend also requires a serial port parameter to be defined
|
||||
in addition to the `deploy` target of make. For example:
|
||||
|
||||
make BOARD=nrf52840-mdk-usb-dongle NRFUTIL_PORT=/dev/ttyACM0 deploy
|
||||
|
@ -23,7 +23,7 @@ import time
|
||||
|
||||
class IMU:
|
||||
def __init__(self, bus):
|
||||
"""Initalizes Gyro, Accelerometer and Magnetometer using default values."""
|
||||
"""Initializes Gyro, Accelerometer and Magnetometer using default values."""
|
||||
if 0x68 in bus.scan():
|
||||
from bmm150 import BMM150
|
||||
from bmi270 import BMI270
|
||||
|
@ -13,7 +13,7 @@ SUPPORTED_FN = {"UART": ["RX", "TX", "CTS", "RTS"]}
|
||||
def parse_pin(name_str):
|
||||
"""Parses a string and returns a pin-num."""
|
||||
if len(name_str) < 1:
|
||||
raise ValueError("Expecting pin name to be at least 4 charcters.")
|
||||
raise ValueError("Expecting pin name to be at least 4 characters.")
|
||||
if name_str[0] != "P":
|
||||
raise ValueError("Expecting pin name to start with P")
|
||||
pin_str = name_str[1:].split("/")[0]
|
||||
|
@ -219,7 +219,7 @@ STATIC mp_obj_t microbit_image_make_new(const mp_obj_type_t *type_in, mp_uint_t
|
||||
const char *str = mp_obj_str_get_data(args[0], &len);
|
||||
// make image from string
|
||||
if (len == 1) {
|
||||
/* For a single charater, return the font glyph */
|
||||
/* For a single character, return the font glyph */
|
||||
return microbit_image_for_char(str[0]);
|
||||
} else {
|
||||
/* Otherwise parse the image description string */
|
||||
@ -305,7 +305,7 @@ STATIC void image_blit(microbit_image_obj_t *src, greyscale_t *dest, mp_int_t x,
|
||||
greyscaleSetPixelValue(dest, i+xdest-x, j+ydest-y, val);
|
||||
}
|
||||
}
|
||||
// Adjust intersection rectange to dest
|
||||
// Adjust intersection rectangle to dest
|
||||
intersect_x0 += xdest-x;
|
||||
intersect_y0 += ydest-y;
|
||||
intersect_x1 += xdest-x;
|
||||
|
@ -480,7 +480,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
|
||||
|
||||
// do encoding into the adv buffer
|
||||
if (sd_ble_uuid_encode(&uuid, &encoded_size, &adv_data[byte_pos]) != 0) {
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("can't encode UUID into advertisment packet"));
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("can't encode UUID into advertisement packet"));
|
||||
}
|
||||
|
||||
BLE_DRIVER_LOG("encoded uuid for service %u: ", 0);
|
||||
@ -528,7 +528,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
|
||||
|
||||
// do encoding into the adv buffer
|
||||
if (sd_ble_uuid_encode(&uuid, &encoded_size, &adv_data[byte_pos]) != 0) {
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("can't encode UUID into advertisment packet"));
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("can't encode UUID into advertisement packet"));
|
||||
}
|
||||
|
||||
BLE_DRIVER_LOG("encoded uuid for service %u: ", 0);
|
||||
@ -552,7 +552,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
|
||||
|
||||
if ((p_adv_params->data_len > 0) && (p_adv_params->p_data != NULL)) {
|
||||
if (p_adv_params->data_len + byte_pos > BLE_GAP_ADV_MAX_SIZE) {
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("can't fit data into advertisment packet"));
|
||||
mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("can't fit data into advertisement packet"));
|
||||
}
|
||||
|
||||
memcpy(adv_data, p_adv_params->p_data, p_adv_params->data_len);
|
||||
@ -590,12 +590,12 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
|
||||
|
||||
#if (BLUETOOTH_SD == 110)
|
||||
m_adv_params.fp = BLE_GAP_ADV_FP_ANY;
|
||||
m_adv_params.timeout = 0; // infinite advertisment
|
||||
m_adv_params.timeout = 0; // infinite advertisement
|
||||
#else
|
||||
m_adv_params.properties.anonymous = 0;
|
||||
m_adv_params.properties.include_tx_power = 0;
|
||||
m_adv_params.filter_policy = 0;
|
||||
m_adv_params.max_adv_evts = 0; // infinite advertisment
|
||||
m_adv_params.max_adv_evts = 0; // infinite advertisement
|
||||
m_adv_params.primary_phy = BLE_GAP_PHY_AUTO;
|
||||
m_adv_params.secondary_phy = BLE_GAP_PHY_AUTO;
|
||||
m_adv_params.scan_req_notification = 0; // Do not raise scan request notifications when scanned.
|
||||
@ -606,12 +606,12 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
|
||||
#if (BLUETOOTH_SD == 110)
|
||||
if ((err_code = sd_ble_gap_adv_data_set(adv_data, byte_pos, NULL, 0)) != 0) {
|
||||
mp_raise_msg_varg(&mp_type_OSError,
|
||||
MP_ERROR_TEXT("Can not apply advertisment data. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
MP_ERROR_TEXT("Can not apply advertisement data. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
}
|
||||
#else
|
||||
if ((err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &m_adv_params)) != 0) {
|
||||
mp_raise_msg_varg(&mp_type_OSError,
|
||||
MP_ERROR_TEXT("Can not apply advertisment data. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
MP_ERROR_TEXT("Can not apply advertisement data. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
}
|
||||
#endif
|
||||
BLE_DRIVER_LOG("Set Adv data size: " UINT_FMT "\n", byte_pos);
|
||||
@ -626,7 +626,7 @@ bool ble_drv_advertise_data(ubluepy_advertise_data_t * p_adv_params) {
|
||||
#endif
|
||||
if (err_code != 0) {
|
||||
mp_raise_msg_varg(&mp_type_OSError,
|
||||
MP_ERROR_TEXT("Can not start advertisment. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
MP_ERROR_TEXT("Can not start advertisement. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
}
|
||||
|
||||
m_adv_in_progress = true;
|
||||
@ -641,12 +641,12 @@ void ble_drv_advertise_stop(void) {
|
||||
#if (BLUETOOTH_SD == 110)
|
||||
if ((err_code = sd_ble_gap_adv_stop()) != 0) {
|
||||
mp_raise_msg_varg(&mp_type_OSError,
|
||||
MP_ERROR_TEXT("Can not stop advertisment. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
MP_ERROR_TEXT("Can not stop advertisement. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
}
|
||||
#else
|
||||
if ((err_code = sd_ble_gap_adv_stop(m_adv_handle)) != 0) {
|
||||
mp_raise_msg_varg(&mp_type_OSError,
|
||||
MP_ERROR_TEXT("Can not stop advertisment. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
MP_ERROR_TEXT("Can not stop advertisement. status: 0x" HEX2_FMT), (uint16_t)err_code);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ int set_ticker_callback(uint32_t index, ticker_callback_ptr func, int32_t initia
|
||||
ticker->INTENCLR = masks[index];
|
||||
ticker->TASKS_CAPTURE[index] = 1;
|
||||
uint32_t t = FastTicker->CC[index];
|
||||
// Need to make sure that set tick is aligned to lastest tick
|
||||
// Need to make sure that set tick is aligned to latest tick
|
||||
// Use CC[3] as a reference, as that is always up-to-date.
|
||||
int32_t cc3 = FastTicker->CC[3];
|
||||
int32_t delta = t+initial_delay_us-cc3;
|
||||
|
@ -53,7 +53,7 @@ def generate_eddystone_adv_packet(url):
|
||||
constants.ad_types.AD_TYPE_SERVICE_DATA, service_data
|
||||
)
|
||||
|
||||
# generate advertisment packet
|
||||
# generate advertisement packet
|
||||
packet = bytearray([])
|
||||
packet.extend(packet_flags)
|
||||
packet.extend(packet_uuid16)
|
||||
|
@ -42,7 +42,7 @@ def event_handler(id, handle, data):
|
||||
rtc.stop()
|
||||
# indicate 'disconnected'
|
||||
LED(1).off()
|
||||
# restart advertisment
|
||||
# restart advertisement
|
||||
periph.advertise(device_name="micr_temp", services=[serv_env_sense])
|
||||
|
||||
elif id == constants.EVT_GATTS_WRITE:
|
||||
|
@ -618,7 +618,7 @@ MP_DEFINE_CONST_OBJ_TYPE(
|
||||
/// x3 = machine.Pin.board.X3
|
||||
/// x3_af = x3.af_list()
|
||||
///
|
||||
/// x3_af will now contain an array of PinAF objects which are availble on
|
||||
/// x3_af will now contain an array of PinAF objects which are available on
|
||||
/// pin X3.
|
||||
///
|
||||
/// For the pyboard, x3_af would contain:
|
||||
|
@ -135,7 +135,7 @@ STATIC mp_obj_t machine_timer_make_new(const mp_obj_type_t *type, size_t n_args,
|
||||
}
|
||||
|
||||
// Timer peripheral usage:
|
||||
// Every timer instance has a numer of capture/compare (CC) registers.
|
||||
// Every timer instance has a number of capture/compare (CC) registers.
|
||||
// These can store either the value to compare against (to trigger an
|
||||
// interrupt or a shortcut) or store a value returned from a
|
||||
// capture/compare event.
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
/* Examples:
|
||||
|
||||
Advertisment:
|
||||
Advertisement:
|
||||
|
||||
from ubluepy import Peripheral
|
||||
p = Peripheral()
|
||||
|
@ -165,7 +165,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(ubluepy_peripheral_set_conn_handler_obj, periph
|
||||
#if MICROPY_PY_UBLUEPY_PERIPHERAL
|
||||
|
||||
/// \method advertise(device_name, [service=[service1, service2, ...]], [data=bytearray], [connectable=True])
|
||||
/// Start advertising. Connectable advertisment type by default.
|
||||
/// Start advertising. Connectable advertisement type by default.
|
||||
///
|
||||
STATIC mp_obj_t peripheral_advertise(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
|
||||
static const mp_arg_t allowed_args[] = {
|
||||
@ -234,7 +234,7 @@ STATIC mp_obj_t peripheral_advertise(mp_uint_t n_args, const mp_obj_t *pos_args,
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ubluepy_peripheral_advertise_obj, 0, peripheral_advertise);
|
||||
|
||||
/// \method advertise_stop()
|
||||
/// Stop advertisment if any onging advertisment.
|
||||
/// Stop advertisement if any onging advertisement.
|
||||
///
|
||||
STATIC mp_obj_t peripheral_advertise_stop(mp_obj_t self_in) {
|
||||
ubluepy_peripheral_obj_t *self = MP_OBJ_TO_PTR(self_in);
|
||||
|
@ -71,7 +71,7 @@ STATIC mp_obj_t scan_entry_get_rssi(mp_obj_t self_in) {
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(bluepy_scan_entry_get_rssi_obj, scan_entry_get_rssi);
|
||||
|
||||
/// \method getScanData()
|
||||
/// Return list of the scan data tupples (ad_type, description, value)
|
||||
/// Return list of the scan data tuples (ad_type, description, value)
|
||||
///
|
||||
STATIC mp_obj_t scan_entry_get_scan_data(mp_obj_t self_in) {
|
||||
ubluepy_scan_entry_obj_t * self = MP_OBJ_TO_PTR(self_in);
|
||||
|
@ -127,7 +127,7 @@ extern const mp_obj_type_t uos_mbfs_textio_type;
|
||||
// Page indexes count down from the end of ROM.
|
||||
STATIC uint8_t first_page_index;
|
||||
STATIC uint8_t last_page_index;
|
||||
// The number of useable chunks in the file system.
|
||||
// The number of usable chunks in the file system.
|
||||
STATIC uint8_t chunks_in_file_system;
|
||||
// Index of chunk to start searches. This is randomised to even out wear.
|
||||
STATIC uint8_t start_index;
|
||||
|
@ -58,7 +58,7 @@
|
||||
_start:
|
||||
b boot_entry
|
||||
|
||||
/* QEMU comes in at 0x10. Put a value in argc/r3 to distingush from
|
||||
/* QEMU comes in at 0x10. Put a value in argc/r3 to distinguish from
|
||||
* microwatt. */
|
||||
. = 0x10
|
||||
FIXUP_ENDIAN
|
||||
|
@ -6,7 +6,7 @@ SECTIONS
|
||||
KEEP(*(.head))
|
||||
}
|
||||
|
||||
/* Put this at 0x1700 which is right after our execption
|
||||
/* Put this at 0x1700 which is right after our exception
|
||||
* vectors in head.S.
|
||||
*/
|
||||
. = 0x1700;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#define MICROPY_HW_SPI1_MOSI (15)
|
||||
#define MICROPY_HW_SPI1_MISO (12)
|
||||
|
||||
// Battery fuel guage MAX17048 on I2C1
|
||||
// Battery fuel gauge MAX17048 on I2C1
|
||||
// BATT_ALERT GPIO24
|
||||
|
||||
// NeoPixel data GPIO8, power not toggleable
|
||||
|
@ -24,7 +24,7 @@ SUPPORTED_FN = {
|
||||
def parse_pin(name_str):
|
||||
"""Parses a string and returns a pin number."""
|
||||
if len(name_str) < 2:
|
||||
raise ValueError("Expecting pin name to be at least 2 charcters.")
|
||||
raise ValueError("Expecting pin name to be at least 2 characters.")
|
||||
if not name_str.startswith("GPIO") and not name_str.startswith("EXT_GPIO"):
|
||||
raise ValueError("Expecting pin name to start with EXT_/GPIO")
|
||||
return int(re.findall(r"\d+$", name_str)[0])
|
||||
|
@ -68,7 +68,7 @@ SECTIONS
|
||||
/* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
|
||||
* FLASH ... we will include any thing excluded here in .data below by default */
|
||||
*(.init)
|
||||
/* Change for MicroPython... excluse gc.c, parse.c, vm.c from flash */
|
||||
/* Change for MicroPython... exclude gc.c, parse.c, vm.c from flash */
|
||||
*(EXCLUDE_FILE(*libgcc.a: *libc.a: *lib_a-mem*.o *libm.a: *gc.c.obj *vm.c.obj *parse.c.obj) .text*)
|
||||
*(.fini)
|
||||
/* Pull all c'tors into .text */
|
||||
|
@ -36,7 +36,7 @@ extern uint8_t __StackTop, __StackBottom;
|
||||
|
||||
void *core_state[2];
|
||||
|
||||
// This will be non-NULL while Python code is execting.
|
||||
// This will be non-NULL while Python code is executing.
|
||||
STATIC void *(*core1_entry)(void *) = NULL;
|
||||
|
||||
STATIC void *core1_arg = NULL;
|
||||
|
@ -113,7 +113,7 @@ STATIC mp_obj_t adc_obj_make_new(const mp_obj_type_t *type, size_t n_args, size_
|
||||
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
|
||||
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
// Unpack and check, whther the pin has ADC capability
|
||||
// Unpack and check, whether the pin has ADC capability
|
||||
int id = mp_hal_get_pin_obj(args[ARG_id].u_obj);
|
||||
adc_config_t adc_config = get_adc_config(id, busy_flags);
|
||||
|
||||
|
@ -98,7 +98,7 @@ void common_i2c_irq_handler(int i2c_id) {
|
||||
i2c->I2CM.INTFLAG.reg |= SERCOM_I2CM_INTFLAG_SB;
|
||||
}
|
||||
} else if (IRQ_DATA_SENT) {
|
||||
if (NACK_RECVD) { // e.g. NACK after adress for both read and write.
|
||||
if (NACK_RECVD) { // e.g. NACK after address for both read and write.
|
||||
self->state = state_nack; // force stop of transmission
|
||||
i2c->I2CM.INTFLAG.reg |= SERCOM_I2CM_INTFLAG_MB;
|
||||
} else if (self->len > 0) { // data to be sent
|
||||
@ -200,7 +200,7 @@ mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n
|
||||
#elif defined(MCU_SAMD51)
|
||||
NVIC_EnableIRQ(SERCOM0_0_IRQn + 4 * self->id); // MB interrupt
|
||||
NVIC_EnableIRQ(SERCOM0_0_IRQn + 4 * self->id + 1); // SB interrupt
|
||||
NVIC_EnableIRQ(SERCOM0_0_IRQn + 4 * self->id + 3); // ERRROR interrupt
|
||||
NVIC_EnableIRQ(SERCOM0_0_IRQn + 4 * self->id + 3); // ERROR interrupt
|
||||
#endif
|
||||
|
||||
// Now enable I2C.
|
||||
@ -230,7 +230,7 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si
|
||||
i2c->I2CM.INTENSET.reg = SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB | SERCOM_I2CM_INTENSET_ERROR;
|
||||
self->state = state_busy;
|
||||
|
||||
// Send the adress, which kicks off the transfer
|
||||
// Send the address, which kicks off the transfer
|
||||
i2c->I2CM.ADDR.bit.ADDR = (addr << 1) | READ_MODE;
|
||||
|
||||
// Transfer the data
|
||||
|
@ -507,7 +507,7 @@ STATIC mp_uint_t machine_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint
|
||||
}
|
||||
} else if (request == MP_STREAM_FLUSH) {
|
||||
// The timeout is defined by the buffer size and the baudrate.
|
||||
// Take the worst case assumtions at 13 bit symbol size times 2.
|
||||
// Take the worst case assumptions at 13 bit symbol size times 2.
|
||||
uint64_t timeout = mp_hal_ticks_ms_64() + (3
|
||||
#if MICROPY_HW_UART_TXBUF
|
||||
+ self->write_buffer.size
|
||||
|
@ -125,14 +125,14 @@ void check_usb_recovery_mode(void) {
|
||||
|
||||
// Purpose of the #defines for the clock configuration.
|
||||
//
|
||||
// Both CPU and periperal devices are clocked by the DFLL48M clock.
|
||||
// Both CPU and peripheral devices are clocked by the DFLL48M clock.
|
||||
// DFLL48M is either free running, or controlled by the 32kHz crystal, or
|
||||
// Synchronized with the USB clock.
|
||||
//
|
||||
// #define MICROPY_HW_XOSC32K (0 | 1)
|
||||
//
|
||||
// If MICROPY_HW_XOSC32K = 1, the 32kHz crystal is used as input for GCLK 1, which
|
||||
// serves as refernce clock source for the DFLL48M oscillator,
|
||||
// serves as reference clock source for the DFLL48M oscillator,
|
||||
// The crystal is used, unless MICROPY_HW_MCU_OSC32KULP is set.
|
||||
// In that case GCLK1 (and the CPU clock) is driven by the 32K Low power oscillator.
|
||||
// The reason for offering this option is a design flaw of the Adafruit
|
||||
@ -147,11 +147,11 @@ void check_usb_recovery_mode(void) {
|
||||
// not exactly 48Mhz and has a substantional temperature drift.
|
||||
//
|
||||
// If MICROPY_HW_DFLL_USB_SYNC = 1, the DFLL48 is synchronized with the 1 kHz USB sync
|
||||
// signal. If after boot there is no USB sync withing 500ms, the configuratuion falls
|
||||
// signal. If after boot there is no USB sync within 500ms, the configuration falls
|
||||
// back to a free running 48Mhz oscillator.
|
||||
//
|
||||
// In all modes, the 48MHz signal has a substantial jitter, largest when
|
||||
// MICROPY_HW_DFLL_USB_SYNC is active. That is caused by the repective
|
||||
// MICROPY_HW_DFLL_USB_SYNC is active. That is caused by the respective
|
||||
// reference frequencies of 32kHz or 1 kHz being low. That affects most
|
||||
// PWM. Std Dev at 1kHz 0.156Hz (w. Crystal) up to 0.4 Hz (with USB sync).
|
||||
//
|
||||
@ -171,7 +171,7 @@ void init_clocks(uint32_t cpu_freq) {
|
||||
// GCLK5: 48MHz, source: DFLL48M, usage: USB
|
||||
// GCLK8: 1kHz, source: XOSC32K or OSCULP32K, usage: WDT and RTC
|
||||
// DFLL48M: Reference sources:
|
||||
// - in closed loop mode: eiter XOSC32K or OSCULP32K or USB clock
|
||||
// - in closed loop mode: either XOSC32K or OSCULP32K or USB clock
|
||||
// from GCLK4.
|
||||
// - in open loop mode: None
|
||||
// FDPLL96M: Reference source GCLK1
|
||||
|
@ -2,7 +2,7 @@
|
||||
# for some of the peripheral devices with many possible assignments.
|
||||
# The pin_cap_table is a subset from table 7-1 of the data sheet.
|
||||
# It contain the information about pin mux set and pad
|
||||
# The eic and adc columns contain the decimal numer for the respecitive
|
||||
# The eic and adc columns contain the decimal number for the respecitive
|
||||
# quantity, the columns for sercom, tc and tcc have in each cell
|
||||
# the device number in the upper nibble, and the pad number in the lower
|
||||
# nibble. If a signal is not available, the cell in the csv table is left empty.
|
||||
|
|
@ -172,11 +172,11 @@ void check_usb_recovery_mode(void) {
|
||||
// not exactly 48Mhz and has a substantional temperature drift.
|
||||
//
|
||||
// If MICROPY_HW_DFLL_USB_SYNC = 1, the DFLL48 is synchronized with the 1 kHz USB sync
|
||||
// signal. If after boot there is no USB sync withing 500ms, the configuratuion falls
|
||||
// signal. If after boot there is no USB sync within 500ms, the configuration falls
|
||||
// back to a free running 48Mhz oscillator.
|
||||
//
|
||||
// In all modes, the 48MHz signal has a substantial jitter, largest when
|
||||
// MICROPY_HW_DFLL_USB_SYNC is active. That is caused by the repective
|
||||
// MICROPY_HW_DFLL_USB_SYNC is active. That is caused by the respective
|
||||
// reference frequencies of 32kHz or 1 kHz being low. That affects most
|
||||
// PWM. Std Dev at 1kHz 0.156Hz (w. Crystal) up to 0.4 Hz (with USB sync).
|
||||
//
|
||||
@ -195,7 +195,7 @@ void init_clocks(uint32_t cpu_freq) {
|
||||
// GCLK4: 32kHz, source: XOSC32K, if crystal present, usage: DFLL48M reference
|
||||
// GCLK5: 48MHz, source: DFLL48M, usage: USB
|
||||
// DFLL48M: Reference sources:
|
||||
// - in closed loop mode: eiter XOSC32K or OSCULP32K or USB clock
|
||||
// - in closed loop mode: either XOSC32K or OSCULP32K or USB clock
|
||||
// - in open loop mode: None
|
||||
// DPLL0: 48 - 200 MHz
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
# The pin_cap_table is a subset from table 6-1 of the data sheet.
|
||||
# It contain the information about pin mux set and pad
|
||||
# for some of the peripheral devices with many possible assignments.
|
||||
# The colums represent the peripheral class, as defined in pin_cap_t. The
|
||||
# The columns represent the peripheral class, as defined in pin_cap_t. The
|
||||
# column number is equivalent to the mux class.
|
||||
# The eic and adc columns contain the decimal numer for the respecitive
|
||||
# The eic and adc columns contain the decimal number for the respecitive
|
||||
# quantity, the columns for sercom, tc and tcc have in each cell
|
||||
# the device number in the first, and the pad number in the second
|
||||
# digit. If a signal is not available, the cell in the csv table is left empty.
|
||||
|
|
@ -121,7 +121,7 @@ const char *pin_name(int id) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
// Test, wether the given pin is defined and has signals for sercom.
|
||||
// Test, whether the given pin is defined and has signals for sercom.
|
||||
// If that applies return the alt_fct and pad_nr.
|
||||
// If not, an error will be raised.
|
||||
|
||||
@ -136,7 +136,7 @@ sercom_pad_config_t get_sercom_config(int pin_id, uint8_t sercom_nr) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test, wether the given pin is defined as ADC.
|
||||
// Test, whether the given pin is defined as ADC.
|
||||
// If that applies return the adc instance and channel.
|
||||
// If not, an error will be raised.
|
||||
|
||||
@ -158,7 +158,7 @@ adc_config_t get_adc_config(int pin_id, int32_t flag) {
|
||||
}
|
||||
}
|
||||
|
||||
// Test, wether the given pin is defined and has signals for pwm.
|
||||
// Test, whether the given pin is defined and has signals for pwm.
|
||||
// If that applies return the alt_fct, tcc number and channel number.
|
||||
// If not, an error will be raised.
|
||||
// The function either supplies a channel from a wanted device, or
|
||||
|
@ -163,7 +163,7 @@ extern struct _spi_bdev_t spi_bdev;
|
||||
#define MICROPY_HW_UART7_RTS (pyb_pin_BT_RTS)
|
||||
#define MICROPY_HW_UART7_CTS (pyb_pin_BT_CTS)
|
||||
|
||||
// I2C busses
|
||||
// I2C buses
|
||||
#define MICROPY_HW_I2C1_SCL (pyb_pin_I2C1_SCL)
|
||||
#define MICROPY_HW_I2C1_SDA (pyb_pin_I2C1_SDA)
|
||||
|
||||
|
@ -212,7 +212,7 @@ void NICLAV_board_low_power(int mode) {
|
||||
// Disable all power rails, except core voltage.
|
||||
NICLAV_board_pmic_enable(false);
|
||||
|
||||
// Reset all busses, peripherals, GPIO clocks etc..
|
||||
// Reset all buses, peripherals, GPIO clocks etc..
|
||||
RCC->AHB1RSTR = 0x0A00C023U;
|
||||
RCC->AHB2RSTR = 0x00000271U;
|
||||
RCC->AHB3RSTR = 0x00015031U;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user