Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 29 additions & 23 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ theme = "doc-theme"
weight = 70

[[menu.main]]
name = "Expansion Boards"
name = "Shields"
url = "/tutorials/expansionboards/"
identifier = "tutorials@expansionboards"
parent = "tutorials"
Expand Down Expand Up @@ -737,54 +737,60 @@ theme = "doc-theme"
weight = 40

[[menu.main]]
name = "Expansion boards"
name = "Shields"
url = "/firmwareapi/pycom/expansionboards/"
identifier = "firmwareapi@pycom@expansionboards"
parent = "firmwareapi@pycom"
weight = 50

[[menu.main]]
name = "Pygate"
url = "/firmwareapi/pycom/expansionboards/pygate/"
identifier = "firmwareapi@pycom@expansionboards@pygate"
name = "Pycoproc"
url = "/firmwareapi/pycom/expansionboards/pycoproc/"
identifier = "firmwareapi@pycom@expansionboards@pycoproc"
parent = "firmwareapi@pycom@expansionboards"
weight = 10
[[menu.main]]
name = "pysense"
url = "/firmwareapi/pycom/expansionboards/pysense/"
identifier = "firmwareapi@pycom@expansionboards@pysense"
name = "Pycoproc2"
url = "/firmwareapi/pycom/expansionboards/pycoproc2/"
identifier = "firmwareapi@pycom@expansionboards@pycoproc2"
parent = "firmwareapi@pycom@expansionboards"
weight = 20
[[menu.main]]
name = "pysense 2.0 x"
url = "/firmwareapi/pycom/expansionboards/pysense2/"
name = "LIS2HH12"
url = "/firmwareapi/pycom/expansionboards/LIS2HH12/"
identifier = "firmwareapi@pycom@expansionboards@pysense2"
parent = "firmwareapi@pycom@expansionboards"
weight = 30
[[menu.main]]
name = "pytrack"
url = "/firmwareapi/pycom/expansionboards/pytrack/"
identifier = "firmwareapi@pycom@expansionboards@pytrack"
name = "LTR329ALS01"
url = "/firmwareapi/pycom/expansionboards/LTR329ALS01/"
identifier = "firmwareapi@pycom@expansionboards@LTR329ALS01"
parent = "firmwareapi@pycom@expansionboards"
weight = 40
[[menu.main]]
name = "pytrack 2.0 x"
url = "/firmwareapi/pycom/expansionboards/pytrack2/"
identifier = "firmwareapi@pycom@expansionboards@pytrack2"
name = "SI7006A20"
url = "/firmwareapi/pycom/expansionboards/SI7006A20/"
identifier = "firmwareapi@pycom@expansionboards@SI7006A20"
parent = "firmwareapi@pycom@expansionboards"
weight = 50
[[menu.main]]
name = "pyscan"
url = "/firmwareapi/pycom/expansionboards/pyscan/"
identifier = "firmwareapi@pycom@expansionboards@pyscan"
name = "MPL3115A2"
url = "/firmwareapi/pycom/expansionboards/MPL3115A2/"
identifier = "firmwareapi@pycom@expansionboards@MPL3115A2"
parent = "firmwareapi@pycom@expansionboards"
weight = 60
[[menu.main]]
name = "sleep"
url = "/firmwareapi/pycom/expansionboards/sleep/"
identifier = "firmwareapi@pycom@expansionboards@sleep"
[[menu.main]]
name = "MFRC630"
url = "/firmwareapi/pycom/expansionboards/MFRC630/"
identifier = "firmwareapi@pycom@expansionboards@MFRC630"
parent = "firmwareapi@pycom@expansionboards"
weight = 70
[[menu.main]]
name = "L76GNSS"
url = "/firmwareapi/pycom/expansionboards/L76GNSS/"
identifier = "firmwareapi@pycom@expansionboards@L76GNSS"
parent = "firmwareapi@pycom@expansionboards"
weight = 80



Expand Down
25 changes: 25 additions & 0 deletions content/firmwareapi/pycom/expansionboards/L76GNSS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
Title: "GPS"
---

The L76GNSS is the GPS module that can provide location data to your application.

## Constructors

### class L76GNSS(pytrack = None, sda = 'P22', scl = 'P21', timeout = None)

Creates a L76GNSS object. Constructor must be passed a Pytrack or I2C object to successfully construct. Set the `timeout` to a period in seconds for the GPS to search for a lock. If a lock is not found by the time the `timeout` has expired, the `coordinates` method will return `(None, None)`.

## Methods

