Просмотр исходного кода

SP700新V2 pack pcb加入诊断LED灯

Signed-off-by: huhui <huhui@sharkgulf.com>
huhui 4 лет назад
Родитель
Сommit
16fe5c6374
4 измененных файлов с 13 добавлено и 0 удалено
  1. 8 0
      Application/bsp/bsp.c
  2. 2 0
      Application/bsp/gpio.c
  3. 2 0
      Application/bsp/gpio.h
  4. 1 0
      Application/bsp/mcu_power_sleep.c

+ 8 - 0
Application/bsp/bsp.c

@@ -21,6 +21,8 @@ const char iap_fw_name[] __attribute__((at(0x08002C00))) = "App";
 extern void system_clock_config(void);
 extern void SystemCoreClockUpdate(void);
 extern void gpio_key_init(void);
+static void dianostic_timer_handler(shark_timer_t *timer);
+static shark_timer_t _dianostic_stop_timer = {.handler = dianostic_timer_handler};
 
 #ifndef CONFIG_DEBUG
 #define CONFIG_DEBUG 0
@@ -47,9 +49,15 @@ void bsp_init(void){
 	AT24CXX_Init();
 	AUX_VOL_OPEN(0);
 	gpio_key_init();
+	DIANOCTIC_LED(1);
+	shark_timer_post(&_dianostic_stop_timer, 5000);
 	RTC_BKP0 = 0;
 }
 
+static void dianostic_timer_handler(shark_timer_t *timer) {
+	DIANOCTIC_LED(0);
+}
+
 uint32_t bsp_get_rst_reson(void){
 	return reset_source;
 }

+ 2 - 0
Application/bsp/gpio.c

@@ -27,6 +27,8 @@ void gpio_init(void){
     //老的sp700+cs1180上,GPIOA8和GPIOB15连在一起,为了不影响B15 pin的spi 功能,A8pin需要设置为输入
 	gpio_mode_analog_input(GPIOA, GPIO_PIN_8);
 #endif
+    //disnoctic led
+	gpio_mode_output(GPIOF, GPIO_PUPD_PULLUP, GPIO_OTYPE_PP, GPIO_OSPEED_10MHZ, GPIO_PIN_6);
 #elif (CONFIG_BOARD_TYPE==SHARK_BOARD_SP600)
 	//key
 	gpio_mode_input(GPIOA, GPIO_PUPD_NONE, GPIO_PIN_0);

+ 2 - 0
Application/bsp/gpio.h

@@ -39,6 +39,7 @@ void gpio_init(void);
 /*detect hall 1&2 */
 #define IS_HALL1_DETECTED() (!gpio_input_bit_get(GPIOC, GPIO_PIN_15))
 #define IS_HALL2_DETECTED() (!gpio_input_bit_get(GPIOC, GPIO_PIN_13))
+#define DIANOCTIC_LED(s) gpio_bit_write(GPIOF,GPIO_PIN_6,(s == 0)?SET:RESET)
 
 #define LED0_ON(x) {}
 #define LED1_ON(x) {}
@@ -70,6 +71,7 @@ void gpio_init(void);
 
 #define UART0_IR_EN(x) RS485_PWR_ENABLE(x)
 #define UART1_IR_EN(x) {}
+#define DIANOCTIC_LED(s) {}
 #endif
 
 #define LED_ALL_ON(x) {LED0_ON(x); LED1_ON(x); LED2_ON(x); LED3_ON(x); LED4_ON(x);}

+ 1 - 0
Application/bsp/mcu_power_sleep.c

@@ -61,6 +61,7 @@ static void wait_dcdc_good(void) {
 }
 static int pre_deepsleep(void){
 	LED_ALL_ON(0);
+	DIANOCTIC_LED(0);
 	_wakeup_source = 0;
 	systick_close();
 	shark_rtc_set_backup(0xF0);