mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-10-19 05:57:34 +02:00
Fix symmetric ASCII box alignments, nested inner borders, and table padding in Weeks 9 and 11 and rebuild PDFs
This commit is contained in:
1 parent
eebe45b29b
commit
7f4ef2f144
8 files changed
+41
-41
No files matched your search
+1
-1
@@ -1051,7 +1051,7 @@ The constant `s11` is loaded by the `vldr s11, [pc, #44]` at `0x1000040a`, which
|
||||
| 0.1f = 0x3dcccccd -> bytes cd cc cc 3d |
|
||||
| 5.0f = 0x40a00000 -> bytes 00 00 a0 40 |
|
||||
| |
|
||||
| humidity = int + (decimal * 0.1f) becomes |
|
||||
| humidity = int + (decimal * 0.1f) becomes |
|
||||
| humidity = int + (decimal * 5.0f) |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
|
||||
Binary file not shown.
@@ -630,7 +630,7 @@ The constant `s11` is loaded by the `vldr s11, [pc, #44]` at `0x1000040a`, which
|
||||
| 0.1f = 0x3dcccccd -> bytes cd cc cc 3d |
|
||||
| 5.0f = 0x40a00000 -> bytes 00 00 a0 40 |
|
||||
| |
|
||||
| humidity = int + (decimal * 0.1f) becomes |
|
||||
| humidity = int + (decimal * 0.1f) becomes |
|
||||
| humidity = int + (decimal * 5.0f) |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
|
||||
Binary file not shown.
+2
-2
@@ -457,11 +457,11 @@ Let's trace through what happens to `x`:
|
||||
| ------------------+---------+--------------------------------- |
|
||||
| int x = 5; | 5 | x initialized to 5 |
|
||||
| x * y | 5 | arithmetic = 5 * 10 = 50 |
|
||||
| x++ | 5->6 | increment = 5 (then x becomes 6)|
|
||||
| x++ | 5->6 | increment = 5 (then x becomes 6) |
|
||||
| x > y | 6 | relational = (6 > 10) = false |
|
||||
| (x>y) && (y>x) | 6 | logical = false && true = false |
|
||||
| x << 1 | 6 | bitwise = 6 << 1 = 12 |
|
||||
| x += 5 | 6->11 | assignment = 6 + 5 = 11 |
|
||||
| x += 5 | 6->11 | assignment = 6 + 5 = 11 |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
```
|
||||
|
||||
Binary file not shown.
+37
-37
@@ -55,17 +55,17 @@ typedef struct {
|
||||
| Structure as a Container |
|
||||
| |
|
||||
| simple_led_ctrl_t leds |
|
||||
| +-------------------------------------------------------------+|
|
||||
| | led1_pin: 16 led2_pin: 17 led3_pin: 18 ||
|
||||
| | +--------+ +--------+ +--------+ ||
|
||||
| | | 16 | | 17 | | 18 | ||
|
||||
| | +--------+ +--------+ +--------+ ||
|
||||
| | ||
|
||||
| | led1_state: false led2_state: false led3_state: false ||
|
||||
| | +--------+ +--------+ +--------+ ||
|
||||
| | | false | | false | | false | ||
|
||||
| | +--------+ +--------+ +--------+ ||
|
||||
| +-------------------------------------------------------------+|
|
||||
| +-------------------------------------------------------------+ |
|
||||
| | led1_pin: 16 led2_pin: 17 led3_pin: 18 | |
|
||||
| | +--------+ +--------+ +--------+ | |
|
||||
| | | 16 | | 17 | | 18 | | |
|
||||
| | +--------+ +--------+ +--------+ | |
|
||||
| | | |
|
||||
| | led1_state: false led2_state: false led3_state: false | |
|
||||
| | +--------+ +--------+ +--------+ | |
|
||||
| | | false | | false | | false | | |
|
||||
| | +--------+ +--------+ +--------+ | |
|
||||
| +-------------------------------------------------------------+ |
|
||||
| |
|
||||
| All 6 members live together as ONE variable called "leds" |
|
||||
| |
|
||||
@@ -277,19 +277,19 @@ int result = add_numbers(5, 3); // result = 8
|
||||
| } |
|
||||
| |
|
||||
| Example: |
|
||||
| +-------------------------------------------------------------+|
|
||||
| | int ir_to_led_number ( int ir_command ) { ||
|
||||
| | --- --------------- --------------- ||
|
||||
| | | | | ||
|
||||
| | | | +-- Parameter (input) ||
|
||||
| | | +-- Function name ||
|
||||
| | +-- Return type (what it gives back) ||
|
||||
| | ||
|
||||
| | if (ir_command == 0x0C) return 1; <-- Body ||
|
||||
| | if (ir_command == 0x18) return 2; ||
|
||||
| | return 0; <-- Return value ||
|
||||
| | } ||
|
||||
| +-------------------------------------------------------------+|
|
||||
| +-------------------------------------------------------------+ |
|
||||
| | int ir_to_led_number ( int ir_command ) { | |
|
||||
| | --- --------------- --------------- | |
|
||||
| | | | | | |
|
||||
| | | | +-- Parameter (input) | |
|
||||
| | | +-- Function name | |
|
||||
| | +-- Return type (what it gives back) | |
|
||||
| | | |
|
||||
| | if (ir_command == 0x0C) return 1; <-- Body | |
|
||||
| | if (ir_command == 0x18) return 2; | |
|
||||
| | return 0; <-- Return value | |
|
||||
| | } | |
|
||||
| +-------------------------------------------------------------+ |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
```
|
||||
@@ -380,23 +380,23 @@ bl gpio_init ; call gpio_init(18)
|
||||
| Struct Flattening |
|
||||
| |
|
||||
| C Level (High-level abstraction): |
|
||||
| +-------------------------------------------------------------+|
|
||||
| | gpio_init(leds.led1_pin); ||
|
||||
| | gpio_init(leds.led2_pin); ||
|
||||
| | gpio_init(leds.led3_pin); ||
|
||||
| +-------------------------------------------------------------+|
|
||||
| +-------------------------------------------------------------+ |
|
||||
| | gpio_init(leds.led1_pin); | |
|
||||
| | gpio_init(leds.led2_pin); | |
|
||||
| | gpio_init(leds.led3_pin); | |
|
||||
| +-------------------------------------------------------------+ |
|
||||
| | |
|
||||
| | Compiler transforms |
|
||||
| v |
|
||||
| Assembly Level (Flattened): |
|
||||
| +-------------------------------------------------------------+|
|
||||
| | movs r0, #16 ; Just the VALUE, no struct reference ||
|
||||
| | bl gpio_init ||
|
||||
| | movs r0, #17 ; Next value directly ||
|
||||
| | bl gpio_init ||
|
||||
| | movs r0, #18 ; Next value directly ||
|
||||
| | bl gpio_init ||
|
||||
| +-------------------------------------------------------------+|
|
||||
| +-------------------------------------------------------------+ |
|
||||
| | movs r0, #16 ; Just the VALUE, no struct reference | |
|
||||
| | bl gpio_init | |
|
||||
| | movs r0, #17 ; Next value directly | |
|
||||
| | bl gpio_init | |
|
||||
| | movs r0, #18 ; Next value directly | |
|
||||
| | bl gpio_init | |
|
||||
| +-------------------------------------------------------------+ |
|
||||
| |
|
||||
| The struct abstraction DISAPPEARS at the assembly level! |
|
||||
| We just see individual values being loaded and used. |
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user