GR712RC unit tests
1.0
Bare-metal C++ hardware tests for the PLATO DPU (IAA-CSIC, 2019)
Loading...
Searching...
No Matches
src
mcal
gr712rc_ed31
mcal_uart.h
Go to the documentation of this file.
1
9
10
#ifndef _MCAL_LED_SAM4S_EMBEDDED_2018_
11
#define _MCAL_LED_SAM4S_EMBEDDED_2018_
12
13
#include <cstdint>
14
15
namespace
mcal
16
{
17
namespace
led
18
{
19
typedef
void
config_type
;
20
void
init
(
config_type
*);
21
22
class
led
23
{
24
public
:
25
//Conf registers and address are 32bit.
26
typedef
std::uint32_t
port_type
;
27
typedef
std::uint32_t
bval_type
;
28
32
led
(
const
port_type
p,
33
const
bval_type
b) : port(p),
34
bval(b)
35
{
36
//Enable the port pin to manage with PIO (pio_per).
37
*
reinterpret_cast<
volatile
bval_type
*
>
(port) |=
static_cast<
bval_type
>
(bval);
38
// Set the port pin to low.
39
//*reinterpret_cast<volatile bval_type*>(port+ 0x34U) |= static_cast<bval_type>(bval);
40
41
// Set the port pin to output.
42
*
reinterpret_cast<
volatile
bval_type
*
>
(port + 0x10U) |= bval;
43
}
44
45
void
toggle
(
void
)
const
46
{
47
48
// Set the port pin to low.
49
*
reinterpret_cast<
volatile
bval_type
*
>
(port+ 0x34U) |=
static_cast<
bval_type
>
(bval);
50
51
// Toggle the LED.
52
//*reinterpret_cast<volatile bval_type*>(port+0x30U) |= bval;
53
}
54
55
private
:
56
const
port_type
port
;
57
const
bval_type
bval;
58
};
59
60
extern
const
led
led_yellow
;
61
62
}
63
64
}
65
66
#endif
//_MCAL_LED_SAM4S_EMBEDDED_2018
mcal::led::led
Definition
mcal_uart.h:23
mcal::led::led::led
led(const port_type p, const bval_type b)
bval es el valor de pin a poner a 1,, bval=2 => pin 1 del puerto.
Definition
mcal_uart.h:32
mcal::led::led::port_type
std::uint32_t port_type
Definition
mcal_uart.h:26
mcal::led::led::toggle
void toggle(void) const
Definition
mcal_uart.h:45
mcal::led::led::bval_type
std::uint32_t bval_type
Definition
mcal_uart.h:27
mcal::led
Definition
mcal_uart.cpp:17
mcal::led::config_type
void config_type
Definition
mcal_uart.h:19
mcal::led::init
void init(config_type *)
mcal::led::led_yellow
const led led_yellow(mcal::reg::portc, 0x800000U)
Definition
mcal_uart.h:60
mcal::port
Definition
mcal_port.h:16
mcal
Definition
mcal_cpu.h:16
Generated by
1.15.0