### L76GNSS.coordinates(debug = False)

Read the longitude and latitude from the `L76GNSS`. Returns a tuple with `(longitude, latitude)`. With `debug` set to `True` the output from the GPS is verbose.

### L76GNSS.dump_nmea()

Continuously print nmea sentences received from the `L76GNSS` to the REPL. This is useful if you want to use a graphical tool over UART to visualise GPS reception

### L76GNSS.write()

Send commands to the `L76GNSS`. See the datasheet of the L76 for more information. Be aware that some commands might break the communication interface.
35 changes: 35 additions & 0 deletions content/firmwareapi/pycom/expansionboards/LIS2HH12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
Title: "Accelerometer"
---

The LIS2HH12 is a 3-Axis Accelerometer provides outputs for acceleration, roll and pitch

## Constructors

### class LIS2HH12(pycoproc = None, sda = 'P22', scl = 'P21')

Creates a LIS2HH12 object. Constructor must be passed a Pycoproc or I2C object to successfully construct.

## Methods

### LIS2HH12.acceleration()

Read the acceleration from the accelerometer. Returns a tuple with the 3 values of acceleration in g-force: `(x, y, z)`.

### LIS2HH12.roll()

Read the current roll from the accelerometer. Returns a float in degrees in the range -180 to 180.

### LIS2HH12.pitch()

Read the current pitch from the accelerometer. Returns a float in degrees in the range -90 to 90. Once the board tilts beyond this range the values will repeat. This is due to a lack of yaw measurement, making it not possible to know the exact orientation of the board.

### LIS2HH12.enable_activity_interrupt(threshold, duration, handler=None)

Set an activity- and inactivity interrupt for the accelerometer. This takes the arguments:
* `threshold`: the activity threshold in `mg`, between 62 - 4000
* `duration`: the duration in `ms`, between 160 - 40800
* `handler`: The interrupt handler. When not given, it will print `Activity interrupt` and `Inactivity interrupt`
The function returns a tuple containing the set values: `(threshold, duration)`. These depend on the resolution.


28 changes: 28 additions & 0 deletions content/firmwareapi/pycom/expansionboards/LTR329ALS01.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
Title: "Ambient Light sensor"
---

The LTR329ALS01 is a dual light sensor that provides outputs for external light levels in lux. See the datasheet for more information about the wavelengths of the two sensors.

### Constructors

### class LTR329ALS01(pycoproc = None, sda = 'P22', scl = 'P21', gain = LTR329ALS01.ALS_GAIN_1X, integration = LTR329ALS01.ALS_INT_100, rate = LTR329ALS01.ALS_RATE_500)

Creates a LTR329ALS01 object. Constructor must be passed a Pycoproc or I2C object to successfully construct. The additional arguments are:
* `gain`: The light sensor ADC gain. see the Constants for values
* `integration`: Controls the integration time of the periodic measurement. See the Constants for values
* `rate`: The used sample rate in ms, must be set larger than the integration period. See the Constants for values

## Methods

### LTR329ALS01.light()

Read the light levels of both light sensors. Returns a tuple with two values for light levels in lux: `(blue, red)`, between 0-65535.

## Constants

The following arguments may be passed into the constructor.

* gain: `ALS_GAIN_1X`,`ALS_GAIN_2X`, `ALS_GAIN_4X`, `ALS_GAIN_8X`, `ALS_GAIN_48X`, `ALS_GAIN_96X`
* integration: `ALS_INT_50`, `ALS_INT_100`, `ALS_INT_150`, `ALS_INT_200`, `ALS_INT_250`, `ALS_INT_300`, `ALS_INT_350`, `ALS_INT_400`
* rate: `ALS_RATE_50`, `ALS_RATE_100`, `ALS_RATE_200`, `ALS_RATE_500`, `ALS_RATE_1000`, `ALS_RATE_2000`
94 changes: 94 additions & 0 deletions content/firmwareapi/pycom/expansionboards/MFRC630.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
Title: "NFC and RFID reader"
---

The MFRC630 is a NFC and RFID card reader.

## Constructors

### class MFRC630(pycoproc=None, sda='P22', scl='P21', timeout=None, debug=False)

Creates a `MFRC630` object. Constructor must be passed a Pycoproc or I2C object to successfully construct.

## Methods

### MFRC630.mfrc630_cmd_init()

Initialises the MFRC630.

### MFRC630.mfrc630_cmd_reset()

Reset the device. Stops the currently active command and resets device.

### MFRC630.mfrc630_cmd_idle()

