123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- #include "led.h"
- void LED_GPIO_Config(void)
- {
-
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_AHB1PeriphClockCmd ( LED_GPIO_CLK, ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = LED_PIN;
-
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
-
-
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
-
-
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
-
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
-
- GPIO_Init(LED_GPIO_PORT, &GPIO_InitStructure);
- }
- void NET_STATUS_LED_Config(void)
- {
-
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_AHB1PeriphClockCmd ( NET_STATUS_LED_GPIO_CLK, ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = NET_STATUS_LED_PIN;
-
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
-
-
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
-
-
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
-
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
-
- GPIO_Init(NET_STATUS_LED_GPIO_PORT, &GPIO_InitStructure);
- }
- void STATUS_LED_Config(void)
- {
-
- GPIO_InitTypeDef GPIO_InitStructure;
-
- RCC_AHB1PeriphClockCmd ( STATUS_LED_GPIO_CLK, ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = STATUS_LED_PIN;
-
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
-
-
- GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
-
-
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
-
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
-
- GPIO_Init(STATUS_LED_GPIO_PORT, &GPIO_InitStructure);
- }
- int led_openTime = 500;
- int led_closeTime = 500;
- int hd_netledOpen(void)
- {
- NET_STATUS_LED(1);
- return led_openTime;
- }
- int hd_netledClose(void)
- {
- NET_STATUS_LED(0);
- return led_closeTime;
- }
- void hd_netledSetOpenTime(int tms)
- {
- if(tms > 1000) tms = 1000;
-
- led_openTime = tms;
- led_closeTime = (1000 - led_openTime);
- }
- int hd_netledGetOpenTime(void)
- {
- return led_openTime;
- }
|