diff --git a/.gitignore b/.gitignore index 5dfa47ff8..42afe5c44 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ ref_app/target.vcxproj.user ref_app/tmp/ ref_app/x64 ref_app/bin/ +examples/chapter*/bin diff --git a/examples/chapter09_07/images/seven_segment.png b/examples/chapter09_07/images/seven_segment.png new file mode 100644 index 000000000..6bdb3eea8 Binary files /dev/null and b/examples/chapter09_07/images/seven_segment.png differ diff --git a/examples/chapter09_07/readme.md b/examples/chapter09_07/readme.md index 5e74d2ac2..ae31430e4 100644 --- a/examples/chapter09_07/readme.md +++ b/examples/chapter09_07/readme.md @@ -1,4 +1,5 @@ # Example Chapter09_07 + ## Controlling a Seven Segment Display Example chapter09_07 makes use of object oriented @@ -8,20 +9,20 @@ programming methods to control a seven segment display. In this example, port pins are used to control a seven segment single-character display. As in most other examples, -both a hardware version for the target system as well as a simlulated +both a hardware version for the target system as well as a simulated PC version are available. The PC version writes its character to the output console. ## Application Description -The sixteen hexadecimal digits +The sixteen hexadecimal digits $0123456789AbCdEF$ are displayed sequentially, one digit per second. The dot (_i_._e_., period or decimal point) is toggled on and off for successive groups of 16 hexadecimal digits. The user LED is simultaneously toggled at the usual $\frac{1}{2}~\text{Hz}$. The application task is intuitive and easy to understand. -The followind code snippet from the application task +The following code snippet from the application task `app::display::task_func`, for instance, depicts the control responsible for writing the character digit and decimal point on the seven segment display. The user LED is simultaneously @@ -70,10 +71,10 @@ portable application layer code. The screenshot below shows the PC simulation of the display application task running in a console. -![](./images/seven_segment.pdf) +![screenshot of PC simulation](./images/seven_segment.png) ## Hardware Setup The hardware setup is shown in the image below. -![](./images/board7.jpg) +![hardware setup](./images/board7.jpg) diff --git a/examples/chapter09_08/readme.md b/examples/chapter09_08/readme.md index ca6372bb5..6091064b4 100644 --- a/examples/chapter09_08/readme.md +++ b/examples/chapter09_08/readme.md @@ -1,4 +1,5 @@ # Example Chapter09_08 + ## Controlling an RGB LED Example chapter09_08 utilizes object oriented programming techniques @@ -14,7 +15,7 @@ an underlying tick derived from a timer interrupt that runs every $50~{\mu}\text{s}$. In this example (as in most other examples), both a hardware -version for the target system as well as a simlulated PC +version for the target system as well as a simulated PC version are available. For this exercise, it was decided to implement a rather detailed PC simulation using old-school traditional Win32-API programming. @@ -30,4 +31,4 @@ The user LED is simultaneously toggled at the usual $\frac{1}{2}~\text{Hz}$. The chapter09_08 Win32-API simulation in its Windows-based application is shown in action in the image below. -![](./images/rgb_led_wnd_09_08.jpg) +![Capture of Win32-API simulation](./images/rgb_led_wnd_09_08.jpg) diff --git a/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome.cpp b/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome.cpp index fe7417bea..0f1f2d856 100644 --- a/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome.cpp +++ b/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome.cpp @@ -12,10 +12,10 @@ util::device::led_monochrome& mcal::led::led_monochrome0() { - using local_led_mponochrome_type = - mcal::led::led_momochrome_board; + using local_led_monochrome_type = + mcal::led::led_monochrome_board; - static local_led_mponochrome_type the_led { }; + static local_led_monochrome_type the_led { }; return the_led; } diff --git a/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome_board.h b/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome_board.h index bab49d824..02159387a 100644 --- a/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome_board.h +++ b/examples/chapter09_08/src/mcal/avr/mcal_led_monochrome_board.h @@ -19,10 +19,10 @@ { template - class led_momochrome_board final : public util::device::led_monochrome + class led_monochrome_board final : public util::device::led_monochrome { public: - led_momochrome_board() + led_monochrome_board() { // Set the port pin value to low. port_pin_type::set_pin_low(); @@ -31,7 +31,7 @@ port_pin_type::set_direction_output(); } - ~led_momochrome_board() override = default; + ~led_monochrome_board() override = default; auto my_on() -> void override { diff --git a/examples/chapter09_08a/readme.md b/examples/chapter09_08a/readme.md index 06cc6dfee..368bc7748 100644 --- a/examples/chapter09_08a/readme.md +++ b/examples/chapter09_08a/readme.md @@ -1,4 +1,5 @@ # Example Chapter09_08a + ## Controlling an RGB LED of type ws2812 Example chapter09_08a utilizes object oriented programming techniques @@ -18,7 +19,7 @@ color bits is set to the value $1$ or $0$ depending on the half-width of a low/high signal pair. In this example (as in most other examples), both a hardware -version for the target system as well as a simlulated PC +version for the target system as well as a simulated PC version are available. For this exercise, it was decided to implement a rather detailed PC simulation using old-school traditional Win32-API programming. @@ -52,7 +53,7 @@ These very specific mcal/microcontroller-dependent parameters are used to generate the real-time ws2812 control signal. The third template parameter `LedCount` provides the ability -to link multiple ws2812 devices seqentially and control them +to link multiple ws2812 devices sequentially and control them in an LED chain, as is common for this particular device. In example chapter09_08a, a ws2812 LED device is used. @@ -62,7 +63,7 @@ In example chapter09_08a, a ws2812 LED device is used. The RGB-color-light-show in example chapter09_08a (this example) differs slightly from the one in example chapter09_08 (the previous example). -In this example the color transitions are a bit lenghtier in time +In this example the color transitions are a bit lengthier in time (instead of the normal $20~\text{ms}$). Also the color transitions at and around the points $255~\text{bits}$-RGB have been lengthened in time. This results in color emphasis @@ -76,7 +77,7 @@ This enhanced RGB-color-light-show can be found in the file The chapter09_08a Win32-API simulation in its Windows-based application is shown in action in the image below. -![](./images/rgb_led_wnd_09_08a.jpg) +![Capture of Windows simulation](./images/rgb_led_wnd_09_08a.jpg) ## Hardware Setup @@ -85,23 +86,23 @@ ARDUINO(R) placed on a breadboard with soldered-on pins. The wiring is straightforward. The ws2812 port control uses port pin `portd.3`. The hardware setup with the RGB LED in action is pictured -in the images below. The pictures show colorful RGB hues eminating +in the images below. The pictures show colorful RGB hues emanating from the bright RGB LED of type ws2812. -![](./images/board09_08a_01r.jpg) -![](./images/board09_08a_02g.jpg) -![](./images/board09_08a_03b.jpg) +![Hardware setup - magenta hue emanating from LED](./images/board09_08a_01r.jpg) +![Hardware setup - green hue emanating from LED](./images/board09_08a_02g.jpg) +![Hardware setup - cyan hue emanating from LED](./images/board09_08a_03b.jpg) ### Bit Timing: ws2812 The approximate bit timing needed by the ws2812 is shown in the following table. | Bit Value | $T_{hi}~\left[{ns}\right]$ | $T_{lo}~\left[{ns}\right]$ | -| --------- | --------------- | --------------- | -| $0$ | $350$ | $800$ | -| $1$ | $700$ | $600$ | +| --------- | -------------------------- | -------------------------- | +| $0$ | $350$ | $800$ | +| $1$ | $700$ | $600$ | A sample partial-trace of the control signal on `portd.3` is shown -below in a representation of an image from a digital oscilloscpoe. +below in a representation of an image from a digital oscilloscope. -![](./images/ws2812_signal.jpg) +![View of trace captured on digital oscilloscope](./images/ws2812_signal.jpg) diff --git a/examples/chapter09_08b/readme.md b/examples/chapter09_08b/readme.md index 3fdb1d35b..353560c85 100644 --- a/examples/chapter09_08b/readme.md +++ b/examples/chapter09_08b/readme.md @@ -1,4 +1,5 @@ # Example Chapter09_08b (variation 32-bit microcontroller) + ## Controlling an RGB LED of type ws2812 Example chapter09_08b utilizes essentially the same techniques @@ -20,7 +21,7 @@ A logic-AND gate shifts the microcontroller pin's voltage level. The microcontroller is clocked at $24~\text{MHz}$. The hardware setup with the RGB LED in action is pictured -in the image below. The pictures depicts a pink hue eminating +in the image below. The pictures depicts a pink hue emanating from the bright RGB LED of type ws2812B. -![](./images/board09_08b.jpg) +![Hardware setup - pink hue emanating from LED](./images/board09_08b.jpg)