Skip to content

USB STM32: Don't wrap direct function calls in MBED_ASSERT #11829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions targets/TARGET_STM/USBPhy_STM32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ void USBPhyHw::init(USBPhyEvents *events)
// Configure PCD and FIFOs
hpcd.pData = (void *)this;
hpcd.State = HAL_PCD_STATE_RESET;
MBED_ASSERT(HAL_PCD_Init(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_Init(&hpcd);
MBED_ASSERT(ret == HAL_OK);


uint32_t total_bytes = 0;
Expand Down Expand Up @@ -272,7 +273,9 @@ void USBPhyHw::init(USBPhyEvents *events)

void USBPhyHw::deinit()
{
MBED_ASSERT(HAL_PCD_DeInit(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_DeInit(&hpcd);
MBED_ASSERT(ret == HAL_OK);

NVIC_DisableIRQ(USBHAL_IRQn);

if (events != NULL) {
Expand All @@ -288,12 +291,14 @@ bool USBPhyHw::powered()

void USBPhyHw::connect()
{
MBED_ASSERT(HAL_PCD_Start(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_Start(&hpcd);
MBED_ASSERT(ret == HAL_OK);
}

void USBPhyHw::disconnect()
{
MBED_ASSERT(HAL_PCD_Stop(&hpcd) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_Stop(&hpcd);
MBED_ASSERT(ret == HAL_OK);
}

void USBPhyHw::configure()
Expand All @@ -318,7 +323,8 @@ void USBPhyHw::sof_disable()

void USBPhyHw::set_address(uint8_t address)
{
MBED_ASSERT(HAL_PCD_SetAddress(&hpcd, address) == HAL_OK);
HAL_StatusTypeDef ret = HAL_PCD_SetAddress(&hpcd, address);
MBED_ASSERT(ret == HAL_OK);
}

void USBPhyHw::remote_wakeup()
Expand Down