Skip to content

Commit 3ee70a7

Browse files
committed
mb9bf560l gpio driver bugfix not getting address and using wrong address
1 parent 634c25b commit 3ee70a7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

targets/core/cypress/mb9bf560l/port.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace klib::core::mb9bf560l::io::detail::pins {
4141
static_assert(Periph::periph::id <= 20, "Invalid peripheral id");
4242

4343
// get the pointer to the pin select we need to write to
44-
volatile uint32_t *const epfr = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->EPFR00));
44+
volatile uint32_t *const epfr = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->EPFR00));
4545

4646
// get the current value in the register
4747
uint32_t reg = epfr[Periph::periph::id];
@@ -595,7 +595,7 @@ namespace klib::core::mb9bf560l::io::detail::pins {
595595
}
596596

597597
// get the pointer to the pin select we need to write to
598-
volatile uint32_t *const pfr = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->PFR0));
598+
volatile uint32_t *const pfr = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->PFR0));
599599

600600
// set the alternate function
601601
if constexpr (std::is_same_v<Periph, io::detail::alternate::none>) {
@@ -628,15 +628,15 @@ namespace klib::core::mb9bf560l::io {
628628
detail::pins::set_peripheral<Pin, io::detail::alternate::none>();
629629

630630
// get the pointer to the pin select we need to write to
631-
volatile uint32_t *const ddr = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->DDR0));
631+
volatile uint32_t *const ddr = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->DDR0));
632632

633633
// disable the output on the pin
634634
ddr[Pin::port::id] &= (~detail::pins::mask<Pin>);
635635
}
636636

637637
constexpr static bool get() {
638638
// get the pointer to the pin select we need to write to
639-
volatile uint32_t *const pdir = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->PDIR0));
639+
volatile uint32_t *const pdir = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->PDIR0));
640640

641641
// get the status of the pin
642642
return pdir[Pin::port::id] & detail::pins::mask<Pin>;
@@ -645,7 +645,7 @@ namespace klib::core::mb9bf560l::io {
645645
template <bool Val>
646646
constexpr static void pullup_enable() {
647647
// get the pointer to the pin select we need to write to
648-
volatile uint32_t *const pcr = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->PCR0));
648+
volatile uint32_t *const pcr = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->PCR0));
649649

650650
if constexpr (Val) {
651651
pcr[Pin::port::id] |= detail::pins::mask<Pin>;
@@ -664,7 +664,7 @@ namespace klib::core::mb9bf560l::io {
664664
detail::pins::set_peripheral<Pin, io::detail::alternate::none>();
665665

666666
// get the pointer to the pin select we need to write to
667-
volatile uint32_t *const ddr = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->DDR0));
667+
volatile uint32_t *const ddr = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->DDR0));
668668

669669
// // enable the gpio output
670670
ddr[Pin::port::id] |= detail::pins::mask<Pin>;
@@ -673,7 +673,7 @@ namespace klib::core::mb9bf560l::io {
673673
template <bool Val>
674674
constexpr static void set() {
675675
// get the pointer to the pin select we need to write to
676-
volatile uint32_t *const pdor = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->PDOR0));
676+
volatile uint32_t *const pdor = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->PDOR0));
677677

678678
if constexpr (Val) {
679679
pdor[Pin::port::id] |= detail::pins::mask<Pin>;
@@ -685,7 +685,7 @@ namespace klib::core::mb9bf560l::io {
685685

686686
constexpr static void set(const bool val) {
687687
// get the pointer to the pin select we need to write to
688-
volatile uint32_t *const pdor = (reinterpret_cast<volatile uint32_t *const>(Pin::port::port->PDOR0));
688+
volatile uint32_t *const pdor = (reinterpret_cast<volatile uint32_t *const>(&Pin::port::port->PDOR0));
689689

690690
if (val) {
691691
pdor[Pin::port::id] |= detail::pins::mask<Pin>;

0 commit comments

Comments
 (0)