Skip to content

Commit

Permalink
Tune up example chapter11_07
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Dec 14, 2024
1 parent 1dacfc7 commit df5a066
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions examples/chapter11_07/src/app/led/app_led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
namespace
{
using app_led_timer_type = util::timer<std::uint32_t>;
using app_led_tick_type = typename app_led_timer_type::tick_type;

app_led_timer_type app_led_timer_background;
app_led_timer_type app_led_timer_toggle_led0;
Expand All @@ -34,7 +35,7 @@ void app_led_task_background(void*)
mcal::cpu::nop();
}

app_led_timer_background.start_interval(app_led_timer_type::milliseconds(50U));
app_led_timer_background.start_interval(app_led_timer_type::milliseconds(app_led_tick_type { UINT8_C(50) }));

mcal::led::led1().toggle();
}
Expand All @@ -43,7 +44,7 @@ void app_led_task_background(void*)
extern "C"
void app_led_task_toggle_led0(void*)
{
// This application task is intended to yield every 70ms. It has higher
// This application task is intended to yield every 125ms. It has higher
// priority than the background task. This task will, in fact, preemptively
// interrupt the lower-priority background task.

Expand All @@ -53,7 +54,7 @@ void app_led_task_toggle_led0(void*)

if(app_led_timer_toggle_led0.timeout())
{
app_led_timer_toggle_led0.start_interval(app_led_timer_type::seconds(1U));
app_led_timer_toggle_led0.start_interval(app_led_timer_type::seconds(app_led_tick_type { UINT8_C(1) }));

mcal::led::led0().toggle();
}
Expand Down
2 changes: 1 addition & 1 deletion examples/chapter11_07/src/sys/start/sys_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace
// Setup the task static resources including the
// task control block structures and task stacks.
OS_TASK_STATIC_RESOURCES(app_led_task_background, 512U);
OS_TASK_STATIC_RESOURCES(app_led_task_toggle_led0, 128U);
OS_TASK_STATIC_RESOURCES(app_led_task_toggle_led0, 32U);
}

#if defined(__AVR__)
Expand Down
8 changes: 4 additions & 4 deletions examples/chapter11_07/target/micros/avr/make/avr.ld
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ _rom_begin = 0x00000000;
_rom_end = 0x00007FFC;

/* The beginning and end (i.e., top) of the stack */
/* Set up a stack with a size of (1/4)K */
_stack_begin = 0x00800800;
/* Set up a the stack */
_stack_begin = 0x00800880;
_stack_end = 0x00800900 - 2;

/* The initial stack pointer (top of stack) is at the top of the 2K RAM */
__initial_stack_pointer = 0x00800900 - 2;

MEMORY
{
ROM(rx) : ORIGIN = 0, LENGTH = 32K - 4
RAM(rw!x) : ORIGIN = 0x00800100, LENGTH = 0x00000800 - 0x00000100
ROM(rx) : ORIGIN = 0, LENGTH = 32K
RAM(rw!x) : ORIGIN = 0x00800100, LENGTH = 0x00000800 - 0x00000080
}

SECTIONS
Expand Down

0 comments on commit df5a066

Please sign in to comment.