Use status LEDs 1 & 2
This commit is contained in:
		@ -53,7 +53,7 @@ extern "C" {
 | 
			
		||||
void Error_Handler(void);
 | 
			
		||||
 | 
			
		||||
/* USER CODE BEGIN EFP */
 | 
			
		||||
 | 
			
		||||
void update_status_leds();
 | 
			
		||||
/* USER CODE END EFP */
 | 
			
		||||
 | 
			
		||||
/* Private defines -----------------------------------------------------------*/
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,7 @@
 | 
			
		||||
#include "BQ_Abstraction_Layer.h"
 | 
			
		||||
 | 
			
		||||
#include "stm32f4xx_hal.h"
 | 
			
		||||
#include "stm32f4xx_hal_gpio.h"
 | 
			
		||||
/* USER CODE END Includes */
 | 
			
		||||
 | 
			
		||||
/* Private typedef -----------------------------------------------------------*/
 | 
			
		||||
@ -71,7 +72,19 @@ static void MX_USART6_UART_Init(void);
 | 
			
		||||
 | 
			
		||||
/* Private user code ---------------------------------------------------------*/
 | 
			
		||||
/* USER CODE BEGIN 0 */
 | 
			
		||||
void update_status_leds() {
 | 
			
		||||
  if ((HAL_GetTick() / 1000) % 2 == 0) {
 | 
			
		||||
    HAL_GPIO_WritePin(STAT_LED1_GPIO_Port, STAT_LED1_Pin, GPIO_PIN_RESET);
 | 
			
		||||
  } else {
 | 
			
		||||
    HAL_GPIO_WritePin(STAT_LED1_GPIO_Port, STAT_LED1_Pin, GPIO_PIN_SET);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (bq_status == BQ_OFF || bq_status == BQ_ERROR) {
 | 
			
		||||
    HAL_GPIO_WritePin(STAT_LED2_GPIO_Port, STAT_LED2_Pin, GPIO_PIN_RESET);
 | 
			
		||||
  } else {
 | 
			
		||||
    HAL_GPIO_WritePin(STAT_LED2_GPIO_Port, STAT_LED2_Pin, GPIO_PIN_SET);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
/* USER CODE END 0 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -121,6 +134,7 @@ int main(void) {
 | 
			
		||||
    /* USER CODE END WHILE */
 | 
			
		||||
 | 
			
		||||
    /* USER CODE BEGIN 3 */
 | 
			
		||||
    update_status_leds();
 | 
			
		||||
    afe_measure();
 | 
			
		||||
  }
 | 
			
		||||
  /* USER CODE END 3 */
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user