mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-24 14:58:09 +00:00
Update beginner/README.md
Co-authored-by: Lotte Steenbrink <lotte@zombietetris.de>
This commit is contained in:
parent
e64576a126
commit
9c32bafa05
1 changed files with 2 additions and 1 deletions
|
@ -323,7 +323,8 @@ received 5 bytes (LQI=49)
|
|||
|
||||
The program broadcasts a radio packet that contains the 5-byte string `Hello` over channel 20 (which has a center frequency of 2450 MHz). The `loopback` program running on the Dongle is listening to all packets sent over channel 20; every time it receives a new packet it reports its length and the Link Quality Indicator (LQI) metric of the transmission over the USB/serial interface. As the name implies the LQI metric indicates how good the connection between the sender and the device is.
|
||||
|
||||
*Important note* about `b"Hello"` vs `"Hello"`. The first one is a *byte* string literal value that has type `&[u8; N]`; the second one is a *string* literal value that has type `&str` (`str` is Rust string type). The latter type, `str`, must always be valid UTF-8 data. The former type, `&[u8; N]`, does not place any constraint on its contents. However, the byte string literal syntax (`b".."`) will only accept *non-escaped* characters in the ASCII range (`0x00`..=`0x7F`) so it can *not* contain CJK (Chinese Japanese Korean) characters or emoji for example. String literals (`".."`) can contain any valid UTF-8 content so they can contain CJK characters, emoji, Greek letters, Cyrillic script, etc.
|
||||
### Character constrains in byte string vs.string literals
|
||||
You can encode text as `b"Hello"` or as `"Hello"`. `b"Hello"` is a *byte* string literal value that has type `&[u8; N]`; while `"Hello"` is a *string* literal value that has type `&str` (`str` is Rust string type). `str` must always be valid UTF-8 data. The former type, `&[u8; N]`, does not place any constraint on its contents. However, the byte string literal syntax (`b".."`) will only accept *non-escaped* characters in the ASCII range (`0x00`..=`0x7F`) so it can *not* contain CJK (Chinese Japanese Korean) characters or emoji for example. String literals (`".."`) can contain any valid UTF-8 content so they can contain CJK characters, emoji, Greek letters, Cyrillic script, etc.
|
||||
|
||||
Now run the `radio-send` program several times with different variations:
|
||||
|
||||
|
|
Loading…
Reference in a new issue