1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 12:42:30 +04:00

Documentation: new doc on Storage module and JS cleanup (#4161)

- Add new doc on Storage module
- Improve formatting in the JS section for better readability
This commit is contained in:
knrn64
2025-03-26 17:29:26 +03:00
committed by GitHub
parent 02dedd60f3
commit 54adc38b3a
17 changed files with 898 additions and 298 deletions

View File

@@ -21,21 +21,26 @@ led.write(false);
delay(1000);
```
---
# API reference
## `get`
## get
Gets a `Pin` object that can be used to manage a pin.
### Parameters
**Parameters**
- `pin`: pin identifier (examples: `"pc3"`, `7`, `"pa6"`, `3`)
### Returns
**Returns**
A `Pin` object.
## `Pin` object
### `Pin.init()`
<br>
## Pin object
### Pin.init()
Configures a pin.
#### Parameters
**Parameters**
- `mode`: `Mode` object:
- `direction` (required): either `"in"` or `"out"`
- `outMode` (required for `direction: "out"`): either `"open_drain"` or
@@ -46,30 +51,41 @@ Configures a pin.
`"rising"`, `"falling"` or `"both"`
- `pull` (optional): either `"up"`, `"down"` or unset
### `Pin.write()`
<br>
### Pin.write()
Writes a digital value to a pin configured with `direction: "out"`.
#### Parameters
**Parameters**
- `value`: boolean logic level to write
### `Pin.read()`
<br>
### Pin.read()
Reads a digital value from a pin configured with `direction: "in"` and any
`inMode` except `"analog"`.
#### Returns
Boolean logic level
**Returns**
### `Pin.readAnalog()`
Boolean logic level.
<br>
### Pin.readAnalog()
Reads an analog voltage level in millivolts from a pin configured with
`direction: "in"` and `inMode: "analog"`.
#### Returns
**Returns**
Voltage on pin in millivolts.
### `Pin.interrupt()`
<br>
### Pin.interrupt()
Attaches an interrupt to a pin configured with `direction: "in"` and
`inMode: "interrupt"` or `"event"`.
#### Returns
**Returns**
An event loop `Contract` object that identifies the interrupt event source. The
event does not produce any extra data.