guowenxue
2024-06-25 5fc803d51ca097f07b4efbe0290ccc540b0660df
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "led.h"
#include "board_common.h"
 
void Board_LedInit(void)
{
    GPIO_InitTypeDef initStruct={0};
    initStruct.Mode = GPIO_MODE_OUTPUT_PP;
    initStruct.Pull = GPIO_NOPULL;
    initStruct.Speed = GPIO_SPEED_HIGH;
    
    HW_GPIO_Init(LED_RUN_PORT, LED_RUN_PIN, &initStruct );
    HW_GPIO_Write(LED_RUN_PORT, LED_RUN_PIN, TURN_OFF);
}
 
void Board_TurnLed(uint8_t u8Which, uint8_t u8Cmd)
{
    switch(u8Which)
    {
        case LED_RUN:
            HW_GPIO_Write(LED_RUN_PORT, LED_RUN_PIN, u8Cmd);
            break;
    }
}
 
 
void Board_LedTest(void)
{
    while(1)
    {
        Board_TurnLed(LED_RUN, TURN_ON);
        DelayMs(1000);
 
        Board_TurnLed(LED_RUN, TURN_OFF);
        DelayMs(1000);
    }
}