소스 검색

Merge pull request #687 from jgressmann/bugfix/same54xplainedpro-led-inverted

SAM 54 Xplained Pro: fix inverted logic for board led
Ha Thach 5 년 전
부모
커밋
c61464ebaa
1개의 변경된 파일4개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 3
      hw/bsp/same54xplainedpro/same54xplainedpro.c

+ 4 - 3
hw/bsp/same54xplainedpro/same54xplainedpro.c

@@ -166,15 +166,16 @@ void board_init(void)
 #endif
 #endif
 
 
 	// LED0 init
 	// LED0 init
+	gpio_set_pin_function(LED_PIN, GPIO_PIN_FUNCTION_OFF);
 	gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
 	gpio_set_pin_direction(LED_PIN, GPIO_DIRECTION_OUT);
-	gpio_set_pin_level(LED_PIN, 0);
+	board_led_write(0);
 
 
 #if CFG_TUSB_DEBUG >= 2
 #if CFG_TUSB_DEBUG >= 2
 	uart_send_str(BOARD_NAME " LED pin configured\n");
 	uart_send_str(BOARD_NAME " LED pin configured\n");
 #endif
 #endif
 
 
 	// BTN0 init
 	// BTN0 init
-	gpio_set_pin_function(BUTTON_PIN, GPIO_DIRECTION_IN);
+	gpio_set_pin_function(BUTTON_PIN, GPIO_PIN_FUNCTION_OFF);
 	gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
 	gpio_set_pin_direction(BUTTON_PIN, GPIO_DIRECTION_IN);
 	gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
 	gpio_set_pin_pull_mode(BUTTON_PIN, GPIO_PULL_UP);
 
 
@@ -228,7 +229,7 @@ void board_init(void)
 
 
 void board_led_write(bool state)
 void board_led_write(bool state)
 {
 {
-	gpio_set_pin_level(LED_PIN, state);
+	gpio_set_pin_level(LED_PIN, !state);
 }
 }
 
 
 uint32_t board_button_read(void)
 uint32_t board_button_read(void)