Skip to content

Commit

Permalink
Initial update example chapter04_04
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Feb 25, 2024
1 parent e536af1 commit f09c2b6
Show file tree
Hide file tree
Showing 99 changed files with 7,080 additions and 2,742 deletions.
74 changes: 62 additions & 12 deletions examples/chapter04_04/chapter04_04.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -232,19 +232,11 @@
<ClCompile Include="src\os\os_task_control_block.cpp" />
<ClCompile Include="src\sys\idle\sys_idle.cpp" />
<ClCompile Include="src\sys\start\sys_start.cpp" />
<ClCompile Include="src\util\STD_LIBC\memory.cpp">
<ClCompile Include="src\util\STD_LIBC\memory.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\util\STL\impl\avr\avr_float_limits.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\util\STL\impl\cmath_impl_gamma.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="src\util\STL\impl\cmath_impl_hyperbolic.cpp">
<ClCompile Include="src\util\STL\impl\avr\avr_hardware_random_device.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
Expand Down Expand Up @@ -335,6 +327,7 @@
<ClInclude Include="src\mcal\host\mcal_wdg.h" />
<ClInclude Include="src\mcal\host\mcal_wdg_watchdog.h" />
<ClInclude Include="src\mcal\mcal.h" />
<ClInclude Include="src\mcal\mcal_helper.h" />
<ClInclude Include="src\mcal\mcal_reg_access_dynamic.h" />
<ClInclude Include="src\mcal\mcal_reg_access_static.h" />
<ClInclude Include="src\mcal_led\mcal_led_base.h" />
Expand All @@ -351,23 +344,33 @@
<ClInclude Include="src\mcal_pwm\mcal_pwm_base.h" />
<ClInclude Include="src\mcal_pwm\mcal_pwm_console.h" />
<ClInclude Include="src\mcal_pwm\mcal_pwm_dummy.h" />
<ClInclude Include="src\mcal_pwm\mcal_pwm_port.h" />
<ClInclude Include="src\mcal_spi\mcal_spi_software_dummy.h" />
<ClInclude Include="src\mcal_spi\mcal_spi_software_port_driver.h" />
<ClInclude Include="src\os\os.h" />
<ClInclude Include="src\os\os_cfg.h" />
<ClInclude Include="src\os\os_task_control_block.h" />
<ClInclude Include="src\util\memory\util_factory.h" />
<ClInclude Include="src\util\memory\util_n_slot_array_allocator.h" />
<ClInclude Include="src\util\memory\util_placed_pointer.h" />
<ClInclude Include="src\util\memory\util_ring_allocator.h" />
<ClInclude Include="src\util\memory\util_static_allocator.h" />
<ClInclude Include="src\util\STL\impl\allocator_impl.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="src\util\STL\impl\alloc_traits.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="src\util\STL\impl\avr\avr_atomic.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="src\util\STL\impl\ptr_traits.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="src\util\STL\impl\stl_local_constexpr.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand All @@ -386,18 +389,22 @@
</ClInclude>
<ClInclude Include="src\util\STL_C++XX_stdfloat\stdfloat.h" />
<ClInclude Include="src\util\utility\util_alignas.h" />
<ClInclude Include="src\util\utility\util_baselexical_cast.h" />
<ClInclude Include="src\util\utility\util_bit_mask.h" />
<ClInclude Include="src\util\utility\util_circular_buffer.h" />
<ClInclude Include="src\util\utility\util_communication.h" />
<ClInclude Include="src\util\utility\util_constexpr_algorithm_unsafe.h" />
<ClInclude Include="src\util\utility\util_constexpr_cmath_unsafe.h" />
<ClInclude Include="src\util\utility\util_countof.h" />
<ClInclude Include="src\util\utility\util_display.h" />
<ClInclude Include="src\util\utility\util_dynamic_array.h" />
<ClInclude Include="src\util\utility\util_dynamic_bitset.h" />
<ClInclude Include="src\util\utility\util_linear_interpolate.h" />
<ClInclude Include="src\util\utility\util_narrow_cast.h" />
<ClInclude Include="src\util\utility\util_noexcept.h" />
<ClInclude Include="src\util\utility\util_noncopyable.h" />
<ClInclude Include="src\util\utility\util_nothing.h" />
<ClInclude Include="src\util\utility\util_point.h" />
<ClInclude Include="src\util\utility\util_random_pcg32.h" />
<ClInclude Include="src\util\utility\util_stopwatch.h" />
<ClInclude Include="src\util\utility\util_swdm.h" />
<ClInclude Include="src\util\utility\util_time.h" />
Expand All @@ -409,7 +416,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\any" />
<None Include="src\util\STL\any">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\array">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand All @@ -422,14 +432,38 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\bitset">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\cassert">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\cerrno">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\cfloat">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\charconv">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\chrono">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\cinttypes">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\ciso646">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\climits">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -458,6 +492,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\cstring">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\ctime">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand Down Expand Up @@ -486,10 +524,22 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\random">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\ratio">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\span">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\stdexcept">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="src\util\STL\string">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand Down
77 changes: 64 additions & 13 deletions examples/chapter04_04/chapter04_04.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@
<ClCompile Include="src\mcal\mcal_gcc_cxx_completion.cpp">
<Filter>src\mcal</Filter>
</ClCompile>
<ClCompile Include="src\util\STL\impl\avr\avr_float_limits.cpp">
<Filter>src\util\STL\impl\avr</Filter>
</ClCompile>
<ClCompile Include="src\util\STD_LIBC\memory.cpp">
<Filter>src\util\STD_LIBC</Filter>
</ClCompile>
<ClCompile Include="src\app\led\app_led.cpp">
<Filter>src\app\led</Filter>
</ClCompile>
Expand Down Expand Up @@ -165,11 +159,11 @@
<ClCompile Include="src\mcal\host\mcal_eep.cpp">
<Filter>src\mcal\host</Filter>
</ClCompile>
<ClCompile Include="src\util\STL\impl\cmath_impl_gamma.cpp">
<Filter>src\util\STL\impl</Filter>
<ClCompile Include="src\util\STD_LIBC\memory.c">
<Filter>src\util\STD_LIBC</Filter>
</ClCompile>
<ClCompile Include="src\util\STL\impl\cmath_impl_hyperbolic.cpp">
<Filter>src\util\STL\impl</Filter>
<ClCompile Include="src\util\STL\impl\avr\avr_hardware_random_device.cpp">
<Filter>src\util\STL\impl\avr</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -293,9 +287,6 @@
<ClInclude Include="src\util\utility\util_point.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_random_pcg32.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_stopwatch.h">
<Filter>src\util\utility</Filter>
</ClInclude>
Expand Down Expand Up @@ -425,6 +416,36 @@
<ClInclude Include="src\util\STL\impl\xcmath_impl.h">
<Filter>src\util\STL\impl</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_constexpr_algorithm_unsafe.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_constexpr_cmath_unsafe.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_display.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_narrow_cast.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\utility\util_baselexical_cast.h">
<Filter>src\util\utility</Filter>
</ClInclude>
<ClInclude Include="src\util\memory\util_n_slot_array_allocator.h">
<Filter>src\util\memory</Filter>
</ClInclude>
<ClInclude Include="src\util\STL\impl\alloc_traits.h">
<Filter>src\util\STL\impl</Filter>
</ClInclude>
<ClInclude Include="src\util\STL\impl\ptr_traits.h">
<Filter>src\util\STL\impl</Filter>
</ClInclude>
<ClInclude Include="src\mcal\mcal_helper.h">
<Filter>src\mcal</Filter>
</ClInclude>
<ClInclude Include="src\mcal_pwm\mcal_pwm_port.h">
<Filter>src\mcal_pwm</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="src\util\STL\algorithm">
Expand Down Expand Up @@ -511,5 +532,35 @@
<None Include="src\util\STL\any">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\bitset">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\cassert">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\cerrno">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\charconv">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\cinttypes">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\ciso646">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\cstring">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\random">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\span">
<Filter>src\util\STL</Filter>
</None>
<None Include="src\util\STL\stdexcept">
<Filter>src\util\STL</Filter>
</None>
</ItemGroup>
</Project>
Binary file removed examples/chapter04_04/libwinpthread-1.dll
Binary file not shown.
5 changes: 3 additions & 2 deletions examples/chapter04_04/src/mcal/avr/mcal_pwm_timer1.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
{
private:
using base_class_type = mcal::pwm::pwm_base;
using base_class_type::duty_type;

public:
pwm_timer1() = default;
Expand Down Expand Up @@ -97,11 +98,11 @@
{
// Set the duty cycle 0...1000.

base_class_type::my_duty_cycle = (std::min)(duty_cycle, std::uint16_t(UINT16_C(1000)));
base_class_type::set_duty((std::min)(duty_cycle, duty_type(UINT16_C(1000))));

mcal::reg::reg_access_dynamic<std::uint8_t,
std::uint16_t>::reg_set(mcal::reg::ocr1a,
base_class_type::my_duty_cycle);
base_class_type::get_duty());
}
};

Expand Down
5 changes: 2 additions & 3 deletions examples/chapter04_04/src/mcal/mcal.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2019.
// Copyright Christopher Kormanyos 2007 - 2023.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand All @@ -23,8 +23,7 @@ void mcal::init()
mcal::ser::init(nullptr);
mcal::spi::init(nullptr);
mcal::pwm::init(nullptr);
mcal::eep::init(nullptr);

mcal::cpu::post_init();

mcal::eep::init(nullptr);
}
2 changes: 1 addition & 1 deletion examples/chapter04_04/src/mcal/mcal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2019.
// Copyright Christopher Kormanyos 2007 - 2023.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
Expand Down
Loading

0 comments on commit f09c2b6

Please sign in to comment.