mirror of
https://github.com/sascha-hemi/pycom-documentation.git
synced 2026-03-21 10:05:56 +01:00
GitBook: [master] 14 pages modified
This commit is contained in:
committed by
gitbook-bot
parent
98e214f1f6
commit
39e2a48307
@@ -51,7 +51,7 @@ python $IDF_PATH/components/esptool_py/esptool/espefuse.py --port /dev/ttyUSB0 b
|
||||
|
||||
**If the keys are not written in efuse, before flashing the bootloader, then random keys will be generated by the ESP32, they can never be read nor re-written, so bootloader can never be updated. Even more, the application can be re-flashed \(by USB\) just 3 more times.**
|
||||
|
||||
## Makefile options:
|
||||
## Makefile options
|
||||
|
||||
```bash
|
||||
make BOARD=GPY SECURE=on SECURE_KEY=secure_boot_signing_key.pem ENCRYPT_KEY=flash_encryption_key.bin TARGET=[boot|app]
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The math module provides some basic mathematical functions for working with floating-point numbers. Floating point support required for this module.
|
||||
|
||||
## Functions
|
||||
## Methods
|
||||
|
||||
#### math.acos\(x\)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# micropython
|
||||
|
||||
## Methosd
|
||||
## Methods
|
||||
|
||||
#### micropython.alloc\_emergency\_exception\_buf\(size\)
|
||||
|
||||
|
||||
@@ -16,25 +16,25 @@ dac_tone.tone(1000, 0) # set tone output to 1kHz
|
||||
|
||||
## Constructors
|
||||
|
||||
### class class machine.DAC\(pin\)
|
||||
#### class class machine.DAC\(pin\)
|
||||
|
||||
Create a DAC object, that will let you associate a channel with a `pin`. `pin` can be a string argument.
|
||||
|
||||
## Methods
|
||||
|
||||
### dac.init\(\)
|
||||
#### dac.init\(\)
|
||||
|
||||
Enable the DAC block. This method is automatically called on object creation.
|
||||
|
||||
### dac.deinit\(\)
|
||||
#### dac.deinit\(\)
|
||||
|
||||
Disable the DAC block.
|
||||
|
||||
### dac.write\(value\)
|
||||
#### dac.write\(value\)
|
||||
|
||||
Set the DC level for a DAC pin. `value` is a float argument, with values between 0 and 1.
|
||||
|
||||
### dac.tone\(frequency, amplitude\)
|
||||
#### dac.tone\(frequency, amplitude\)
|
||||
|
||||
Sets up tone signal to the specified `frequency` at `amplitude` scale. `frequency` can be from `125Hz` to `20kHz` in steps of `122Hz`. `amplitude` is an integer specifying the tone amplitude to write the DAC pin. Amplitude value represents:
|
||||
|
||||
|
||||
@@ -62,13 +62,15 @@ i2c.writeto_mem(0x42, 0x10, 'xy') # write 2 bytes to slave 0x42, slave memory 0x
|
||||
|
||||
## Constructors
|
||||
|
||||
### class machine.I2C\(bus, ...\)
|
||||
#### class machine.I2C\(bus, ...\)
|
||||
|
||||
Construct an I2C object on the given `bus`. `bus` can only be `0, 1, 2`. If the `bus` is not given, the default one will be selected \(`0`\). Buses `0` and `1` use the ESP32 I2C hardware peripheral while bus `2` is implemented with a bit-banged software driver.
|
||||
|
||||
## General Methods
|
||||
## Methods
|
||||
|
||||
### i2c.init\(mode, \* , baudrate=100000, pins=\(SDA, SCL\)\)
|
||||
### General Methods
|
||||
|
||||
#### i2c.init\(mode, \* , baudrate=100000, pins=\(SDA, SCL\)\)
|
||||
|
||||
Initialise the I2C bus with the given parameters:
|
||||
|
||||
@@ -76,45 +78,45 @@ Initialise the I2C bus with the given parameters:
|
||||
* `baudrate` is the SCL clock rate
|
||||
* pins is an optional tuple with the pins to assign to the I2C bus. The default I2C pins are `P9` \(SDA\) and `P10` \(SCL\)
|
||||
|
||||
### i2c.scan\(\)
|
||||
#### i2c.scan\(\)
|
||||
|
||||
Scan all I2C addresses between `0x08` and `0x77` inclusive and return a list of those that respond. A device responds if it pulls the SDA line low after its address \(including a read bit\) is sent on the bus.
|
||||
|
||||
## Standard Bus Operations
|
||||
### Standard Bus Operations
|
||||
|
||||
The following methods implement the standard I2C master read and write operations that target a given slave device.
|
||||
|
||||
### i2c.readfrom\(addr, nbytes\)
|
||||
#### i2c.readfrom\(addr, nbytes\)
|
||||
|
||||
Read `nbytes` from the slave specified by `addr`. Returns a bytes object with the data read.
|
||||
|
||||
### i2c.readfrom\_into\(addr, buf\)
|
||||
#### i2c.readfrom\_into\(addr, buf\)
|
||||
|
||||
Read into `buf` from the slave specified by `addr`. The number of bytes read will be the length of `buf`.
|
||||
|
||||
Return value is the number of bytes read.
|
||||
|
||||
### i2c.writeto\(addr, buf, \* , stop=True\)
|
||||
#### i2c.writeto\(addr, buf, \* , stop=True\)
|
||||
|
||||
Write the bytes from `buf` to the slave specified by `addr`. The argument `buf` can also be an integer which will be treated as a single byte. If `stop` is set to `False` then the stop condition won’t be sent and the I2C operation may be continued \(typically with a read transaction\).
|
||||
|
||||
Return value is the number of bytes written.
|
||||
|
||||
## Memory Operations
|
||||
### Memory Operations
|
||||
|
||||
Some I2C devices act as a memory device \(or set of registers\) that can be read from and written to. In this case there are two addresses associated with an I2C transaction: the slave address and the memory address. The following methods are convenience functions to communicate with such devices.
|
||||
|
||||
### i2c.readfrom\_mem\(addr, memaddr, nbytes, \*, addrsize=8\)
|
||||
#### i2c.readfrom\_mem\(addr, memaddr, nbytes, \*, addrsize=8\)
|
||||
|
||||
Read `nbytes` from the slave specified by `addr` starting from the memory address specified by `memaddr`. The `addrsize` argument is specified in bits and it can only take 8 or 16.
|
||||
|
||||
### i2c.readfrom\_mem\_into\(addr, memaddr, buf, \*, addrsize=8\)
|
||||
#### i2c.readfrom\_mem\_into\(addr, memaddr, buf, \*, addrsize=8\)
|
||||
|
||||
Read into `buf` from the slave specified by `addr` starting from the memory address specified by `memaddr`. The number of bytes read is the length of `buf`. The `addrsize` argument is specified in bits and it can only take 8 or 16.
|
||||
|
||||
The return value is the number of bytes read.
|
||||
|
||||
### i2c.writeto\_mem\(addr, memaddr, buf \*, addrsize=8\)
|
||||
#### i2c.writeto\_mem\(addr, memaddr, buf \*, addrsize=8\)
|
||||
|
||||
Write `buf` to the slave specified by `addr` starting from the memory address specified by `memaddr`. The argument `buf` can also be an integer which will be treated as a single byte. The `addrsize` argument is specified in bits and it can only take 8 or 16.
|
||||
|
||||
|
||||
@@ -85,6 +85,10 @@ print(" %f seconds in the last lap" % (total - lap))
|
||||
class Alarm – get interrupted after a specific interval
|
||||
```
|
||||
|
||||
## class Alarm
|
||||
|
||||
Used to get interrupted after a specific interval.
|
||||
|
||||
### Methods
|
||||
|
||||
#### alarm.callback\(handler, \* , arg=None\)
|
||||
|
||||
@@ -13,7 +13,7 @@ pycom.heartbeat() # get the heartbeat state
|
||||
pycom.rgbled(0xff00) # make the LED light up in green color
|
||||
```
|
||||
|
||||
## Functions
|
||||
## Methods
|
||||
|
||||
#### pycom.heartbeat\(\[enable\]\)
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ All Pycom modules, including the LoPy, come with a on-board WiFi antenna as well
|
||||
|
||||

|
||||
|
||||
### Deep Sleep current issue {#deep-sleep-current-issue}
|
||||
## Deep Sleep current issue
|
||||
|
||||
The LoPy, SiPy, and WiPy 2.0 experience an issue where the modules maintain a high current consumption in deep sleep mode. This issue has been resolved in all newer products. The cause for this issue is the DC to DC switch mode converter remains in a high performance mode even when the device is in deep sleep. The flash memory chip also does not power down. A more detailed explanation can be found [here.](https://forum.pycom.io/topic/1022/root-causes-of-high-deep-sleep-current)
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ All Pycom modules, including the FiPy, come with a on-board WiFi antenna as well
|
||||
|
||||

|
||||
|
||||
### Deep Sleep current issue {#deep-sleep-current-issue}
|
||||
## Deep Sleep current issue
|
||||
|
||||
The LoPy, SiPy, and WiPy 2.0 experience an issue where the modules maintain a high current consumption in deep sleep mode. This issue has been resolved in all newer products. The cause for this issue is the DC to DC switch mode converter remains in a high performance mode even when the device is in deep sleep. The flash memory chip also does not power down. A more detailed explanation can be found [here.](https://forum.pycom.io/topic/1022/root-causes-of-high-deep-sleep-current)
|
||||
|
||||
|
||||
@@ -73,11 +73,11 @@ All Pycom modules, including the WiPy, come with a on-board WiFi antenna as well
|
||||
|
||||

|
||||
|
||||
### Deep Sleep current issue {#deep-sleep-current-issue}
|
||||
## Deep Sleep current issue
|
||||
|
||||
The LoPy, SiPy, and WiPy 2.0 experience an issue where the modules maintain a high current consumption in deep sleep mode. This issue has been resolved in all newer products. The cause for this issue is the DC to DC switch mode converter remains in a high performance mode even when the device is in deep sleep. The flash memory chip also does not power down. A more detailed explanation can be found [here.](https://forum.pycom.io/topic/1022/root-causes-of-high-deep-sleep-current)
|
||||
|
||||
### WiPy 2.0 vs WiPy 3.0
|
||||
## WiPy 2.0 vs WiPy 3.0
|
||||
|
||||
The WiPy 3.0 is an upgraded version of the WiPy 2.0 with the following changes:
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Pin `P12` released during:
|
||||
|
||||
| 1st 3 secs window | 2nd 3 secs window |
|
||||
| :--- | :--- |
|
||||
| Disable `boot.py` and `main.py` | same as previous but using previous OTA firmware |
|
||||
| Disable `boot.py` and `main.py` | Same as previous but using previous OTA firmware |
|
||||
|
||||
The selection made during safe boot is not persistent, therefore after the next normal reset, the latest firmware will proceed to run again.
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Cellular
|
||||
|
||||
In order to use your GPy/FiPy on a cellular network you are required to get a SIM card from a local provider. _Note:_ This might differ from a standard SIM you can buy in a store, our devices do not support standard LTE.
|
||||
In order to use your GPy/FiPy on a cellular network you are required to get a SIM card from a local provider.
|
||||
|
||||
_Note: This might differ from a standard SIM you can buy in a store, our devices do not support standard LTE._
|
||||
|
||||
Currently we are not able to provide any specific details about how to get such a SIM card and how to register it as most deployments are closed trials, each carrier has it’s own rules \(for example, whether they require special SIMs or not\).
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
MicroPython has an interactive code tool known as the REPL \(Read Evaluate Print Line\). The REPL allows you to run code on your device, line by line. To begin coding, go to the Pymakr Plugin Console and start typing your code. Start by making the LED change colour.
|
||||
|
||||
```python
|
||||
import pycom # we need this module to control the LED
|
||||
import pycom # we need this module to control the LED
|
||||
|
||||
pycom.heartbeat(False) # disable the blue blinking
|
||||
pycom.rgbled(0x00ff00) # make the LED light up green in colour
|
||||
|
||||
@@ -44,11 +44,11 @@ py.go_to_sleep()
|
||||
|
||||
## Methods
|
||||
|
||||
### pytrack.get\_sleep\_remaining\(\)
|
||||
#### pytrack.get\_sleep\_remaining\(\)
|
||||
|
||||
In the event of a sleep session that was awoken by an asynchronous event \(Accelerometer, INT pin or Reset button\) the approximate sleep remaining interval \(expressed in **seconds**\) can be found out. The user has to manually use `setup_sleep()` to configure the next sleep interval.
|
||||
|
||||
### pytrack.get\_wake\_reason\(\)
|
||||
#### pytrack.get\_wake\_reason\(\)
|
||||
|
||||
Returns the last wakeup reason. Possible values are:
|
||||
|
||||
@@ -63,13 +63,13 @@ _Note: the `WAKE_REASON_INT_PIN` can be used if the `PIC_RC1` pin \(pin\#6 on Ex
|
||||
|
||||
As in the above example, this method should be called at the beginning of the script, to find out the reset \(wakeup\) reason.
|
||||
|
||||
### pytrack.go\_to\_sleep\(\[gps=True\]\)
|
||||
#### pytrack.go\_to\_sleep\(\[gps=True\]\)
|
||||
|
||||
Puts the board in sleep mode, for the duration, which has to be set previously with `pytrack.setup_sleep(timout_sec)`. The optional boolean parameter sets the GPS state during sleep.
|
||||
|
||||
MicroPython code, which is after this function, is not executed, as wakeup will restart MicroPython.
|
||||
|
||||
### pytrack.setup\_int\_wake\_up\(rising, falling\]\)
|
||||
#### pytrack.setup\_int\_wake\_up\(rising, falling\]\)
|
||||
|
||||
Enables as wakeup source, the accelerometer INT pin \(PIC - RA5\). The boolean parameters will indicate rising edge \(activity detection\) and/or falling edge \(inactivity detection\) is configured.
|
||||
|
||||
@@ -89,11 +89,11 @@ py.setup_int_wake_up(True, True)
|
||||
acc.enable_activity_interrupt(2000, 200)
|
||||
```
|
||||
|
||||
### pytrack.setup\_int\_pin\_wake\_up\(\[rising\_edge = True\]\)
|
||||
#### pytrack.setup\_int\_pin\_wake\_up\(\[rising\_edge = True\]\)
|
||||
|
||||
Enables as wakeup source, the INT pic \(PIC - RC1, pin\#6 on External IO Header\). Either rising or falling edge has to be set, by default it's rising edge.
|
||||
|
||||
### pytrack.setup\_sleep\(time\_seconds\)
|
||||
#### pytrack.setup\_sleep\(time\_seconds\)
|
||||
|
||||
Sets the sleep interval, specified in seconds. The actual sleep will be started by calling `go_to_sleep()` method.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user