Skip to content

initialize state before calling HAL_XXX_Init for SPI and I2C #114

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
Sep 26, 2017

Conversation

VVESTM
Copy link
Contributor

@VVESTM VVESTM commented Sep 26, 2017

If we use a dynamic instanciation, the state is not well
initialized. This can ends with a blocking or strange
behaviour.

@VVESTM VVESTM requested review from fpistm and a user September 26, 2017 13:33
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue mainly met when doing soft reset (button)

@@ -371,6 +371,8 @@ void spi_init(spi_t *obj, uint32_t speed, spi_mode_e mode, uint8_t msb)
}
#endif

handle->State = HAL_SPI_STATE_RESET;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this line in the /* Fill default value */ (start at line number 222)

If we use a dynamic instanciation, the state is not well
initialized. This can ends with a blocking or strange
behaviour.
This issue is mainly met when doing soft reset (button).
@VVESTM
Copy link
Contributor Author

VVESTM commented Sep 26, 2017

New version following @fpistm remarks

@fpistm fpistm merged commit 156ccfc into stm32duino:master Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants