This repository has been archived on 2025-02-28. You can view files and clone it, but cannot push or open issues or pull requests.
controller-hd/User/system/bsp/bsp.h

52 lines
1.8 KiB
C

/**
* @file bsp.h
* @brief This file contains the declarations and definitions for the BSP (Board Support Package) module.
*
* The BSP module provides functions and configurations specific to the hardware platform, such as initializing
* peripherals, configuring GPIO pins, and managing interrupts.
*
* @author xxx
* @date 2023-12-27 14:44:03
* @copyright Copyright (c) 2024 by xxx, All Rights Reserved.
*/
#ifndef __BSP_H__
#define __BSP_H__
#include "gpios.h"
#include "adcs.h"
#include "dacs.h"
#include "tims.h"
#include "pwms.h"
#include "uarts.h"
#include "eeprom.h"
#include "spis.h"
#include "i2cs.h"
/**
* @brief Clears the flags of a DMA channel
* @param DMAX DMAx register base
* @param CHx DMA channel number
* @param Flag a boolean variable that indicates if the transfer is complete
* @note This function should be called within the interrupt service routine of the DMA channel
*/
#define DMA_ClEAR_FLAG(DMAX, CHx, Flag) \
do \
{ \
if (LL_DMA_IsActiveFlag_TC##CHx(DMAX)) \
{ \
LL_DMA_ClearFlag_TC##CHx(DMAX); \
LL_DMA_ClearFlag_GI##CHx(DMAX); \
Flag = TRUE; \
} \
if (LL_DMA_IsActiveFlag_TE##CHx(DMAX)) \
{ \
LL_DMA_ClearFlag_TE##CHx(DMAX); \
} \
if (LL_DMA_IsActiveFlag_GI##CHx(DMAX)) \
{ \
LL_DMA_ClearFlag_GI##CHx(DMAX); \
} \
} while (__LINE__ == -1)
#endif // __BSP_H__