6
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
|
||||
#define MAX_TCP_PAYLOAD_SIZE 10240
|
||||
uint8_t g_TxNetBuffer_A_Mem[MAX_TCP_PAYLOAD_SIZE];
|
||||
@@ -40,13 +39,8 @@ void OnConfigUpdate(const ConfigCommon_t *common, const Config2D_t *cfg2d, const
|
||||
#define NG_GPIO_CLK RCC_APB2Periph_GPIOA
|
||||
#define NG_PULSE_MS 200 /* default NG pulse width */
|
||||
|
||||
static TimerHandle_t g_ng_timer;
|
||||
|
||||
static void ng_timer_callback(TimerHandle_t xTimer)
|
||||
{
|
||||
(void)xTimer;
|
||||
GPIO_ResetBits(NG_GPIO_PORT, NG_GPIO_PIN);
|
||||
}
|
||||
static volatile uint32_t g_ng_off_time = 0;
|
||||
extern volatile uint32_t sys_tick_ms;
|
||||
|
||||
static void NG_GPIO_Init(void)
|
||||
{
|
||||
@@ -57,9 +51,6 @@ static void NG_GPIO_Init(void)
|
||||
gpio.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_Init(NG_GPIO_PORT, &gpio);
|
||||
GPIO_ResetBits(NG_GPIO_PORT, NG_GPIO_PIN);
|
||||
|
||||
g_ng_timer = xTimerCreate("ng", pdMS_TO_TICKS(NG_PULSE_MS),
|
||||
pdFALSE, NULL, ng_timer_callback);
|
||||
}
|
||||
|
||||
void OnDetectionResult(uint32_t frameNumber, uint8_t resultStatus)
|
||||
@@ -68,8 +59,7 @@ void OnDetectionResult(uint32_t frameNumber, uint8_t resultStatus)
|
||||
/* resultStatus: 0 = NG, 1 = OK */
|
||||
if (resultStatus == 0) {
|
||||
GPIO_SetBits(NG_GPIO_PORT, NG_GPIO_PIN);
|
||||
if (g_ng_timer)
|
||||
xTimerStart(g_ng_timer, 0);
|
||||
g_ng_off_time = sys_tick_ms + NG_PULSE_MS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,6 +212,12 @@ static void task_business_entry(void *pvParameters)
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* NG pulse off check */
|
||||
if (g_ng_off_time && sys_tick_ms >= g_ng_off_time) {
|
||||
GPIO_ResetBits(NG_GPIO_PORT, NG_GPIO_PIN);
|
||||
g_ng_off_time = 0;
|
||||
}
|
||||
|
||||
DVP_Task();
|
||||
|
||||
if (Frame_Ready_Flag)
|
||||
|
||||
Reference in New Issue
Block a user