Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docs for a few more memory mappings #1232

Merged
merged 2 commits into from
Feb 16, 2023
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
5 changes: 4 additions & 1 deletion docs/functional-areas/memory-subsystem/MEM_TYPE_EEPROM.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ title: EEPROM - MEM_TYPE_EEPROM
page_id: mem_type_eeprom
---

TBD
This memory is mapped to the EEPROM in the Crazyflie and supports both read and write operations.

This mapping enables direct access to the EEPRIM memory, including writing without any checks. Writing may corrupt
data structures in the memory.
43 changes: 42 additions & 1 deletion docs/functional-areas/memory-subsystem/MEM_TYPE_LED12.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,45 @@ title: LED ring - MEM_TYPE_LED12
page_id: mem_type_led12
---

TBD
This memory is mapped to the color/brightness of the LEDs on the LED-ring and supports both read and write operations.

The color/brightness is set using the RGB565 format (2 bytes) and the LEDs are mapped after each other. The number
of LEDs is defined by the `CONFIG_DECK_LEDRING_NBR_LEDS` kbuild flag (12 by default) and the last LED will be mapped to address
`(CONFIG_DECK_LEDRING_NBR_LEDS - 1) * 2`.

| Address | Type | LED |
|-----------------------------------------|----------------|----------------------------------|
| 0 | color (RGB565) | 0 |
| 2 | color (RGB565) | 1 |
| 4 | color (RGB565) | 2 |
| ... | color (RGB565) | ... |
| (CONFIG_DECK_LEDRING_NBR_LEDS - 1) * 2 | color (RGB565) | CONFIG_DECK_LEDRING_NBR_LEDS - 1 |

### RGB565

Red, green and blue are encoded using 5, 6 and 5 bits, adding up to a total of 16 bits (2 bytes).

{% ditaa --alt "Example diagram" %}
5 bits 6 bits 5 bits

/-----------+-------------+-----------\
| cRED | cGRE | cBLU |
| Red | Green | Blue |
| R5 | G6 | B5 |
| | | |
\-----------+-------------+-----------/
{% endditaa %}

The encoded values can be converted to 8 bit values (RGB565 to RGB888) like this:
``` C
R8 = (R5 * 527 + 23) >> 6;
G8 = (G6 * 259 + 33) >> 6;
B8 = (B5 * 527 + 23) >> 6;
```

and the other way around, RGB888 to RGB565:
``` C
R5 = ((R8 << 6) - 23) / 527;
G5 = ((G8 << 6) - 33) / 259;
B5 = ((B8 << 6) - 23) / 527;
```
6 changes: 0 additions & 6 deletions docs/functional-areas/memory-subsystem/MEM_TYPE_LEDMEM.md

This file was deleted.

6 changes: 0 additions & 6 deletions docs/functional-areas/memory-subsystem/MEM_TYPE_OW.md

This file was deleted.

8 changes: 7 additions & 1 deletion docs/functional-areas/memory-subsystem/MEM_TYPE_TESTER.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ title: Test - MEM_TYPE_TESTER
page_id: mem_type_tester
---

TBD
This memory mapping is used for testing.

Reading from the memory returns the lower 8 bits of the address, for instance reading address 0x0017 will return
0x17, and reading from address 0x4711 will return 0x11

The same pattern is expected when writing to the memory and if the written data is not correct, a message will be
written to the console log.
4 changes: 3 additions & 1 deletion docs/functional-areas/memory-subsystem/MEM_TYPE_TRAJ.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ title: Trajectory - MEM_TYPE_TRAJ
page_id: mem_type_traj
---

TBD
The trajectory memory is mapped directly to the memory used by [the high level commander](/docs/functional-areas/sensor-to-control/commanders_setpoints/#high-level-commander)
to store trajectories. The format is described in the [trajectory formats](/docs/functional-areas/trajectory_formats.md)
section.
4 changes: 3 additions & 1 deletion docs/functional-areas/memory-subsystem/MEM_TYPE_USD.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ title: uSD card - MEM_TYPE_USD
page_id: mem_type_usd
---

TBD
The uSD card memory mapping can be used to read data from the SD card, write operations are not supported.

Reads are mapped to the current file, and only works if the logging is stopped.