File tree Expand file tree Collapse file tree 4 files changed +6205
-63700
lines changed
Expand file tree Collapse file tree 4 files changed +6205
-63700
lines changed Original file line number Diff line number Diff line change 55// or copy at http://www.boost.org/LICENSE_1_0.txt)
66//
77
8+ #include " R7FA4M1AB.h"
9+
810#include < mcal_led.h>
911#include < mcal_led/mcal_led_port.h>
1012
11- mcal::led::led_base& mcal::led::led0 ()
13+ class led_minima_blinky : public mcal ::led::led_boolean_state_base
1214{
13- using led0_port_type = mcal::port::port_pin<UINT32_C (5 )>;
15+ public:
16+ led_minima_blinky ()
17+ {
18+ /* configure pin P111 as output */
19+ /* disable register write protection for PFS*/
20+ PMISC->PWPR .bit .B0WI = 0 ;
21+ PMISC->PWPR .bit .PFSWE = 1 ;
22+
23+ /* output low */
24+ PFS->P111PFS .bit .PODR = 0 ;
25+
26+ /* configure the pin as output */
27+ PFS->P111PFS .bit .PDR = 1 ;
28+ }
29+
30+ ~led_minima_blinky () override = default ;
1431
15- using led0_led_type = mcal::led::led_port<led0_port_type>;
32+ auto toggle () noexcept -> void override
33+ {
34+ using base_class_type = led_boolean_state_base;
35+
36+ // Toggle the LED.
37+ PFS->P111PFS .bit .PODR ^= 1 ;
38+
39+ base_class_type::toggle ();
40+ }
41+ };
42+
43+ mcal::led::led_base& mcal::led::led0 ()
44+ {
45+ using led0_led_type = led_minima_blinky;
1646
1747 static led0_led_type l0;
1848
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ FILES_TGT = $(PATH_APP)/mcal/mcal_gcc_cxx_completion \
1818 $(PATH_TGT)/startup/int_vect \
1919 $(PATH_APP)/mcal/$(TGT)/mcal_cpu \
2020 $(PATH_APP)/mcal/$(TGT)/mcal_gpt \
21+ $(PATH_APP)/mcal/$(TGT)/mcal_led \
2122 $(PATH_APP)/mcal/$(TGT)/mcal_osc \
2223 $(PATH_APP)/mcal/$(TGT)/mcal_port \
2324 $(PATH_APP)/mcal/$(TGT)/mcal_wdg \
Original file line number Diff line number Diff line change 1515
1616******************************************************************************************/
1717
18- // -----------------------------------------------------------------------------------------
19- // Includes
20- // -----------------------------------------------------------------------------------------
21- #include < cstdint>
22-
18+ #include < mcal_led.h>
2319#include < util/utility/util_time.h>
2420
25- #include " R7FA4M1AB.h"
26-
21+ #include < cstdint>
2722
2823extern " C" void mcal_gpt_init (void );
2924
3025int main (void );
3126
3227int main (void )
3328{
34- /* configure pin P111 as output */
35- /* disable register write protection for PFS*/
36- PMISC->PWPR .bit .B0WI = 0 ;
37- PMISC->PWPR .bit .PFSWE = 1 ;
38-
39- /* output low */
40- PFS->P111PFS .bit .PODR = 0 ;
41-
42- /* configure the pin as output */
43- PFS->P111PFS .bit .PDR = 1 ;
44-
45- /* Set the LED on */
46- PFS->P111PFS .bit .PODR ^= 1 ;
47-
4829 mcal_gpt_init ();
4930
5031 using local_timer_type = util::timer<std::uint32_t >;
5132
33+ mcal::led::led0 ().toggle ();
34+
5235 local_timer_type blinky_timer { local_timer_type::seconds (UINT8_C (1 )) };
5336
5437 /* endless loop */
5538 while (1 )
5639 {
5740 if (blinky_timer.timeout ())
5841 {
59- PFS-> P111PFS . bit . PODR ^= 1 ;
42+ mcal::led::led0 (). toggle () ;
6043
6144 blinky_timer.start_interval (local_timer_type::seconds (UINT8_C (1 )));
6245 }
You can’t perform that action at this time.
0 commit comments