Skip to content

Commit 72dc796

Browse files
authored
Merge pull request #727 from ckormanyos/more_cleanup
Do some more trivial cleanup
2 parents ab23f54 + 5681ed4 commit 72dc796

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

examples/chapter11_07a/src/app/pi_calc_cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2023 - 2025.
2+
// Copyright Christopher Kormanyos 2023 - 2026.
33
// Distributed under the Boost Software License,
44
// Version 1.0. (See accompanying file LICENSE_1_0.txt
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)

ref_app/target/micros/xtensa_esp32_p4/startup/Code/Appli/main_cores.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ extern "C"
2222
auto main_core1() -> void;
2323
}
2424

25-
auto main(void) -> int __attribute__((used,noinline));
26-
2725
namespace local
2826
{
2927
struct timer_core1_backend
@@ -32,16 +30,6 @@ namespace local
3230

3331
static auto get_now() -> tick_type { return static_cast<tick_type>(mcal::gpt::secure::get_time_elapsed_core1()); }
3432
};
35-
36-
using timer_type = util::timer<std::uint64_t>;
37-
38-
constexpr typename timer_type::tick_type
39-
led_timeout
40-
{
41-
static_cast<typename timer_type::tick_type>(timer_type::seconds(UINT8_C(1)))
42-
};
43-
44-
using timer_core1_type = util::timer<std::uint64_t, timer_core1_backend>;
4533
} // namespace local
4634

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

6452
mcal::gpt::init(nullptr);
6553

66-
local::timer_core1_type local_led_timer(local::led_timeout);
54+
using timer_core1_type = util::timer<std::uint64_t, local::timer_core1_backend>;
55+
56+
constexpr typename timer_core1_type::tick_type
57+
led_core1_timeout
58+
{
59+
static_cast<typename timer_core1_type::tick_type>(timer_core1_type::seconds(UINT8_C(1)))
60+
};
61+
62+
timer_core1_type led_core1_timer(led_core1_timeout);
63+
64+
auto& my_led1_core1_ref { mcal::led::led1() };
6765

68-
auto& my_led1_ref { mcal::led::led1() };
66+
my_led1_core1_ref.toggle();
6967

70-
my_led1_ref.toggle();
68+
// Enter an endless LED1 toggle-loop.
69+
// Never return or break.
7170

72-
// Endless LED1 togglee-loop: Never return or break.
7371
for(;;)
7472
{
75-
if(local_led_timer.timeout())
73+
if(led_core1_timer.timeout())
7674
{
77-
my_led1_ref.toggle();
75+
my_led1_core1_ref.toggle();
7876

79-
local_led_timer.start_interval(local::led_timeout);
77+
led_core1_timer.start_interval(led_core1_timeout);
8078
}
8179
}
8280
}

0 commit comments

Comments
 (0)