@@ -704,11 +704,13 @@ namespace klib::core::mb9bf560l::io {
704704 * @tparam type
705705 */
706706 template <uint8_t endpoint, klib::usb::descriptor::transfer_type type>
707- constexpr static void is_valid_endpoint () {
707+ constexpr static bool is_valid_endpoint () {
708708 using transfer_type = klib::usb::descriptor::transfer_type;
709709
710710 // make sure the endpoint is valid
711- static_assert (endpoint < endpoint_count, " Invalid endpoint provided" );
711+ if (endpoint >= endpoint_count) {
712+ return false ;
713+ }
712714
713715 // this chip has some weird rules. We can enable a Bulk/Interrupt
714716 // on every channel except endpoint 0.
@@ -719,19 +721,13 @@ namespace klib::core::mb9bf560l::io {
719721
720722 // check if the endpoint supports the transfer type
721723 if constexpr (type == transfer_type::control) {
722- static_assert (endpoint == 0 ,
723- " Endpoint does not support control mode"
724- );
724+ return (endpoint == 0 );
725725 }
726726 else if constexpr (type == transfer_type::interrupt || type == transfer_type::bulk) {
727- static_assert (endpoint != 0 ,
728- " Endpoint does not support interrupt/bulk mode"
729- );
727+ return (endpoint != 0 );
730728 }
731729 else {
732- static_assert ((endpoint == 2 ) || (endpoint == 4 ),
733- " Endpoint does not support isochronous mode"
734- );
730+ return ((endpoint == 2 ) || (endpoint == 4 ));
735731 }
736732 }
737733
0 commit comments