Skip to content

Commit e47ded9

Browse files
committed
atsam4s bugfix reading from write only register
1 parent aeede17 commit e47ded9

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

targets/core/atmel/atsam4s/port.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ namespace klib::core::atsam4s::io::detail::pins {
5757
if constexpr (std::is_same_v<Periph, io::detail::alternate::none>) {
5858
// enable control using the PIO. Disables peripheral
5959
// control of the pin
60-
Pin::port::port->PER |= mask<Pin>;
60+
Pin::port::port->PER = mask<Pin>;
6161
}
6262
else if constexpr (std::is_same_v<Periph, io::detail::alternate::func_1>) {
6363
// disable control using the PIO. Enables peripheral
6464
// control of the pin
65-
Pin::port::port->PDR |= mask<Pin>;
65+
Pin::port::port->PDR = mask<Pin>;
6666

6767
// setup alternate function 1
6868
Pin::port::port->ABCDSR[0] &= ~mask<Pin>;
@@ -71,7 +71,7 @@ namespace klib::core::atsam4s::io::detail::pins {
7171
else if constexpr (std::is_same_v<Periph, io::detail::alternate::func_2>) {
7272
// disable control using the PIO. Enables peripheral
7373
// control of the pin
74-
Pin::port::port->PDR |= mask<Pin>;
74+
Pin::port::port->PDR = mask<Pin>;
7575

7676
// setup alternate function 2
7777
Pin::port::port->ABCDSR[0] |= mask<Pin>;
@@ -80,7 +80,7 @@ namespace klib::core::atsam4s::io::detail::pins {
8080
else if constexpr (std::is_same_v<Periph, io::detail::alternate::func_3>) {
8181
// disable control using the PIO. Enables peripheral
8282
// control of the pin
83-
Pin::port::port->PDR |= mask<Pin>;
83+
Pin::port::port->PDR = mask<Pin>;
8484

8585
// setup alternate function 3
8686
Pin::port::port->ABCDSR[0] &= ~mask<Pin>;
@@ -89,7 +89,7 @@ namespace klib::core::atsam4s::io::detail::pins {
8989
else {
9090
// disable control using the PIO. Enables peripheral
9191
// control of the pin
92-
Pin::port::port->PDR |= mask<Pin>;
92+
Pin::port::port->PDR = mask<Pin>;
9393

9494
// setup alternate function 4
9595
Pin::port::port->ABCDSR[0] |= mask<Pin>;

0 commit comments

Comments
 (0)