Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/chapter11_07a/src/app/pi_calc_cfg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2023 - 2025.
// Copyright Christopher Kormanyos 2023 - 2026.
// 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ extern "C"
auto main_core1() -> void;
}

auto main(void) -> int __attribute__((used,noinline));

namespace local
{
struct timer_core1_backend
Expand All @@ -32,16 +30,6 @@ namespace local

static auto get_now() -> tick_type { return static_cast<tick_type>(mcal::gpt::secure::get_time_elapsed_core1()); }
};

using timer_type = util::timer<std::uint64_t>;

constexpr typename timer_type::tick_type
led_timeout
{
static_cast<typename timer_type::tick_type>(timer_type::seconds(UINT8_C(1)))
};

using timer_core1_type = util::timer<std::uint64_t, timer_core1_backend>;
} // namespace local

extern "C"
Expand All @@ -63,20 +51,30 @@ auto main_core1() -> void

mcal::gpt::init(nullptr);

local::timer_core1_type local_led_timer(local::led_timeout);
using timer_core1_type = util::timer<std::uint64_t, local::timer_core1_backend>;

constexpr typename timer_core1_type::tick_type
led_core1_timeout
{
static_cast<typename timer_core1_type::tick_type>(timer_core1_type::seconds(UINT8_C(1)))
};

timer_core1_type led_core1_timer(led_core1_timeout);

auto& my_led1_core1_ref { mcal::led::led1() };

auto& my_led1_ref { mcal::led::led1() };
my_led1_core1_ref.toggle();

my_led1_ref.toggle();
// Enter an endless LED1 toggle-loop.
// Never return or break.

// Endless LED1 togglee-loop: Never return or break.
for(;;)
{
if(local_led_timer.timeout())
if(led_core1_timer.timeout())
{
my_led1_ref.toggle();
my_led1_core1_ref.toggle();

local_led_timer.start_interval(local::led_timeout);
led_core1_timer.start_interval(led_core1_timeout);
}
}
}
Loading