Skip to content

Commit 3c4a288

Browse files
committed
mb9bf560l changed usb driver to use updated set_peripheral function
1 parent 4130d47 commit 3c4a288

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

targets/chip/mb9bf566k/io/usb.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ namespace klib::mb9bf566k::io::periph::lqfp_48 {
5151
using connect = detail::usb::usb<pins::package::lqfp_48::p43, detail::usb::mode::connect, core::mb9bf560l::io::detail::alternate::system_function::usbp0e<true>>;
5252

5353
// these two pins are switched using the special port settings register
54-
using dplus = detail::usb::usb<pins::package::lqfp_48::p47, detail::usb::mode::dplus, core::mb9bf560l::io::detail::alternate::none>;
55-
using dminus = detail::usb::usb<pins::package::lqfp_48::p46, detail::usb::mode::dminus, core::mb9bf560l::io::detail::alternate::none>;
54+
using dplus = detail::usb::usb<pins::package::lqfp_48::p47, detail::usb::mode::dplus, core::mb9bf560l::io::detail::alternate::special::usb0c<true>>;
55+
using dminus = detail::usb::usb<pins::package::lqfp_48::p46, detail::usb::mode::dminus, core::mb9bf560l::io::detail::alternate::special::usb0c<true>>;
5656
};
5757
}
5858

targets/core/cypress/mb9bf560l/port.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ namespace klib::core::mb9bf560l::io::detail::pins {
9191
if constexpr (alternate::periph::id == spsr_id) {
9292
// clear the alternate function if it is set
9393
peripheral_helper_clear_alternate(
94-
&Pin::port::port->SPRS, alternate::periph::offset, alternate::periph::bits, alternate::value
94+
&Pin::port::port->SPSR, alternate::periph::offset, alternate::periph::bits, alternate::value
9595
);
9696
}
9797
else {
@@ -158,7 +158,7 @@ namespace klib::core::mb9bf560l::io::detail::pins {
158158
if constexpr (Periph::periph::id == spsr_id) {
159159
// set the value from the peripheral into the register
160160
peripheral_helper_set_alternate(
161-
&Pin::port::port->SPRS, Periph::periph::offset, Periph::periph::bits, Periph::value
161+
&Pin::port::port->SPSR, Periph::periph::offset, Periph::periph::bits, Periph::value
162162
);
163163
}
164164
else {
@@ -196,7 +196,7 @@ namespace klib::core::mb9bf560l::io::detail::alternate {
196196
// blocks. This is extremly anoying as we need to
197197
// clear all the other functions this pin can have.
198198
namespace special {
199-
// register SPRS (note we use ID 255 for this register)
199+
// register SPSR (note we use ID 255 for this register)
200200
// alternate function for usb1c
201201
template <uint8_t Value>
202202
struct usb1c: public detail::pins::peripheral_helper<detail::pins::peripheral_helper_impl<detail::pins::spsr_id, 5, 1>, Value> {};

targets/core/cypress/mb9bf560l/usb.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,8 +762,9 @@ namespace klib::core::mb9bf560l::io {
762762
// enable power to the usb clock
763763
CLK_GATING->CKEN2 |= 0x1 << Usb::id;
764764

765-
// setup the io
766-
GPIO->SPSR = GPIO->SPSR | (0x1 << (Usb::id + 4));
765+
// setup the io (note setting one of the pins sets both. We do it just in case)
766+
target::io::detail::pins::set_peripheral<typename Usb::dplus::pin, typename Usb::dplus::periph>();
767+
target::io::detail::pins::set_peripheral<typename Usb::dminus::pin, typename Usb::dminus::periph>();
767768

768769
// check if we need to enable the USB connect pin
769770
if constexpr (UsbConnect) {

0 commit comments

Comments
 (0)