pstd2/Core/Inc/dac.h

73 lines
1.7 KiB
C

/* USER CODE BEGIN Header */
#include <string.h>
/**
******************************************************************************
* @file dac.h
* @brief This file contains all the function prototypes for
* the dac.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DAC_H__
#define __DAC_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* USER CODE BEGIN Includes */
#define PROX_SWITCH_PWR_MAX 10000
#define PROX_SWITCH_PWR_MIN 5000
#define DAC_RANGE 4095
#define VOL_RANGE 5000
typedef struct
{
uint8_t index;
uint8_t error;
uint16_t voltage_sv;
uint16_t pre_voltage;
float voltage_pv;
} prox_swith_pwr_t;
extern prox_swith_pwr_t prox_swith_pwr_A;
extern prox_swith_pwr_t prox_swith_pwr_B;
/* USER CODE END Includes */
extern DAC_HandleTypeDef hdac;
/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */
void MX_DAC_Init(void);
/* USER CODE BEGIN Prototypes */
void fun_ini_switch_pwr(prox_swith_pwr_t *prox_swith_pwr);
void fun_ctr_switch_pwr(prox_swith_pwr_t *prox_swith_pwr);
/* USER CODE END Prototypes */
#ifdef __cplusplus
}
#endif
#endif /* __DAC_H__ */