Set the device into idle mode. Stops the currently active command and return to idle mode.

### MFRC630.mfrc630_cmd_load_key(key)

Loads the provided key into the key buffer.

* `key` Array which holds the MIFARE key, **it is always 6 bytes long**

#### MFRC630.mfrc630_MF_read_block(block_address, dest)

Reads a block of memory from an authenticated card. Try to read a block of memory from the card with the appropriate timeouts and error checking.

* `block_address` The block to read
* `dest` The array in which to write the 16 bytes read from the card

Returns `0` for failure, otherwise the number of bytes received.

#### MFRC630.mfrc630_MF_auth(uid, key_type, block)

Perform a MIFARE authentication procedure. This function is a higher-level wrapper around the MF authenticate command. The result of the authentication is checked to identify whether it appears to have succeeded. The key must be loaded into the key buffer with `MFRC630.mfrc630_cmd_load_key(key)`.

Once authenticated, the authentication MUST be stopped manually by calling the `mfrc630_MF_deauth()` function or otherwise disabling the `Crypto1 ON` bit in the status register.

* `key_type`: The MIFARE key A or B (`MFRC630_MF_AUTH_KEY_A` or `MFRC630_MF_AUTH_KEY_B`) to use
* `block`: The block to authenticate
* `uid`: The authentication procedure required the first four bytes of the card's UID to authenticate

Returns `0` in case of failure, nonzero in case of success.

#### MFRC630.mfrc630_MF_deauth()

Disables MIFARE authentication. Disable the `Crypto1` bit from the status register to disable encryption.

#### MFRC630.mfrc630_iso14443a_WUPA_REQA(instruction)

Send `WUPA` and `REQA`. Returns the response byte, the answer to request `A` byte (`ATQA`), or `0` in case of no answer.

* instruction: `MFRC630_ISO14443_CMD_WUPA`, `MFRC630_ISO14443_CMD_REQA`

#### MFRC630.mfrc630_iso14443a_select(uid)

Performs the `SELECT` procedure to discover a card's UID. This performs the `SELECT` procedure as explained in _ISO14443A_, this determines the UID of the card, if multiple cards are present, a collision will occur, which is handled according to the norm.

* `uid`: The UID of the card will be stored into this array.

Returns the length of the UID in bytes (`4, 7, 10`), or `0` in case of failure.

#### MFRC630.print_debug(msg)

Prints debug statements if `DEBUG` is enabled.

#### MFRC630.format_block(block, length)

Prints `block` with `length`.

#### MFRC630.mfrc630_format_block(data, len)

Converts `data` to hexadecimal format.

* `data` The array to be formatted
* `len` The number of bytes to format

#### MFRC630.mfrc630_print_block(data, len)

Prints the bytes in `data` array in hexadecimal format, separated by spaces using the `mfrc630_format_block` method.

* `data` The array to be printed
* `len` The number of bytes to print

## Constants
29 changes: 29 additions & 0 deletions content/firmwareapi/pycom/expansionboards/MPL3115A2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
Title: "Pressure and Altitude sensor"
---

## Constructors

### class MPL3115A2(pycoproc = None, sda = 'P22', scl = 'P21', mode = MPL3115A2.PRESSURE)

Creates a MPL3115A2 object. Constructor must be passed a Pycoproc or I2C object to successfully construct.

## Methods

### MPL3115A2.pressure()

Read the atmospheric pressure of the sensor. Returns a float with the pressure in Pascal.

### MPL3115A2.altitude()

Read the altitude of the sensor. Returns a float with the altitude in meter.

### MPL3115A2.temperature()

Read the temperature of the sensor. Returns a float with the temperature in degrees Celcius.

## Constants

The following constants may be passed into the constructor.

* mode: `PRESSURE`, `ALTITUDE`
25 changes: 25 additions & 0 deletions content/firmwareapi/pycom/expansionboards/SI7006A20.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
Title: "Humidity and Temperature Sensor"
---

The Humidity and Temperature sensor provides values of relative humidity and external temperature.

## Constructors

### class SI7006A20(pycoproc = None, sda = 'P22', scl = 'P21')

Creates a SI7006A20 object. Constructor must be passed a Pycoproc or I2C object to successfully construct.

## Methods

### SI7006A20.humidity()

Read the relative humidity of the sensor. Returns a float with the percentage relative humidity.

### SI7006A20.temperature()

Read the external temperature of the sensor. Returns a float with the temperature in degrees Celcius.

### SI7006A20.dew_point()

Calculates the dew point temperature for the current temperature and humidity measurement.
Loading