31 lines
626 B
C
31 lines
626 B
C
#include "Ultrasonic_Test.h"
|
|||
|
|
#include "drvUltrasonic.h"
|
||
|
|
#include "cmsis_os2.h"
|
||
|
|
#include "main.h"
|
||
|
|
|
||
|
|
static const osThreadAttr_t task_attrs = {
|
||
|
|
.stack_size = 256
|
||
|
|
};
|
||
|
|
|
||
|
|
static void Ultrasonic_Test_Task(void *arg)
|
||
|
|
{
|
||
|
|
(void) arg;
|
||
|
|
|
||
|
|
for ( ; ; )
|
||
|
|
{
|
||
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, GPIO_PIN_SET);
|
||
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3, GPIO_PIN_SET);
|
||
|
|
osDelay(20);
|
||
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, GPIO_PIN_RESET);
|
||
|
|
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3, GPIO_PIN_RESET);
|
||
|
|
osDelay(1000);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void Ultrasonic_Test_Init(void)
|
||
|
|
{
|
||
|
|
(void) drvUltrasonic_Init();
|
||
|
|
|
||
|
|
osThreadNew(Ultrasonic_Test_Task, (void *) 0, &task_attrs);
|
||
|
|
}
|