2021-10-06 09:24:09 +00:00
|
|
|
#ifndef _STM32_H_
|
|
|
|
#define _STM32_H_
|
|
|
|
|
|
|
|
/* modify bitfield */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _BMD(reg, msk, val) (reg) = (((reg) & ~(msk)) | (val))
|
2021-10-06 09:24:09 +00:00
|
|
|
/* set bitfield */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _BST(reg, bits) (reg) = ((reg) | (bits))
|
2021-10-06 09:24:09 +00:00
|
|
|
/* clear bitfield */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _BCL(reg, bits) (reg) = ((reg) & ~(bits))
|
2021-10-06 09:24:09 +00:00
|
|
|
/* wait until bitfield set */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _WBS(reg, bits) while(((reg) & (bits)) == 0)
|
2021-10-06 09:24:09 +00:00
|
|
|
/* wait until bitfield clear */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _WBC(reg, bits) while(((reg) & (bits)) != 0)
|
2021-10-06 09:24:09 +00:00
|
|
|
/* wait for bitfield value */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _WVL(reg, msk, val) while(((reg) & (msk)) != (val))
|
2021-10-06 09:24:09 +00:00
|
|
|
/* bit value */
|
2022-01-05 16:10:18 +00:00
|
|
|
#define _BV(bit) (0x01 << (bit))
|
2021-10-06 09:24:09 +00:00
|
|
|
|
|
|
|
#if defined(STM32F0)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32F0xx/Include/stm32f0xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32F1)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32F1xx/Include/stm32f1xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32F2)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32F2xx/Include/stm32f2xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32F3)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32F3xx/Include/stm32f3xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32F4)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32F4xx/Include/stm32f4xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32F7)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32F7xx/Include/stm32f7xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32H7)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32H7xx/Include/stm32h7xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32L0)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32L0xx/Include/stm32l0xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32L1)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32L1xx/Include/stm32l1xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32L4)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32L4xx/Include/stm32l4xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32L5)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32L5xx/Include/stm32l5xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32G0)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32G0xx/Include/stm32g0xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32G4)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32G4xx/Include/stm32g4xx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#elif defined(STM32WB)
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "STM32WBxx/Include/stm32wbxx.h"
|
2021-10-06 09:24:09 +00:00
|
|
|
#else
|
2022-01-05 16:10:18 +00:00
|
|
|
#error "STM32 family not defined"
|
2021-10-06 09:24:09 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // _STM32_H_
|