From 4606c50576ef7c7a8c6938c1e2d5c8fd7742f6ee Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Thu, 16 Feb 2023 13:50:59 +0100 Subject: [PATCH 1/2] Add docs for a few more memory mappings --- .../memory-subsystem/MEM_TYPE_EEPROM.md | 5 ++- .../memory-subsystem/MEM_TYPE_LED12.md | 43 ++++++++++++++++++- .../memory-subsystem/MEM_TYPE_TESTER.md | 8 +++- .../memory-subsystem/MEM_TYPE_TRAJ.md | 4 +- .../memory-subsystem/MEM_TYPE_USD.md | 4 +- 5 files changed, 59 insertions(+), 5 deletions(-) diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_EEPROM.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_EEPROM.md index ea67e188ee..34d7832949 100644 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_EEPROM.md +++ b/docs/functional-areas/memory-subsystem/MEM_TYPE_EEPROM.md @@ -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. diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_LED12.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_LED12.md index 0bcc6c25aa..016c2e3dc7 100644 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_LED12.md +++ b/docs/functional-areas/memory-subsystem/MEM_TYPE_LED12.md @@ -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; +``` diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_TESTER.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_TESTER.md index 52e858c17b..fe39527b81 100644 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_TESTER.md +++ b/docs/functional-areas/memory-subsystem/MEM_TYPE_TESTER.md @@ -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. diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_TRAJ.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_TRAJ.md index f372dfb396..a879d4ef9f 100644 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_TRAJ.md +++ b/docs/functional-areas/memory-subsystem/MEM_TYPE_TRAJ.md @@ -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. diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_USD.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_USD.md index 1af849292d..e11b8a051c 100644 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_USD.md +++ b/docs/functional-areas/memory-subsystem/MEM_TYPE_USD.md @@ -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. From 9bfd7e9558c5f92c2d0e0129569b3b625feb89b4 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Thu, 16 Feb 2023 14:51:37 +0100 Subject: [PATCH 2/2] Removed undocumented memory types --- docs/functional-areas/memory-subsystem/MEM_TYPE_LEDMEM.md | 6 ------ docs/functional-areas/memory-subsystem/MEM_TYPE_OW.md | 6 ------ 2 files changed, 12 deletions(-) delete mode 100644 docs/functional-areas/memory-subsystem/MEM_TYPE_LEDMEM.md delete mode 100644 docs/functional-areas/memory-subsystem/MEM_TYPE_OW.md diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_LEDMEM.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_LEDMEM.md deleted file mode 100644 index ba3d89d87c..0000000000 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_LEDMEM.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: LED ring timing - MEM_TYPE_LEDMEM -page_id: mem_type_ledmem ---- - -TBD diff --git a/docs/functional-areas/memory-subsystem/MEM_TYPE_OW.md b/docs/functional-areas/memory-subsystem/MEM_TYPE_OW.md deleted file mode 100644 index d17ed34b62..0000000000 --- a/docs/functional-areas/memory-subsystem/MEM_TYPE_OW.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: One wire memory - MEM_TYPE_OW -page_id: mem_type_ow ---- - -TBD