Add usage section
This commit is contained in:
parent
5672fe8b5f
commit
db32f0c796
2 changed files with 44 additions and 6 deletions
25
readme.md
25
readme.md
|
@ -13,8 +13,27 @@ The RP2040 chip (used for the Pico) has a rather atypical peripheral called PIO
|
|||
|
||||
The PIO is programmed using an assembler called `pioasm`, with just a few very basic instructions. What's interesting is that each instruction takes (usually) 1 cycle to execute. What's more, it's possible to divide the clock at which the program executes. In our case, we divide the main clock of 125 MHz by 125, giving us one instruction per microsecond.
|
||||
|
||||
## Example
|
||||
todo!()`
|
||||
## Usage
|
||||
First, create and retrieve the PIO objects
|
||||
```rust
|
||||
let (dht_pio, dht_sm, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
|
||||
```
|
||||
To create a new object:
|
||||
- DHT22
|
||||
````rust
|
||||
let mut dht = Dht22::new(dht_pio, dht_sm, pins.gpio0.into_function());
|
||||
```
|
||||
- DHT11
|
||||
````rust
|
||||
let mut dht = Dht11::new(dht_pio, dht_sm, pins.gpio0.into_function());
|
||||
```
|
||||
|
||||
Read data:
|
||||
````rust
|
||||
let dht_data = dht.read(&mut delay);
|
||||
```
|
||||
|
||||
NB: `read` retrun a `Result<DhtResult, DhtError>`.
|
||||
|
||||
## Support
|
||||
### Board
|
||||
|
@ -22,7 +41,7 @@ For the moment, the crates have only been tested on a Raspberry Pico.
|
|||
|
||||
### DHT
|
||||
✅ DHT22
|
||||
❌ DHT11
|
||||
❔ DHT11
|
||||
|
||||
## TODO
|
||||
- [ ] Finish Readme
|
||||
|
|
25
readme_fr.md
25
readme_fr.md
|
@ -16,8 +16,27 @@ Le chip RP2040 (utilisé pour le Pico), possède un périphérique un peu atypiq
|
|||
|
||||
Le PIO se programme à l'aide d'un assembleur nommé `pioasm`, il ne comporte que quelques instructions très basiques. Le plus intéressant est que chaque instruction prends (en général), 1 cycle pour s'exécute. De plus il est possible de diviser la clock à laquelle le programme s'éxécute. Dans le notre cas, on disive la clock principale, de 125 MHz, par 125, ce qui nous donne une instruction par microsecondes.
|
||||
|
||||
## Exemple
|
||||
`todo!()`
|
||||
## Usage
|
||||
Dans un premier temps créer récupérer les objets PIO
|
||||
```rust
|
||||
let (dht_pio, dht_sm, _, _, _) = pac.PIO0.split(&mut pac.RESETS);
|
||||
```
|
||||
Pour créer un nouvelle objet:
|
||||
- DHT22
|
||||
```rust
|
||||
let mut dht = Dht22::new(dht_pio, dht_sm, pins.gpio0.into_function());
|
||||
```
|
||||
- DHT11
|
||||
```rust
|
||||
let mut dht = Dht11::new(dht_pio, dht_sm, pins.gpio0.into_function());
|
||||
```
|
||||
|
||||
Lire les données:
|
||||
```rust
|
||||
let dht_data = dht.read(&mut delay);
|
||||
```
|
||||
|
||||
NB: `read` retrun un `Result<DhtResult, DhtError>`.
|
||||
|
||||
## Support
|
||||
### Board
|
||||
|
@ -25,7 +44,7 @@ Pour le moment le crates n'a été testé que sur un Raspberry Pico.
|
|||
|
||||
### DHT
|
||||
✅ DHT22
|
||||
❌ DHT11
|
||||
❔ DHT11
|
||||
|
||||
## TODO
|
||||
- [ ] Finir le Readme
|
||||
|
|
Loading…
Reference in a new issue