Skip to content

Commit 0cbcf1b

Browse files
authored
Pycoproc2 (#390)
* restructuring Pycoproc documentation * Fixed formatting * added to menu tree * removed the pytrack / pysense layer * Completed the Pycoproc API * fixed naming * updated landing page * renamed to shields * added v16 warning * restructuring Pycoproc documentation * Fixed formatting * added to menu tree * removed the pytrack / pysense layer * Completed the Pycoproc API * fixed naming * updated landing page * renamed to shields * added v16 warning * added sensor list and changed naming * modified links * changed menu names * updated naming
1 parent be2576c commit 0cbcf1b

File tree

19 files changed

+451
-511
lines changed

19 files changed

+451
-511
lines changed

config.toml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ theme = "doc-theme"
415415
weight = 70
416416

417417
[[menu.main]]
418-
name = "Expansion Boards"
418+
name = "Shields"
419419
url = "/tutorials/expansionboards/"
420420
identifier = "tutorials@expansionboards"
421421
parent = "tutorials"
@@ -737,54 +737,60 @@ theme = "doc-theme"
737737
weight = 40
738738

739739
[[menu.main]]
740-
name = "Expansion boards"
740+
name = "Shields"
741741
url = "/firmwareapi/pycom/expansionboards/"
742742
identifier = "firmwareapi@pycom@expansionboards"
743743
parent = "firmwareapi@pycom"
744744
weight = 50
745745

746746
[[menu.main]]
747-
name = "Pygate"
748-
url = "/firmwareapi/pycom/expansionboards/pygate/"
749-
identifier = "firmwareapi@pycom@expansionboards@pygate"
747+
name = "Pycoproc"
748+
url = "/firmwareapi/pycom/expansionboards/pycoproc/"
749+
identifier = "firmwareapi@pycom@expansionboards@pycoproc"
750750
parent = "firmwareapi@pycom@expansionboards"
751751
weight = 10
752752
[[menu.main]]
753-
name = "pysense"
754-
url = "/firmwareapi/pycom/expansionboards/pysense/"
755-
identifier = "firmwareapi@pycom@expansionboards@pysense"
753+
name = "Pycoproc2"
754+
url = "/firmwareapi/pycom/expansionboards/pycoproc2/"
755+
identifier = "firmwareapi@pycom@expansionboards@pycoproc2"
756756
parent = "firmwareapi@pycom@expansionboards"
757757
weight = 20
758758
[[menu.main]]
759-
name = "pysense 2.0 x"
760-
url = "/firmwareapi/pycom/expansionboards/pysense2/"
759+
name = "LIS2HH12"
760+
url = "/firmwareapi/pycom/expansionboards/LIS2HH12/"
761761
identifier = "firmwareapi@pycom@expansionboards@pysense2"
762762
parent = "firmwareapi@pycom@expansionboards"
763763
weight = 30
764764
[[menu.main]]
765-
name = "pytrack"
766-
url = "/firmwareapi/pycom/expansionboards/pytrack/"
767-
identifier = "firmwareapi@pycom@expansionboards@pytrack"
765+
name = "LTR329ALS01"
766+
url = "/firmwareapi/pycom/expansionboards/LTR329ALS01/"
767+
identifier = "firmwareapi@pycom@expansionboards@LTR329ALS01"
768768
parent = "firmwareapi@pycom@expansionboards"
769769
weight = 40
770770
[[menu.main]]
771-
name = "pytrack 2.0 x"
772-
url = "/firmwareapi/pycom/expansionboards/pytrack2/"
773-
identifier = "firmwareapi@pycom@expansionboards@pytrack2"
771+
name = "SI7006A20"
772+
url = "/firmwareapi/pycom/expansionboards/SI7006A20/"
773+
identifier = "firmwareapi@pycom@expansionboards@SI7006A20"
774774
parent = "firmwareapi@pycom@expansionboards"
775775
weight = 50
776776
[[menu.main]]
777-
name = "pyscan"
778-
url = "/firmwareapi/pycom/expansionboards/pyscan/"
779-
identifier = "firmwareapi@pycom@expansionboards@pyscan"
777+
name = "MPL3115A2"
778+
url = "/firmwareapi/pycom/expansionboards/MPL3115A2/"
779+
identifier = "firmwareapi@pycom@expansionboards@MPL3115A2"
780780
parent = "firmwareapi@pycom@expansionboards"
781781
weight = 60
782-
[[menu.main]]
783-
name = "sleep"
784-
url = "/firmwareapi/pycom/expansionboards/sleep/"
785-
identifier = "firmwareapi@pycom@expansionboards@sleep"
782+
[[menu.main]]
783+
name = "MFRC630"
784+
url = "/firmwareapi/pycom/expansionboards/MFRC630/"
785+
identifier = "firmwareapi@pycom@expansionboards@MFRC630"
786786
parent = "firmwareapi@pycom@expansionboards"
787787
weight = 70
788+
[[menu.main]]
789+
name = "L76GNSS"
790+
url = "/firmwareapi/pycom/expansionboards/L76GNSS/"
791+
identifier = "firmwareapi@pycom@expansionboards@L76GNSS"
792+
parent = "firmwareapi@pycom@expansionboards"
793+
weight = 80
788794

789795

790796

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
Title: "GPS"
3+
---
4+
5+
The L76GNSS is the GPS module that can provide location data to your application.
6+
7+
## Constructors
8+
9+
### class L76GNSS(pytrack = None, sda = 'P22', scl = 'P21', timeout = None)
10+
11+
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)`.
12+
13+
## Methods
14+
15+
### L76GNSS.coordinates(debug = False)
16+
17+
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.
18+
19+
### L76GNSS.dump_nmea()
20+
21+
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
22+
23+
### L76GNSS.write()
24+
25+
Send commands to the `L76GNSS`. See the datasheet of the L76 for more information. Be aware that some commands might break the communication interface.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
Title: "Accelerometer"
3+
---
4+
5+
The LIS2HH12 is a 3-Axis Accelerometer provides outputs for acceleration, roll and pitch
6+
7+
## Constructors
8+
9+
### class LIS2HH12(pycoproc = None, sda = 'P22', scl = 'P21')
10+
11+
Creates a LIS2HH12 object. Constructor must be passed a Pycoproc or I2C object to successfully construct.
12+
13+
## Methods
14+
15+
### LIS2HH12.acceleration()
16+
17+
Read the acceleration from the accelerometer. Returns a tuple with the 3 values of acceleration in g-force: `(x, y, z)`.
18+
19+
### LIS2HH12.roll()
20+
21+
Read the current roll from the accelerometer. Returns a float in degrees in the range -180 to 180.
22+
23+
### LIS2HH12.pitch()
24+
25+
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.
26+
27+
### LIS2HH12.enable_activity_interrupt(threshold, duration, handler=None)
28+
29+
Set an activity- and inactivity interrupt for the accelerometer. This takes the arguments:
30+
* `threshold`: the activity threshold in `mg`, between 62 - 4000
31+
* `duration`: the duration in `ms`, between 160 - 40800
32+
* `handler`: The interrupt handler. When not given, it will print `Activity interrupt` and `Inactivity interrupt`
33+
The function returns a tuple containing the set values: `(threshold, duration)`. These depend on the resolution.
34+
35+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
Title: "Ambient Light sensor"
3+
---
4+
5+
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.
6+
7+
### Constructors
8+
9+
### class LTR329ALS01(pycoproc = None, sda = 'P22', scl = 'P21', gain = LTR329ALS01.ALS_GAIN_1X, integration = LTR329ALS01.ALS_INT_100, rate = LTR329ALS01.ALS_RATE_500)
10+
11+
Creates a LTR329ALS01 object. Constructor must be passed a Pycoproc or I2C object to successfully construct. The additional arguments are:
12+
* `gain`: The light sensor ADC gain. see the Constants for values
13+
* `integration`: Controls the integration time of the periodic measurement. See the Constants for values
14+
* `rate`: The used sample rate in ms, must be set larger than the integration period. See the Constants for values
15+
16+
## Methods
17+
18+
### LTR329ALS01.light()
19+
20+
Read the light levels of both light sensors. Returns a tuple with two values for light levels in lux: `(blue, red)`, between 0-65535.
21+
22+
## Constants
23+
24+
The following arguments may be passed into the constructor.
25+
26+
* gain: `ALS_GAIN_1X`,`ALS_GAIN_2X`, `ALS_GAIN_4X`, `ALS_GAIN_8X`, `ALS_GAIN_48X`, `ALS_GAIN_96X`
27+
* 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`
28+
* rate: `ALS_RATE_50`, `ALS_RATE_100`, `ALS_RATE_200`, `ALS_RATE_500`, `ALS_RATE_1000`, `ALS_RATE_2000`
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
Title: "NFC and RFID reader"
3+
---
4+
5+
The MFRC630 is a NFC and RFID card reader.
6+
7+
## Constructors
8+
9+
### class MFRC630(pycoproc=None, sda='P22', scl='P21', timeout=None, debug=False)
10+
11+
Creates a `MFRC630` object. Constructor must be passed a Pycoproc or I2C object to successfully construct.
12+
13+
## Methods
14+
15+
### MFRC630.mfrc630_cmd_init()
16+
17+
Initialises the MFRC630.
18+
19+
### MFRC630.mfrc630_cmd_reset()
20+
21+
Reset the device. Stops the currently active command and resets device.
22+
23+
### MFRC630.mfrc630_cmd_idle()
24+
25+
Set the device into idle mode. Stops the currently active command and return to idle mode.
26+
27+
### MFRC630.mfrc630_cmd_load_key(key)
28+
29+
Loads the provided key into the key buffer.
30+
31+
* `key` Array which holds the MIFARE key, **it is always 6 bytes long**
32+
33+
#### MFRC630.mfrc630_MF_read_block(block_address, dest)
34+
35+
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.
36+
37+
* `block_address` The block to read
38+
* `dest` The array in which to write the 16 bytes read from the card
39+
40+
Returns `0` for failure, otherwise the number of bytes received.
41+
42+
#### MFRC630.mfrc630_MF_auth(uid, key_type, block)
43+
44+
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)`.
45+
46+
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.
47+
48+
* `key_type`: The MIFARE key A or B (`MFRC630_MF_AUTH_KEY_A` or `MFRC630_MF_AUTH_KEY_B`) to use
49+
* `block`: The block to authenticate
50+
* `uid`: The authentication procedure required the first four bytes of the card's UID to authenticate
51+
52+
Returns `0` in case of failure, nonzero in case of success.
53+
54+
#### MFRC630.mfrc630_MF_deauth()
55+
56+
Disables MIFARE authentication. Disable the `Crypto1` bit from the status register to disable encryption.
57+
58+
#### MFRC630.mfrc630_iso14443a_WUPA_REQA(instruction)
59+
60+
Send `WUPA` and `REQA`. Returns the response byte, the answer to request `A` byte (`ATQA`), or `0` in case of no answer.
61+
62+
* instruction: `MFRC630_ISO14443_CMD_WUPA`, `MFRC630_ISO14443_CMD_REQA`
63+
64+
#### MFRC630.mfrc630_iso14443a_select(uid)
65+
66+
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.
67+
68+
* `uid`: The UID of the card will be stored into this array.
69+
70+
Returns the length of the UID in bytes (`4, 7, 10`), or `0` in case of failure.
71+
72+
#### MFRC630.print_debug(msg)
73+
74+
Prints debug statements if `DEBUG` is enabled.
75+
76+
#### MFRC630.format_block(block, length)
77+
78+
Prints `block` with `length`.
79+
80+
#### MFRC630.mfrc630_format_block(data, len)
81+
82+
Converts `data` to hexadecimal format.
83+
84+
* `data` The array to be formatted
85+
* `len` The number of bytes to format
86+
87+
#### MFRC630.mfrc630_print_block(data, len)
88+
89+
Prints the bytes in `data` array in hexadecimal format, separated by spaces using the `mfrc630_format_block` method.
90+
91+
* `data` The array to be printed
92+
* `len` The number of bytes to print
93+
94+
## Constants
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
Title: "Pressure and Altitude sensor"
3+
---
4+
5+
## Constructors
6+
7+
### class MPL3115A2(pycoproc = None, sda = 'P22', scl = 'P21', mode = MPL3115A2.PRESSURE)
8+
9+
Creates a MPL3115A2 object. Constructor must be passed a Pycoproc or I2C object to successfully construct.
10+
11+
## Methods
12+
13+
### MPL3115A2.pressure()
14+
15+
Read the atmospheric pressure of the sensor. Returns a float with the pressure in Pascal.
16+
17+
### MPL3115A2.altitude()
18+
19+
Read the altitude of the sensor. Returns a float with the altitude in meter.
20+
21+
### MPL3115A2.temperature()
22+
23+
Read the temperature of the sensor. Returns a float with the temperature in degrees Celcius.
24+
25+
## Constants
26+
27+
The following constants may be passed into the constructor.
28+
29+
* mode: `PRESSURE`, `ALTITUDE`
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
Title: "Humidity and Temperature Sensor"
3+
---
4+
5+
The Humidity and Temperature sensor provides values of relative humidity and external temperature.
6+
7+
## Constructors
8+
9+
### class SI7006A20(pycoproc = None, sda = 'P22', scl = 'P21')
10+
11+
Creates a SI7006A20 object. Constructor must be passed a Pycoproc or I2C object to successfully construct.
12+
13+
## Methods
14+
15+
### SI7006A20.humidity()
16+
17+
Read the relative humidity of the sensor. Returns a float with the percentage relative humidity.
18+
19+
### SI7006A20.temperature()
20+
21+
Read the external temperature of the sensor. Returns a float with the temperature in degrees Celcius.
22+
23+
### SI7006A20.dew_point()
24+
25+
Calculates the dew point temperature for the current temperature and humidity measurement.

0 commit comments

Comments
 (0)