Skip to content

Instantly share code, notes, and snippets.

//https://github.com/STMicroelectronics/STM32CubeF7/blob/master/Drivers/STM32F7xx_HAL_Driver/Src/stm32f7xx_hal_uart.c
HAL_StatusTypeDef UART_WaitOnFlagUntilTimeout(UART_HandleTypeDef *huart, uint32_t Flag, FlagStatus Status,
uint32_t Tickstart, uint32_t Timeout)
{
/* Wait until flag is set */
while ((__HAL_UART_GET_FLAG(huart, Flag) ? SET : RESET) == Status)
{
/* Check for the Timeout */
void Functionality()
{
ActivateAsyncBehavior();
msleep(20); //must wait for external behavior to complete
ReadDataAndActUponIt();
}
@mattheweshleman
mattheweshleman / hwLockCtrlServiceTests.cpp
Last active April 27, 2020 18:16
GiveProcessingTime unit test helper method
void GiveProcessingTime()
{
//use our unit testing backdoor to service
//the active object's internal queue. This avoids threading issues
//with unit tests, creating 100% predictable unit tests.
while (true == mUnderTest->ProcessOneEvent(ProcessOption::UNIT_TEST)) {}
}
@mattheweshleman
mattheweshleman / hwLockCtrl.h
Last active April 27, 2020 14:35
Hw Lock Ctrl Driver Interface
/**
* @brief HwLockCtrlSelfTestResult enumerates possible self test results.
*/
typedef enum HwLockCtrlSelfTestResult
{
HW_LOCK_CTRL_SELF_TEST_PASSED,
HW_LOCK_CTRL_SELF_TEST_FAILED_POWER,
HW_LOCK_CTRL_SELF_TEST_FAILED_MOTOR,
} HwLockCtrlSelfTestResultT;