/*******************************************************************************
*
* 代码许可和免责信息
* 武汉芯源半导体有限公司授予您使用所有编程代码示例的非专属的版权许可，您可以由此
* 生成根据您的特定需要而定制的相似功能。根据不能被排除的任何法定保证，武汉芯源半
* 导体有限公司及其程序开发商和供应商对程序或技术支持（如果有）不提供任何明示或暗
* 含的保证或条件，包括但不限于暗含的有关适销性、适用于某种特定用途和非侵权的保证
* 或条件。
* 无论何种情形，武汉芯源半导体有限公司及其程序开发商或供应商均不对下列各项负责，
* 即使被告知其发生的可能性时，也是如此：数据的丢失或损坏；直接的、特别的、附带的
* 或间接的损害，或任何后果性经济损害；或利润、业务、收入、商誉或预期可节省金额的
* 损失。
* 某些司法辖区不允许对直接的、附带的或后果性的损害有任何的排除或限制，因此某些或
* 全部上述排除或限制可能并不适用于您。
*
*******************************************************************************/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CW32L012_GPIO_H__
#define __CW32L012_GPIO_H__

#ifdef __cplusplus
extern "C"
{
#endif

/*****************************************************************************/
/* Include files                                                             */
/*****************************************************************************/
#include "system_cw32l012.h"

/*****************************************************************************/
/* Global pre-processor symbols/macros ('#define')                           */
/*****************************************************************************/

typedef struct
{
    uint32_t Pins;
    uint32_t Mode;
    uint32_t IT;    
} GPIO_InitTypeDef;

typedef enum
{
    GPIO_Pin_RESET = 0,
    GPIO_Pin_SET
} GPIO_PinState;


//============================================================

#define GPIO_MODE_ANALOG                   (0X00)
#define GPIO_MODE_INPUT                    (0x10)
#define GPIO_MODE_INPUT_PULLUP             (0x11)

#define GPIO_MODE_OUTPUT_PP                (0x20)
#define GPIO_MODE_OUTPUT_OD                (0x21)

#define GPIO_IT_NONE                       (0x80)
#define GPIO_IT_RISING                     (0x81)
#define GPIO_IT_FALLING                    (0x82)


//============================================================
#define GPIO_PIN_0                         ((uint16_t)0x0001)   /* Pin 0    selected    */
#define GPIO_PIN_1                         ((uint16_t)0x0002)   /* Pin 1    selected    */
#define GPIO_PIN_2                         ((uint16_t)0x0004)   /* Pin 2    selected    */
#define GPIO_PIN_3                         ((uint16_t)0x0008)   /* Pin 3    selected    */
#define GPIO_PIN_4                         ((uint16_t)0x0010)   /* Pin 4    selected    */
#define GPIO_PIN_5                         ((uint16_t)0x0020)   /* Pin 5    selected    */
#define GPIO_PIN_6                         ((uint16_t)0x0040)   /* Pin 6    selected    */
#define GPIO_PIN_7                         ((uint16_t)0x0080)   /* Pin 7    selected    */
#define GPIO_PIN_8                         ((uint16_t)0x0100)   /* Pin 8    selected    */
#define GPIO_PIN_9                         ((uint16_t)0x0200)   /* Pin 9    selected    */
#define GPIO_PIN_10                        ((uint16_t)0x0400)   /* Pin 10   selected    */
#define GPIO_PIN_11                        ((uint16_t)0x0800)   /* Pin 11   selected    */
#define GPIO_PIN_12                        ((uint16_t)0x1000)   /* Pin 12   selected    */
#define GPIO_PIN_13                        ((uint16_t)0x2000)   /* Pin 13   selected    */
#define GPIO_PIN_14                        ((uint16_t)0x4000)   /* Pin 14   selected    */
#define GPIO_PIN_15                        ((uint16_t)0x8000)   /* Pin 15   selected    */
#define GPIO_PIN_All                       ((uint16_t)0xFFFF)   /* All pins selected    */

//============================================================
//端口滤波定义
#define GPIO_FLTCLK_HCLK2                  (((uint32_t)0) << 16)
#define GPIO_FLTCLK_HCLK4                  (((uint32_t)1) << 16)
#define GPIO_FLTCLK_HCLK8                  (((uint32_t)2) << 16)
#define GPIO_FLTCLK_BTIM1OV                (((uint32_t)3) << 16)
#define GPIO_FLTCLK_LSI                    (((uint32_t)5) << 16)
#define GPIO_FLTCLK_LPTIMOV                (((uint32_t)7) << 16)

//============================================================
//清除CW_GPIO中断标志
#define GPIOA_INTFLAG_CLR(Mask)            ((CW_GPIOA->ICR) = (~((uint32_t)(Mask))))
#define GPIOB_INTFLAG_CLR(Mask)            ((CW_GPIOB->ICR) = (~((uint32_t)(Mask))))
#define GPIOC_INTFLAG_CLR(Mask)            ((CW_GPIOC->ICR) = (~((uint32_t)(Mask))))
#define GPIOF_INTFLAG_CLR(Mask)            ((CW_GPIOF->ICR) = (~((uint32_t)(Mask))))


//============================================================
//ANALOG OR DIGTAL
#define PA00_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN0 = 0)
#define PA00_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN0 = 1)
#define PA01_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN1 = 0)
#define PA01_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN1 = 1)
#define PA02_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN2 = 0)
#define PA02_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN2 = 1)
#define PA03_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN3 = 0)
#define PA03_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN3 = 1)
#define PA04_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN4 = 0)
#define PA04_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN4 = 1)
#define PA05_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN5 = 0)
#define PA05_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN5 = 1)
#define PA06_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN6 = 0)
#define PA06_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN6 = 1)
#define PA07_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN7 = 0)
#define PA07_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN7 = 1)
#define PA08_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN8 = 0)
#define PA08_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN8 = 1)
#define PA09_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN9  = 0)
#define PA09_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN9  = 1)
#define PA10_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN10 = 0)
#define PA10_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN10 = 1)
#define PA11_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN11 = 0)
#define PA11_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN11 = 1)
#define PA12_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN12 = 0)
#define PA12_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN12 = 1)
#define PA13_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN13 = 0)
#define PA13_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN13 = 1)
#define PA14_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN14 = 0)
#define PA14_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN14 = 1)
#define PA15_DIGTAL_ENABLE()               (CW_GPIOA->ANALOG_f.PIN15 = 0)
#define PA15_ANALOG_ENABLE()               (CW_GPIOA->ANALOG_f.PIN15 = 1)

#define PB00_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN0 = 0)
#define PB00_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN0 = 1)
#define PB01_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN1 = 0)
#define PB01_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN1 = 1)
#define PB02_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN2 = 0)
#define PB02_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN2 = 1)
#define PB03_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN3 = 0)
#define PB03_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN3 = 1)
#define PB04_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN4 = 0)
#define PB04_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN4 = 1)
#define PB05_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN5 = 0)
#define PB05_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN5 = 1)
#define PB06_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN6 = 0)
#define PB06_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN6 = 1)
#define PB07_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN7 = 0)
#define PB07_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN7 = 1)
#define PB08_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN8  = 0)
#define PB08_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN8  = 1)
#define PB09_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN9  = 0)
#define PB09_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN9  = 1)
#define PB10_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN10 = 0)
#define PB10_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN10 = 1)
#define PB11_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN11 = 0)
#define PB11_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN11 = 1)
#define PB12_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN12 = 0)
#define PB12_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN12 = 1)
#define PB13_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN13 = 0)
#define PB13_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN13 = 1)
#define PB14_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN14 = 0)
#define PB14_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN14 = 1)
#define PB15_DIGTAL_ENABLE()               (CW_GPIOB->ANALOG_f.PIN15 = 0)
#define PB15_ANALOG_ENABLE()               (CW_GPIOB->ANALOG_f.PIN15 = 1)

#define PC13_DIGTAL_ENABLE()               (CW_GPIOC->ANALOG_f.PIN13 = 0)
#define PC13_ANALOG_ENABLE()               (CW_GPIOC->ANALOG_f.PIN13 = 1)
#define PC14_DIGTAL_ENABLE()               (CW_GPIOC->ANALOG_f.PIN14 = 0)
#define PC14_ANALOG_ENABLE()               (CW_GPIOC->ANALOG_f.PIN14 = 1)
#define PC15_DIGTAL_ENABLE()               (CW_GPIOC->ANALOG_f.PIN15 = 0)
#define PC15_ANALOG_ENABLE()               (CW_GPIOC->ANALOG_f.PIN15 = 1)

#define PF00_DIGTAL_ENABLE()               (CW_GPIOF->ANALOG_f.PIN0  = 0)
#define PF00_ANALOG_ENABLE()               (CW_GPIOF->ANALOG_f.PIN0  = 1)
#define PF01_DIGTAL_ENABLE()               (CW_GPIOF->ANALOG_f.PIN1  = 0)
#define PF01_ANALOG_ENABLE()               (CW_GPIOF->ANALOG_f.PIN1  = 1)
#define PF03_DIGTAL_ENABLE()               (CW_GPIOF->ANALOG_f.PIN3  = 0)
#define PF03_ANALOG_ENABLE()               (CW_GPIOF->ANALOG_f.PIN3  = 1)
#define PF06_DIGTAL_ENABLE()               (CW_GPIOF->ANALOG_f.PIN6  = 0)
#define PF06_ANALOG_ENABLE()               (CW_GPIOF->ANALOG_f.PIN6  = 1)
#define PF07_DIGTAL_ENABLE()               (CW_GPIOF->ANALOG_f.PIN7  = 0)
#define PF07_ANALOG_ENABLE()               (CW_GPIOF->ANALOG_f.PIN7  = 1)

//============================================================
// INPUTAND OUTPUT
#define PA00_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN0 = 0)
#define PA00_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN0 = 1)
#define PA01_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN1 = 0)
#define PA01_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN1 = 1)
#define PA02_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN2 = 0)
#define PA02_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN2 = 1)
#define PA03_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN3 = 0)
#define PA03_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN3 = 1)
#define PA04_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN4 = 0)
#define PA04_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN4 = 1)
#define PA05_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN5 = 0)
#define PA05_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN5 = 1)
#define PA06_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN6 = 0)
#define PA06_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN6 = 1)
#define PA07_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN7 = 0)
#define PA07_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN7 = 1)
#define PA08_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN8 = 0)
#define PA08_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN8 = 1)
#define PA09_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN9  = 0)
#define PA09_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN9  = 1)
#define PA10_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN10 = 0)
#define PA10_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN10 = 1)
#define PA11_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN11 = 0)
#define PA11_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN11 = 1)
#define PA12_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN12 = 0)
#define PA12_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN12 = 1)
#define PA13_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN13 = 0)
#define PA13_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN13 = 1)
#define PA14_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN14 = 0)
#define PA14_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN14 = 1)
#define PA15_DIR_OUTPUT()                  (CW_GPIOA->DIR_f.PIN15 = 0)
#define PA15_DIR_INPUT()                   (CW_GPIOA->DIR_f.PIN15 = 1)

#define PB00_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN0 = 0)
#define PB00_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN0 = 1)
#define PB01_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN1 = 0)
#define PB01_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN1 = 1)
#define PB02_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN2 = 0)
#define PB02_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN2 = 1)
#define PB03_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN3 = 0)
#define PB03_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN3 = 1)
#define PB04_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN4 = 0)
#define PB04_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN4 = 1)
#define PB05_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN5 = 0)
#define PB05_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN5 = 1)
#define PB06_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN6 = 0)
#define PB06_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN6 = 1)
#define PB07_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN7 = 0)
#define PB07_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN7 = 1)
#define PB08_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN8  = 0)
#define PB08_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN8  = 1)
#define PB09_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN9  = 0)
#define PB09_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN9  = 1)
#define PB10_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN10 = 0)
#define PB10_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN10 = 1)
#define PB11_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN11 = 0)
#define PB11_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN11 = 1)
#define PB12_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN12 = 0)
#define PB12_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN12 = 1)
#define PB13_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN13 = 0)
#define PB13_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN13 = 1)
#define PB14_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN14 = 0)
#define PB14_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN14 = 1)
#define PB15_DIR_OUTPUT()                  (CW_GPIOB->DIR_f.PIN15 = 0)
#define PB15_DIR_INPUT()                   (CW_GPIOB->DIR_f.PIN15 = 1)

#define PC13_DIR_OUTPUT()                  (CW_GPIOC->DIR_f.PIN13 = 0)
#define PC13_DIR_INPUT()                   (CW_GPIOC->DIR_f.PIN13 = 1)
#define PC14_DIR_OUTPUT()                  (CW_GPIOC->DIR_f.PIN14 = 0)
#define PC14_DIR_INPUT()                   (CW_GPIOC->DIR_f.PIN14 = 1)
#define PC15_DIR_OUTPUT()                  (CW_GPIOC->DIR_f.PIN15 = 0)
#define PC15_DIR_INPUT()                   (CW_GPIOC->DIR_f.PIN15 = 1)

#define PF00_DIR_OUTPUT()                  (CW_GPIOF->DIR_f.PIN0  = 0)
#define PF00_DIR_INPUT()                   (CW_GPIOF->DIR_f.PIN0  = 1)
#define PF01_DIR_OUTPUT()                  (CW_GPIOF->DIR_f.PIN1  = 0)
#define PF01_DIR_INPUT()                   (CW_GPIOF->DIR_f.PIN1  = 1)
#define PF03_DIR_OUTPUT()                  (CW_GPIOF->DIR_f.PIN3  = 0)
#define PF03_DIR_INPUT()                   (CW_GPIOF->DIR_f.PIN3  = 1)
#define PF06_DIR_OUTPUT()                  (CW_GPIOF->DIR_f.PIN6  = 0)
#define PF06_DIR_INPUT()                   (CW_GPIOF->DIR_f.PIN6  = 1)
#define PF07_DIR_OUTPUT()                  (CW_GPIOF->DIR_f.PIN7  = 0)
#define PF07_DIR_INPUT()                   (CW_GPIOF->DIR_f.PIN7  = 1)

//============================================================
//push-pull or opendrain
#define PA00_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN0 = 0)
#define PA00_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN0 = 1)
#define PA01_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN1 = 0)
#define PA01_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN1 = 1)
#define PA02_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN2 = 0)
#define PA02_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN2 = 1)
#define PA03_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN3 = 0)
#define PA03_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN3 = 1)
#define PA04_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN4 = 0)
#define PA04_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN4 = 1)
#define PA05_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN5 = 0)
#define PA05_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN5 = 1)
#define PA06_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN6 = 0)
#define PA06_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN6 = 1)
#define PA07_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN7 = 0)
#define PA07_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN7 = 1)
#define PA08_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN8 = 0)
#define PA08_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN8 = 1)
#define PA09_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN9  = 0)
#define PA09_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN9  = 1)
#define PA10_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN10 = 0)
#define PA10_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN10 = 1)
#define PA11_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN11 = 0)
#define PA11_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN11 = 1)
#define PA12_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN12 = 0)
#define PA12_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN12 = 1)
#define PA13_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN13 = 0)
#define PA13_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN13 = 1)
#define PA14_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN14 = 0)
#define PA14_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN14 = 1)
#define PA15_PUSHPULL_ENABLE()             (CW_GPIOA->OPENDRAIN_f.PIN15 = 0)
#define PA15_OPENDRAIN_ENABLE()            (CW_GPIOA->OPENDRAIN_f.PIN15 = 1)

#define PB00_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN0 = 0)
#define PB00_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN0 = 1)
#define PB01_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN1 = 0)
#define PB01_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN1 = 1)
#define PB02_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN2 = 0)
#define PB02_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN2 = 1)
#define PB03_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN3 = 0)
#define PB03_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN3 = 1)
#define PB04_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN4 = 0)
#define PB04_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN4 = 1)
#define PB05_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN5 = 0)
#define PB05_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN5 = 1)
#define PB06_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN6 = 0)
#define PB06_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN6 = 1)
#define PB07_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN7 = 0)
#define PB07_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN7 = 1)
#define PB08_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN8  = 0)
#define PB08_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN8  = 1)
#define PB09_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN9  = 0)
#define PB09_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN9  = 1)
#define PB10_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN10 = 0)
#define PB10_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN10 = 1)
#define PB11_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN11 = 0)
#define PB11_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN11 = 1)
#define PB12_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN12 = 0)
#define PB12_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN12 = 1)
#define PB13_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN13 = 0)
#define PB13_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN13 = 1)
#define PB14_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN14 = 0)
#define PB14_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN14 = 1)
#define PB15_PUSHPULL_ENABLE()             (CW_GPIOB->OPENDRAIN_f.PIN15 = 0)
#define PB15_OPENDRAIN_ENABLE()            (CW_GPIOB->OPENDRAIN_f.PIN15 = 1)

#define PC13_PUSHPULL_ENABLE()             (CW_GPIOC->OPENDRAIN_f.PIN13 = 0)
#define PC13_OPENDRAIN_ENABLE()            (CW_GPIOC->OPENDRAIN_f.PIN13 = 1)
#define PC14_PUSHPULL_ENABLE()             (CW_GPIOC->OPENDRAIN_f.PIN14 = 0)
#define PC14_OPENDRAIN_ENABLE()            (CW_GPIOC->OPENDRAIN_f.PIN14 = 1)
#define PC15_PUSHPULL_ENABLE()             (CW_GPIOC->OPENDRAIN_f.PIN15 = 0)
#define PC15_OPENDRAIN_ENABLE()            (CW_GPIOC->OPENDRAIN_f.PIN15 = 1)

#define PF00_PUSHPULL_ENABLE()                  (CW_GPIOF->OPENDRAIN_f.PIN0  = 0)
#define PF00_OPENDRAIN_ENABLE()                 (CW_GPIOF->OPENDRAIN_f.PIN0  = 1)
#define PF01_PUSHPULL_ENABLE()                  (CW_GPIOF->OPENDRAIN_f.PIN1  = 0)
#define PF01_OPENDRAIN_ENABLE()                 (CW_GPIOF->OPENDRAIN_f.PIN1  = 1)
#define PF03_PUSHPULL_ENABLE()                  (CW_GPIOF->OPENDRAIN_f.PIN3  = 0)
#define PF03_OPENDRAIN_ENABLE()                 (CW_GPIOF->OPENDRAIN_f.PIN3  = 1)
#define PF06_PUSHPULL_ENABLE()                  (CW_GPIOF->OPENDRAIN_f.PIN6  = 0)
#define PF06_OPENDRAIN_ENABLE()                 (CW_GPIOF->OPENDRAIN_f.PIN6  = 1)
#define PF07_PUSHPULL_ENABLE()                  (CW_GPIOF->OPENDRAIN_f.PIN7  = 0)
#define PF07_OPENDRAIN_ENABLE()                 (CW_GPIOF->OPENDRAIN_f.PIN7  = 1)

//============================================================
//PUR
#define PA00_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN0 = 1)
#define PA00_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN0 = 0)
#define PA01_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN1 = 1)
#define PA01_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN1 = 0)
#define PA02_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN2 = 1)
#define PA02_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN2 = 0)
#define PA03_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN3 = 1)
#define PA03_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN3 = 0)
#define PA04_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN4 = 1)
#define PA04_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN4 = 0)
#define PA05_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN5 = 1)
#define PA05_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN5 = 0)
#define PA06_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN6 = 1)
#define PA06_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN6 = 0)
#define PA07_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN7 = 1)
#define PA07_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN7 = 0)
#define PA08_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN8 = 1)
#define PA08_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN8 = 0)
#define PA09_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN9  = 1)
#define PA09_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN9  = 0)
#define PA10_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN10 = 1)
#define PA10_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN10 = 0)
#define PA11_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN11 = 1)
#define PA11_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN11 = 0)
#define PA12_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN12 = 1)
#define PA12_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN12 = 0)
#define PA13_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN13 = 1)
#define PA13_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN13 = 0)
#define PA14_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN14 = 1)
#define PA14_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN14 = 0)
#define PA15_PUR_ENABLE()                  (CW_GPIOA->PUR_f.PIN15 = 1)
#define PA15_PUR_DISABLE()                 (CW_GPIOA->PUR_f.PIN15 = 0)

#define PB00_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN0 = 1)
#define PB00_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN0 = 0)
#define PB01_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN1 = 1)
#define PB01_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN1 = 0)
#define PB02_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN2 = 1)
#define PB02_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN2 = 0)
#define PB03_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN3 = 1)
#define PB03_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN3 = 0)
#define PB04_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN4 = 1)
#define PB04_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN4 = 0)
#define PB05_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN5 = 1)
#define PB05_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN5 = 0)
#define PB06_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN6 = 1)
#define PB06_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN6 = 0)
#define PB07_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN7 = 1)
#define PB07_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN7 = 0)
#define PB08_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN8  = 1)
#define PB08_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN8  = 0)
#define PB09_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN9  = 1)
#define PB09_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN9  = 0)
#define PB10_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN10 = 1)
#define PB10_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN10 = 0)
#define PB11_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN11 = 1)
#define PB11_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN11 = 0)
#define PB12_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN12 = 1)
#define PB12_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN12 = 0)
#define PB13_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN13 = 1)
#define PB13_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN13 = 0)
#define PB14_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN14 = 1)
#define PB14_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN14 = 0)
#define PB15_PUR_ENABLE()                  (CW_GPIOB->PUR_f.PIN15 = 1)
#define PB15_PUR_DISABLE()                 (CW_GPIOB->PUR_f.PIN15 = 0)

#define PC13_PUR_ENABLE()                  (CW_GPIOC->PUR_f.PIN13 = 1)
#define PC13_PUR_DISABLE()                 (CW_GPIOC->PUR_f.PIN13 = 0)
#define PC14_PUR_ENABLE()                  (CW_GPIOC->PUR_f.PIN14 = 1)
#define PC14_PUR_DISABLE()                 (CW_GPIOC->PUR_f.PIN14 = 0)
#define PC15_PUR_ENABLE()                  (CW_GPIOC->PUR_f.PIN15 = 1)
#define PC15_PUR_DISABLE()                 (CW_GPIOC->PUR_f.PIN15 = 0)

#define PF00_PUR_ENABLE()                  (CW_GPIOF->PUR_f.PIN0  = 1)
#define PF00_PUR_DISABLE()                 (CW_GPIOF->PUR_f.PIN0  = 0)
#define PF01_PUR_ENABLE()                  (CW_GPIOF->PUR_f.PIN1  = 1)
#define PF01_PUR_DISABLE()                 (CW_GPIOF->PUR_f.PIN1  = 0)
#define PF03_PUR_ENABLE()                  (CW_GPIOF->PUR_f.PIN3  = 1)
#define PF03_PUR_DISABLE()                 (CW_GPIOF->PUR_f.PIN3  = 0)
#define PF06_PUR_ENABLE()                  (CW_GPIOF->PUR_f.PIN6  = 1)
#define PF06_PUR_DISABLE()                 (CW_GPIOF->PUR_f.PIN6  = 0)
#define PF07_PUR_ENABLE()                  (CW_GPIOF->PUR_f.PIN7  = 1)
#define PF07_PUR_DISABLE()                 (CW_GPIOF->PUR_f.PIN7  = 0)

//============================================================
//PDR
#define PF03_PDR_ENABLE()                       (CW_GPIOF->PDR_f.PIN3  = 1)
#define PF03_PDR_DISABLE()                      (CW_GPIOF->PDR_f.PIN3  = 0)

//============================================================
// GETVALUE
#define PA00_GETVALUE()                    !!(CW_GPIOA->IDR & bv0)
#define PA01_GETVALUE()                    !!(CW_GPIOA->IDR & bv1)
#define PA02_GETVALUE()                    !!(CW_GPIOA->IDR & bv2)
#define PA03_GETVALUE()                    !!(CW_GPIOA->IDR & bv3)
#define PA04_GETVALUE()                    !!(CW_GPIOA->IDR & bv4)
#define PA05_GETVALUE()                    !!(CW_GPIOA->IDR & bv5)
#define PA06_GETVALUE()                    !!(CW_GPIOA->IDR & bv6)
#define PA07_GETVALUE()                    !!(CW_GPIOA->IDR & bv7)
#define PA08_GETVALUE()                    !!(CW_GPIOA->IDR & bv8)
#define PA09_GETVALUE()                    !!(CW_GPIOA->IDR & bv9)
#define PA10_GETVALUE()                    !!(CW_GPIOA->IDR & bv10)
#define PA11_GETVALUE()                    !!(CW_GPIOA->IDR & bv11)
#define PA12_GETVALUE()                    !!(CW_GPIOA->IDR & bv12)
#define PA13_GETVALUE()                    !!(CW_GPIOA->IDR & bv13)
#define PA14_GETVALUE()                    !!(CW_GPIOA->IDR & bv14)
#define PA15_GETVALUE()                    !!(CW_GPIOA->IDR & bv15)

#define PB00_GETVALUE()                    !!(CW_GPIOB->IDR & bv0)
#define PB01_GETVALUE()                    !!(CW_GPIOB->IDR & bv1)
#define PB02_GETVALUE()                    !!(CW_GPIOB->IDR & bv2)
#define PB03_GETVALUE()                    !!(CW_GPIOB->IDR & bv3)
#define PB04_GETVALUE()                    !!(CW_GPIOB->IDR & bv4)
#define PB05_GETVALUE()                    !!(CW_GPIOB->IDR & bv5)
#define PB06_GETVALUE()                    !!(CW_GPIOB->IDR & bv6)
#define PB07_GETVALUE()                    !!(CW_GPIOB->IDR & bv7)
#define PB08_GETVALUE()                    !!(CW_GPIOB->IDR & bv8)
#define PB09_GETVALUE()                    !!(CW_GPIOB->IDR & bv9)
#define PB10_GETVALUE()                    !!(CW_GPIOB->IDR & bv10)
#define PB11_GETVALUE()                    !!(CW_GPIOB->IDR & bv11)
#define PB12_GETVALUE()                    !!(CW_GPIOB->IDR & bv12)
#define PB13_GETVALUE()                    !!(CW_GPIOB->IDR & bv13)
#define PB14_GETVALUE()                    !!(CW_GPIOB->IDR & bv14)
#define PB15_GETVALUE()                    !!(CW_GPIOB->IDR & bv15)

#define PC13_GETVALUE()                    !!(CW_GPIOC->IDR & bv13)
#define PC14_GETVALUE()                    !!(CW_GPIOC->IDR & bv14)
#define PC15_GETVALUE()                    !!(CW_GPIOC->IDR & bv15)

#define PF00_GETVALUE()                    !!(CW_GPIOF->IDR & bv0)
#define PF01_GETVALUE()                    !!(CW_GPIOF->IDR & bv1)
#define PF03_GETVALUE()                    !!(CW_GPIOF->IDR & bv3)
#define PF06_GETVALUE()                    !!(CW_GPIOF->IDR & bv6)
#define PF07_GETVALUE()                    !!(CW_GPIOF->IDR & bv7)

//============================================================
// SET HIGH AND LOW
#define PA00_SETHIGH()                     (CW_GPIOA->BSRR = bv0)
#define PA00_SETLOW()                      (CW_GPIOA->BRR = bv0)
#define PA01_SETHIGH()                     (CW_GPIOA->BSRR = bv1)
#define PA01_SETLOW()                      (CW_GPIOA->BRR = bv1)
#define PA02_SETHIGH()                     (CW_GPIOA->BSRR = bv2)
#define PA02_SETLOW()                      (CW_GPIOA->BRR = bv2)
#define PA03_SETHIGH()                     (CW_GPIOA->BSRR = bv3)
#define PA03_SETLOW()                      (CW_GPIOA->BRR = bv3)
#define PA04_SETHIGH()                     (CW_GPIOA->BSRR = bv4)
#define PA04_SETLOW()                      (CW_GPIOA->BRR = bv4)
#define PA05_SETHIGH()                     (CW_GPIOA->BSRR = bv5)
#define PA05_SETLOW()                      (CW_GPIOA->BRR = bv5)
#define PA06_SETHIGH()                     (CW_GPIOA->BSRR = bv6)
#define PA06_SETLOW()                      (CW_GPIOA->BRR = bv6)
#define PA07_SETHIGH()                     (CW_GPIOA->BSRR = bv7)
#define PA07_SETLOW()                      (CW_GPIOA->BRR = bv7)
#define PA08_SETHIGH()                     (CW_GPIOA->BSRR = bv8)
#define PA08_SETLOW()                      (CW_GPIOA->BRR = bv8)
#define PA09_SETHIGH()                     (CW_GPIOA->BSRR = bv9)
#define PA09_SETLOW()                      (CW_GPIOA->BRR  = bv9)
#define PA10_SETHIGH()                     (CW_GPIOA->BSRR = bv10)
#define PA10_SETLOW()                      (CW_GPIOA->BRR  = bv10)
#define PA11_SETHIGH()                     (CW_GPIOA->BSRR = bv11)
#define PA11_SETLOW()                      (CW_GPIOA->BRR  = bv11)
#define PA12_SETHIGH()                     (CW_GPIOA->BSRR = bv12)
#define PA12_SETLOW()                      (CW_GPIOA->BRR  = bv12)
#define PA13_SETHIGH()                     (CW_GPIOA->BSRR = bv13)
#define PA13_SETLOW()                      (CW_GPIOA->BRR  = bv13)
#define PA14_SETHIGH()                     (CW_GPIOA->BSRR = bv14)
#define PA14_SETLOW()                      (CW_GPIOA->BRR  = bv14)
#define PA15_SETHIGH()                     (CW_GPIOA->BSRR = bv15)
#define PA15_SETLOW()                      (CW_GPIOA->BRR  = bv15)

#define PB00_SETHIGH()                     (CW_GPIOB->BSRR = bv0)
#define PB00_SETLOW()                      (CW_GPIOB->BRR = bv0)
#define PB01_SETHIGH()                     (CW_GPIOB->BSRR = bv1)
#define PB01_SETLOW()                      (CW_GPIOB->BRR = bv1)
#define PB02_SETHIGH()                     (CW_GPIOB->BSRR = bv2)
#define PB02_SETLOW()                      (CW_GPIOB->BRR = bv2)
#define PB03_SETHIGH()                     (CW_GPIOB->BSRR = bv3)
#define PB03_SETLOW()                      (CW_GPIOB->BRR = bv3)
#define PB04_SETHIGH()                     (CW_GPIOB->BSRR = bv4)
#define PB04_SETLOW()                      (CW_GPIOB->BRR = bv4)
#define PB05_SETHIGH()                     (CW_GPIOB->BSRR = bv5)
#define PB05_SETLOW()                      (CW_GPIOB->BRR = bv5)
#define PB06_SETHIGH()                     (CW_GPIOB->BSRR = bv6)
#define PB06_SETLOW()                      (CW_GPIOB->BRR = bv6)
#define PB07_SETHIGH()                     (CW_GPIOB->BSRR = bv7)
#define PB07_SETLOW()                      (CW_GPIOB->BRR = bv7)
#define PB08_SETHIGH()                     (CW_GPIOB->BSRR = bv8)
#define PB08_SETLOW()                      (CW_GPIOB->BRR  = bv8)
#define PB09_SETHIGH()                     (CW_GPIOB->BSRR = bv9)
#define PB09_SETLOW()                      (CW_GPIOB->BRR  = bv9)
#define PB10_SETHIGH()                     (CW_GPIOB->BSRR = bv10)
#define PB10_SETLOW()                      (CW_GPIOB->BRR  = bv10)
#define PB11_SETHIGH()                     (CW_GPIOB->BSRR = bv11)
#define PB11_SETLOW()                      (CW_GPIOB->BRR  = bv11)
#define PB12_SETHIGH()                     (CW_GPIOB->BSRR = bv12)
#define PB12_SETLOW()                      (CW_GPIOB->BRR  = bv12)
#define PB13_SETHIGH()                     (CW_GPIOB->BSRR = bv13)
#define PB13_SETLOW()                      (CW_GPIOB->BRR  = bv13)
#define PB14_SETHIGH()                     (CW_GPIOB->BSRR = bv14)
#define PB14_SETLOW()                      (CW_GPIOB->BRR  = bv14)
#define PB15_SETHIGH()                     (CW_GPIOB->BSRR = bv15)
#define PB15_SETLOW()                      (CW_GPIOB->BRR  = bv15)

#define PC13_SETHIGH()                     (CW_GPIOC->BSRR = bv13)
#define PC13_SETLOW()                      (CW_GPIOC->BRR  = bv13)
#define PC14_SETHIGH()                     (CW_GPIOC->BSRR = bv14)
#define PC14_SETLOW()                      (CW_GPIOC->BRR  = bv14)
#define PC15_SETHIGH()                     (CW_GPIOC->BSRR = bv15)
#define PC15_SETLOW()                      (CW_GPIOC->BRR  = bv15)

#define PF00_SETHIGH()                     (CW_GPIOF->BSRR = bv0)
#define PF00_SETLOW()                      (CW_GPIOF->BRR  = bv0)
#define PF01_SETHIGH()                     (CW_GPIOF->BSRR = bv1)
#define PF01_SETLOW()                      (CW_GPIOF->BRR  = bv1)
#define PF03_SETHIGH()                     (CW_GPIOF->BSRR = bv3)
#define PF03_SETLOW()                      (CW_GPIOF->BRR  = bv3)
#define PF06_SETHIGH()                     (CW_GPIOF->BSRR = bv6)
#define PF06_SETLOW()                      (CW_GPIOF->BRR  = bv6)
#define PF07_SETHIGH()                     (CW_GPIOF->BSRR = bv7)
#define PF07_SETLOW()                      (CW_GPIOF->BRR  = bv7)


//============================================================
// TOG
#define PA00_TOG()                         (CW_GPIOA->TOG = bv0)
#define PA01_TOG()                         (CW_GPIOA->TOG = bv1)
#define PA02_TOG()                         (CW_GPIOA->TOG = bv2)
#define PA03_TOG()                         (CW_GPIOA->TOG = bv3)
#define PA04_TOG()                         (CW_GPIOA->TOG = bv4)
#define PA05_TOG()                         (CW_GPIOA->TOG = bv5)
#define PA06_TOG()                         (CW_GPIOA->TOG = bv6)
#define PA07_TOG()                         (CW_GPIOA->TOG = bv7)
#define PA08_TOG()                         (CW_GPIOA->TOG = bv8)
#define PA09_TOG()                         (CW_GPIOA->TOG = bv9)
#define PA10_TOG()                         (CW_GPIOA->TOG = bv10)
#define PA11_TOG()                         (CW_GPIOA->TOG = bv11)
#define PA12_TOG()                         (CW_GPIOA->TOG = bv12)
#define PA13_TOG()                         (CW_GPIOA->TOG = bv13)
#define PA14_TOG()                         (CW_GPIOA->TOG = bv14)
#define PA15_TOG()                         (CW_GPIOA->TOG = bv15)

#define PB00_TOG()                         (CW_GPIOB->TOG = bv0)
#define PB01_TOG()                         (CW_GPIOB->TOG = bv1)
#define PB02_TOG()                         (CW_GPIOB->TOG = bv2)
#define PB03_TOG()                         (CW_GPIOB->TOG = bv3)
#define PB04_TOG()                         (CW_GPIOB->TOG = bv4)
#define PB05_TOG()                         (CW_GPIOB->TOG = bv5)
#define PB06_TOG()                         (CW_GPIOB->TOG = bv6)
#define PB07_TOG()                         (CW_GPIOB->TOG = bv7)
#define PB08_TOG()                         (CW_GPIOB->TOG = bv8)
#define PB09_TOG()                         (CW_GPIOB->TOG = bv9)
#define PB10_TOG()                         (CW_GPIOB->TOG = bv10)
#define PB11_TOG()                         (CW_GPIOB->TOG = bv11)
#define PB12_TOG()                         (CW_GPIOB->TOG = bv12)
#define PB13_TOG()                         (CW_GPIOB->TOG = bv13)
#define PB14_TOG()                         (CW_GPIOB->TOG = bv14)
#define PB15_TOG()                         (CW_GPIOB->TOG = bv15)

#define PC13_TOG()                         (CW_GPIOC->TOG = bv13)
#define PC14_TOG()                         (CW_GPIOC->TOG = bv14)
#define PC15_TOG()                         (CW_GPIOC->TOG = bv15)

#define PF00_TOG()                         (CW_GPIOF->TOG = bv0)
#define PF01_TOG()                         (CW_GPIOF->TOG = bv1)
#define PF03_TOG()                         (CW_GPIOF->TOG = bv3)
#define PF06_TOG()                         (CW_GPIOF->TOG = bv6)
#define PF07_TOG()                         (CW_GPIOF->TOG = bv7)

//============================================================
// GPIOA
#define PA00_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN0 = 0)
#define PA00_AFx_UART1CTS()                (CW_GPIOA->AFRL_f.PIN0 = 1)
#define PA00_AFx_UART3RXD()                (CW_GPIOA->AFRL_f.PIN0 = 2)
#define PA00_AFx_RTCTAMP()                 (CW_GPIOA->AFRL_f.PIN0 = 3)
#define PA00_AFx_VC1OUT()                  (CW_GPIOA->AFRL_f.PIN0 = 4)
#define PA00_AFx_BTIM3TOGN()               (CW_GPIOA->AFRL_f.PIN0 = 5)
#define PA00_AFx_GTIM2CH1()                (CW_GPIOA->AFRL_f.PIN0 = 6)
#define PA00_AFx_ATIMBKIN()                (CW_GPIOA->AFRL_f.PIN0 = 7)
#define PA00_AFx_SPI2MISO()                (CW_GPIOA->AFRL_f.PIN0 = 8)
#define PA00_AFx_VC3OUT()                  (CW_GPIOA->AFRL_f.PIN0 = 9)
#define PA01_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN1 = 0)
#define PA01_AFx_UART1RTS()                (CW_GPIOA->AFRL_f.PIN1 = 1)
#define PA01_AFx_UART3TXD()                (CW_GPIOA->AFRL_f.PIN1 = 2)
#define PA01_AFx_RTCOUT()                  (CW_GPIOA->AFRL_f.PIN1 = 3)
#define PA01_AFx_HEXEN()                   (CW_GPIOA->AFRL_f.PIN1 = 4)
#define PA01_AFx_BTIM3TOGP()               (CW_GPIOA->AFRL_f.PIN1 = 5)
#define PA01_AFx_GTIM2CH2()                (CW_GPIOA->AFRL_f.PIN1 = 6)
#define PA01_AFx_ATIMETR()                 (CW_GPIOA->AFRL_f.PIN1 = 7)
#define PA01_AFx_SPI2MOSI()                (CW_GPIOA->AFRL_f.PIN1 = 8)
#define PA02_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN2 = 0)
#define PA02_AFx_UART1TXD()                (CW_GPIOA->AFRL_f.PIN2 = 1)
#define PA02_AFx_UART2TXD()                (CW_GPIOA->AFRL_f.PIN2 = 2)
#define PA02_AFx_BTIM2ETR()                (CW_GPIOA->AFRL_f.PIN2 = 3)
#define PA02_AFx_VC2OUT()                  (CW_GPIOA->AFRL_f.PIN2 = 4)
#define PA02_AFx_LPTIMCH1()                (CW_GPIOA->AFRL_f.PIN2 = 5)
#define PA02_AFx_GTIM2CH3()                (CW_GPIOA->AFRL_f.PIN2 = 6)
#define PA02_AFx_ATIMCH4N()                (CW_GPIOA->AFRL_f.PIN2 = 7)
#define PA02_AFx_SPI2SCK()                 (CW_GPIOA->AFRL_f.PIN2 = 8)
#define PA03_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN3 = 0)
#define PA03_AFx_UART1RXD()                (CW_GPIOA->AFRL_f.PIN3 = 1)
#define PA03_AFx_UART2RXD()                (CW_GPIOA->AFRL_f.PIN3 = 2)
#define PA03_AFx_RTCOUT()                  (CW_GPIOA->AFRL_f.PIN3 = 3)
#define PA03_AFx_PCLKOUT()                 (CW_GPIOA->AFRL_f.PIN3 = 4)
#define PA03_AFx_LPTIMCH2()                (CW_GPIOA->AFRL_f.PIN3 = 5)
#define PA03_AFx_GTIM2CH4()                (CW_GPIOA->AFRL_f.PIN3 = 6)
#define PA03_AFx_ATIMCH4()                 (CW_GPIOA->AFRL_f.PIN3 = 7)
#define PA03_AFx_SPI2NCS()                 (CW_GPIOA->AFRL_f.PIN3 = 8)
#define PA03_AFx_HALLTIMCH1()              (CW_GPIOA->AFRL_f.PIN3 = 9)
#define PA04_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN4 = 0)
#define PA04_AFx_UART3TXD()                (CW_GPIOA->AFRL_f.PIN4 = 1)
#define PA04_AFx_I2C1SCL()                 (CW_GPIOA->AFRL_f.PIN4 = 2)
#define PA04_AFx_SPI1NCS()                 (CW_GPIOA->AFRL_f.PIN4 = 3)
#define PA04_AFx_MCOOUT()                  (CW_GPIOA->AFRL_f.PIN4 = 4)
#define PA04_AFx_LPTIMOUT()                (CW_GPIOA->AFRL_f.PIN4 = 5)
#define PA04_AFx_ADC2SAM()                 (CW_GPIOA->AFRL_f.PIN4 = 6)
#define PA04_AFx_ATIMCH2N()                (CW_GPIOA->AFRL_f.PIN4 = 7)
#define PA04_AFx_GTIM3CH1()                (CW_GPIOA->AFRL_f.PIN4 = 8)
#define PA04_AFx_HALLTIMCH2()              (CW_GPIOA->AFRL_f.PIN4 = 9)
#define PA05_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN5 = 0)
#define PA05_AFx_UART3RXD()                (CW_GPIOA->AFRL_f.PIN5 = 1)
#define PA05_AFx_I2C1SDA()                 (CW_GPIOA->AFRL_f.PIN5 = 2)
#define PA05_AFx_SPI1SCK()                 (CW_GPIOA->AFRL_f.PIN5 = 3)
#define PA05_AFx_BTIM2TOGN()               (CW_GPIOA->AFRL_f.PIN5 = 4)
#define PA05_AFx_LPTIMETR()                (CW_GPIOA->AFRL_f.PIN5 = 5)
#define PA05_AFx_GTIM1CH3()                (CW_GPIOA->AFRL_f.PIN5 = 6)
#define PA05_AFx_ATIMCH1()                 (CW_GPIOA->AFRL_f.PIN5 = 7)
#define PA05_AFx_GTIM3CH2()                (CW_GPIOA->AFRL_f.PIN5 = 8)
#define PA05_AFx_HALLTIMCH3()              (CW_GPIOA->AFRL_f.PIN5 = 9)
#define PA06_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN6 = 0)
#define PA06_AFx_UART2RXD()                (CW_GPIOA->AFRL_f.PIN6 = 1)
#define PA06_AFx_BTIM1ETR()                (CW_GPIOA->AFRL_f.PIN6 = 2)
#define PA06_AFx_SPI1MISO()                (CW_GPIOA->AFRL_f.PIN6 = 3)
#define PA06_AFx_BTIM2TOGP()               (CW_GPIOA->AFRL_f.PIN6 = 4)
#define PA06_AFx_LPTIMCH1()                (CW_GPIOA->AFRL_f.PIN6 = 5)
#define PA06_AFx_GTIM1CH1()                (CW_GPIOA->AFRL_f.PIN6 = 6)
#define PA06_AFx_ATIMBKIN()                (CW_GPIOA->AFRL_f.PIN6 = 7)
#define PA06_AFx_GTIM3CH3()                (CW_GPIOA->AFRL_f.PIN6 = 8)
#define PA07_AFx_GPIO()                    (CW_GPIOA->AFRL_f.PIN7 = 0)
#define PA07_AFx_UART2TXD()                (CW_GPIOA->AFRL_f.PIN7 = 1)
#define PA07_AFx_GTIM2ETR()                (CW_GPIOA->AFRL_f.PIN7 = 2)
#define PA07_AFx_SPI1MOSI()                (CW_GPIOA->AFRL_f.PIN7 = 3)
#define PA07_AFx_BTIM1TOGN()               (CW_GPIOA->AFRL_f.PIN7 = 4)
#define PA07_AFx_LPTIMCH2()                (CW_GPIOA->AFRL_f.PIN7 = 5)
#define PA07_AFx_GTIM1CH2()                (CW_GPIOA->AFRL_f.PIN7 = 6)
#define PA07_AFx_ATIMCH1N()                (CW_GPIOA->AFRL_f.PIN7 = 7)
#define PA07_AFx_GTIM3CH4()                (CW_GPIOA->AFRL_f.PIN7 = 8)
#define PA08_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN8 = 0)
#define PA08_AFx_UART3TXD()                (CW_GPIOA->AFRH_f.PIN8 = 1)
#define PA08_AFx_VC4OUT()                  (CW_GPIOA->AFRH_f.PIN8 = 2)
#define PA08_AFx_IROUT()                   (CW_GPIOA->AFRH_f.PIN8 = 3)
#define PA08_AFx_MCOOUT()                  (CW_GPIOA->AFRH_f.PIN8 = 4)
#define PA08_AFx_BTIM2TOGP()               (CW_GPIOA->AFRH_f.PIN8 = 5)
#define PA08_AFx_LVDOUT()                  (CW_GPIOA->AFRH_f.PIN8 = 6)
#define PA08_AFx_ATIMCH1()                 (CW_GPIOA->AFRH_f.PIN8 = 7)
#define PA08_AFx_SPI3NCS()                 (CW_GPIOA->AFRH_f.PIN8 = 8)
#define PA08_AFx_GTIM4ETR()                (CW_GPIOA->AFRH_f.PIN8 = 9)
#define PA09_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN9 = 0)
#define PA09_AFx_UART1TXD()                (CW_GPIOA->AFRH_f.PIN9 = 1)
#define PA09_AFx_UART3RXD()                (CW_GPIOA->AFRH_f.PIN9 = 2)
#define PA09_AFx_SPI1NCS()                 (CW_GPIOA->AFRH_f.PIN9 = 3)
#define PA09_AFx_I2C1SCL()                 (CW_GPIOA->AFRH_f.PIN9 = 4)
#define PA09_AFx_LPTIMETR()                (CW_GPIOA->AFRH_f.PIN9 = 5)
#define PA09_AFx_BTIM1TOGN()               (CW_GPIOA->AFRH_f.PIN9 = 6)
#define PA09_AFx_ATIMCH2()                 (CW_GPIOA->AFRH_f.PIN9 = 7)
#define PA09_AFx_SPI3SCK()                 (CW_GPIOA->AFRH_f.PIN9 = 8)
#define PA09_AFx_GTIM4CH1()                (CW_GPIOA->AFRH_f.PIN9 = 9)
#define PA10_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN10 = 0)
#define PA10_AFx_UART1RXD()                (CW_GPIOA->AFRH_f.PIN10 = 1)
#define PA10_AFx_BTIM3ETR()                (CW_GPIOA->AFRH_f.PIN10 = 2)
#define PA10_AFx_SPI1SCK()                 (CW_GPIOA->AFRH_f.PIN10 = 3)
#define PA10_AFx_I2C1SDA()                 (CW_GPIOA->AFRH_f.PIN10 = 4)
#define PA10_AFx_LPTIMOUT()                (CW_GPIOA->AFRH_f.PIN10 = 5)
#define PA10_AFx_BTIM1TOGP()               (CW_GPIOA->AFRH_f.PIN10 = 6)
#define PA10_AFx_ATIMCH3()                 (CW_GPIOA->AFRH_f.PIN10 = 7)
#define PA10_AFx_SPI3MISO()                (CW_GPIOA->AFRH_f.PIN10 = 8)
#define PA10_AFx_GTIM4CH2()                (CW_GPIOA->AFRH_f.PIN10 = 9)
#define PA11_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN11 = 0)
#define PA11_AFx_UART1CTS()                (CW_GPIOA->AFRH_f.PIN11 = 1)
#define PA11_AFx_VC1OUT()                  (CW_GPIOA->AFRH_f.PIN11 = 2)
#define PA11_AFx_SPI1MISO()                (CW_GPIOA->AFRH_f.PIN11 = 3)
#define PA11_AFx_HEXEN()                   (CW_GPIOA->AFRH_f.PIN11 = 4)
#define PA11_AFx_ATIMBK2IN()               (CW_GPIOA->AFRH_f.PIN11 = 5)
#define PA11_AFx_GTIM2CH2()                (CW_GPIOA->AFRH_f.PIN11 = 6)
#define PA11_AFx_ATIMCH4()                 (CW_GPIOA->AFRH_f.PIN11 = 7)
#define PA11_AFx_SPI3MOSI()                (CW_GPIOA->AFRH_f.PIN11 = 8)
#define PA11_AFx_GTIM4CH3()                (CW_GPIOA->AFRH_f.PIN11 = 9)
#define PA12_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN12 = 0)
#define PA12_AFx_UART1RTS()                (CW_GPIOA->AFRH_f.PIN12 = 1)
#define PA12_AFx_VC2OUT()                  (CW_GPIOA->AFRH_f.PIN12 = 2)
#define PA12_AFx_SPI1MOSI()                (CW_GPIOA->AFRH_f.PIN12 = 3)
#define PA12_AFx_BTIM3ETR()                (CW_GPIOA->AFRH_f.PIN12 = 4)
#define PA12_AFx_ATIMBKIN()                (CW_GPIOA->AFRH_f.PIN12 = 5)
#define PA12_AFx_GTIM2CH3()                (CW_GPIOA->AFRH_f.PIN12 = 6)
#define PA12_AFx_ATIMETR()                 (CW_GPIOA->AFRH_f.PIN12 = 7)
#define PA12_AFx_GTIM3ETR()                (CW_GPIOA->AFRH_f.PIN12 = 8)
#define PA12_AFx_GTIM4CH4()                (CW_GPIOA->AFRH_f.PIN12 = 9)
#define PA13_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN13 = 0)
#define PA13_AFx_UART1RXD()                (CW_GPIOA->AFRH_f.PIN13 = 1)
#define PA13_AFx_UART3TXD()                (CW_GPIOA->AFRH_f.PIN13 = 2)
#define PA13_AFx_UART2RTS()                (CW_GPIOA->AFRH_f.PIN13 = 3)
#define PA13_AFx_I2C1SDA()                 (CW_GPIOA->AFRH_f.PIN13 = 4)
#define PA13_AFx_ATIMBKIN()                (CW_GPIOA->AFRH_f.PIN13 = 5)
#define PA13_AFx_IROUT()                   (CW_GPIOA->AFRH_f.PIN13 = 6)
#define PA13_AFx_ATIMCH6()                 (CW_GPIOA->AFRH_f.PIN13 = 7)
#define PA13_AFx_ATIMCH5N()                (CW_GPIOA->AFRH_f.PIN13 = 8)
#define PA14_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN14 = 0)
#define PA14_AFx_UART1TXD()                (CW_GPIOA->AFRH_f.PIN14 = 1)
#define PA14_AFx_UART3RXD()                (CW_GPIOA->AFRH_f.PIN14 = 2)
#define PA14_AFx_UART2CTS()                (CW_GPIOA->AFRH_f.PIN14 = 3)
#define PA14_AFx_I2C1SCL()                 (CW_GPIOA->AFRH_f.PIN14 = 4)
#define PA14_AFx_ATIMBK2IN()               (CW_GPIOA->AFRH_f.PIN14 = 5)
#define PA14_AFx_GTIM1ETR()                (CW_GPIOA->AFRH_f.PIN14 = 6)
#define PA14_AFx_ATIMCH6N()                (CW_GPIOA->AFRH_f.PIN14 = 7)
#define PA14_AFx_ATIMCH5()                 (CW_GPIOA->AFRH_f.PIN14 = 8)
#define PA15_AFx_GPIO()                    (CW_GPIOA->AFRH_f.PIN15 = 0)
#define PA15_AFx_UART1RXD()                (CW_GPIOA->AFRH_f.PIN15 = 1)
#define PA15_AFx_UART2RXD()                (CW_GPIOA->AFRH_f.PIN15 = 2)
#define PA15_AFx_SPI1NCS()                 (CW_GPIOA->AFRH_f.PIN15 = 3)
#define PA15_AFx_ATIMBKOUT()               (CW_GPIOA->AFRH_f.PIN15 = 4)
#define PA15_AFx_GTIM2CH1()                (CW_GPIOA->AFRH_f.PIN15 = 5)
#define PA15_AFx_GTIM2ETR()                (CW_GPIOA->AFRH_f.PIN15 = 6)
#define PA15_AFx_ATIMCH1N()                (CW_GPIOA->AFRH_f.PIN15 = 7)
#define PA15_AFx_GTIM3CH1()                (CW_GPIOA->AFRH_f.PIN15 = 8)
#define PA15_AFx_SPI2SCK()                 (CW_GPIOA->AFRH_f.PIN15 = 9)

//============================================================
// GPIOB
#define PB00_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN0 = 0)
#define PB00_AFx_UART1RXD()                (CW_GPIOB->AFRL_f.PIN0 = 1)
#define PB00_AFx_UART2TXD()                (CW_GPIOB->AFRL_f.PIN0 = 2)
#define PB00_AFx_HSIOSCOUT()               (CW_GPIOB->AFRL_f.PIN0 = 3)
#define PB00_AFx_BTIM1TOGP()               (CW_GPIOB->AFRL_f.PIN0 = 4)
#define PB00_AFx_ATIMETR()                 (CW_GPIOB->AFRL_f.PIN0 = 5)
#define PB00_AFx_GTIM1CH3()                (CW_GPIOB->AFRL_f.PIN0 = 6)
#define PB00_AFx_ATIMCH2N()                (CW_GPIOB->AFRL_f.PIN0 = 7)
#define PB00_AFx_I2C2SCL()                 (CW_GPIOB->AFRL_f.PIN0 = 8)
#define PB00_AFx_HALLTIMOUT()              (CW_GPIOB->AFRL_f.PIN0 = 9)
#define PB01_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN1 = 0)
#define PB01_AFx_UART1TXD()                (CW_GPIOB->AFRL_f.PIN1 = 1)
#define PB01_AFx_UART2RXD()                (CW_GPIOB->AFRL_f.PIN1 = 2)
#define PB01_AFx_RTCTAMP()                 (CW_GPIOB->AFRL_f.PIN1 = 3)
#define PB01_AFx_IROUT()                   (CW_GPIOB->AFRL_f.PIN1 = 4)
#define PB01_AFx_BTIM3TOGN()               (CW_GPIOB->AFRL_f.PIN1 = 5)
#define PB01_AFx_GTIM1CH4()                (CW_GPIOB->AFRL_f.PIN1 = 6)
#define PB01_AFx_ATIMCH3N()                (CW_GPIOB->AFRL_f.PIN1 = 7)
#define PB01_AFx_I2C2SDA()                 (CW_GPIOB->AFRL_f.PIN1 = 8)
#define PB01_AFx_HALLTIMTRGO()             (CW_GPIOB->AFRL_f.PIN1 = 9)
#define PB02_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN2 = 0)
#define PB02_AFx_UART3TXD()                (CW_GPIOB->AFRL_f.PIN2 = 1)
#define PB02_AFx_UART2CTS()                (CW_GPIOB->AFRL_f.PIN2 = 2)
#define PB02_AFx_ATIMBKOUT()               (CW_GPIOB->AFRL_f.PIN2 = 3)
#define PB02_AFx_HSEOUT()                  (CW_GPIOB->AFRL_f.PIN2 = 4)
#define PB02_AFx_BTIM3TOGP()               (CW_GPIOB->AFRL_f.PIN2 = 5)
#define PB02_AFx_GTIM1ETR()                (CW_GPIOB->AFRL_f.PIN2 = 6)
#define PB02_AFx_ATIMCH1()                 (CW_GPIOB->AFRL_f.PIN2 = 7)
#define PB02_AFx_GTIM3TRGO()               (CW_GPIOB->AFRL_f.PIN2 = 8)
#define PB02_AFx_HALLTIMCH1()              (CW_GPIOB->AFRL_f.PIN2 = 9)
#define PB03_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN3 = 0)
#define PB03_AFx_UART1TXD()                (CW_GPIOB->AFRL_f.PIN3 = 1)
#define PB03_AFx_UART2TXD()                (CW_GPIOB->AFRL_f.PIN3 = 2)
#define PB03_AFx_SPI1SCK()                 (CW_GPIOB->AFRL_f.PIN3 = 3)
#define PB03_AFx_UART3CTS()                (CW_GPIOB->AFRL_f.PIN3 = 4)
#define PB03_AFx_GTIM2CH2()                (CW_GPIOB->AFRL_f.PIN3 = 5)
#define PB03_AFx_GTIM1ETR()                (CW_GPIOB->AFRL_f.PIN3 = 6)
#define PB03_AFx_ATIMCH2N()                (CW_GPIOB->AFRL_f.PIN3 = 7)
#define PB03_AFx_GTIM3CH2()                (CW_GPIOB->AFRL_f.PIN3 = 8)
#define PB03_AFx_SPI2MISO()                (CW_GPIOB->AFRL_f.PIN3 = 9)
#define PB04_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN4 = 0)
#define PB04_AFx_UART3TXD()                (CW_GPIOB->AFRL_f.PIN4 = 1)
#define PB04_AFx_UART2CTS()                (CW_GPIOB->AFRL_f.PIN4 = 2)
#define PB04_AFx_SPI1MISO()                (CW_GPIOB->AFRL_f.PIN4 = 3)
#define PB04_AFx_UART3RTS()                (CW_GPIOB->AFRL_f.PIN4 = 4)
#define PB04_AFx_ATIMETR()                 (CW_GPIOB->AFRL_f.PIN4 = 5)
#define PB04_AFx_GTIM1CH1()                (CW_GPIOB->AFRL_f.PIN4 = 6)
#define PB04_AFx_ATIMCH3N()                (CW_GPIOB->AFRL_f.PIN4 = 7)
#define PB04_AFx_GTIM3CH3()                (CW_GPIOB->AFRL_f.PIN4 = 8)
#define PB04_AFx_SPI2MOSI()                (CW_GPIOB->AFRL_f.PIN4 = 9)
#define PB05_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN5 = 0)
#define PB05_AFx_UART3RXD()                (CW_GPIOB->AFRL_f.PIN5 = 1)
#define PB05_AFx_UART2RTS()                (CW_GPIOB->AFRL_f.PIN5 = 2)
#define PB05_AFx_SPI1MOSI()                (CW_GPIOB->AFRL_f.PIN5 = 3)
#define PB05_AFx_ADC1SAM()                 (CW_GPIOB->AFRL_f.PIN5 = 4)
#define PB05_AFx_ATIMBKIN()                (CW_GPIOB->AFRL_f.PIN5 = 5)
#define PB05_AFx_GTIM1CH2()                (CW_GPIOB->AFRL_f.PIN5 = 6)
#define PB05_AFx_ATIMCH1()                 (CW_GPIOB->AFRL_f.PIN5 = 7)
#define PB05_AFx_GTIM3CH4()                (CW_GPIOB->AFRL_f.PIN5 = 8)
#define PB05_AFx_HALLTIMCH1()              (CW_GPIOB->AFRL_f.PIN5 = 9)
#define PB06_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN6 = 0)
#define PB06_AFx_UART1TXD()                (CW_GPIOB->AFRL_f.PIN6 = 1)
#define PB06_AFx_UART2RXD()                (CW_GPIOB->AFRL_f.PIN6 = 2)
#define PB06_AFx_I2C1SCL()                 (CW_GPIOB->AFRL_f.PIN6 = 3)
#define PB06_AFx_BTIM3TOGN()               (CW_GPIOB->AFRL_f.PIN6 = 4)
#define PB06_AFx_GTIM2CH3()                (CW_GPIOB->AFRL_f.PIN6 = 5)
#define PB06_AFx_GTIM1CH3()                (CW_GPIOB->AFRL_f.PIN6 = 6)
#define PB06_AFx_ATIMCH2()                 (CW_GPIOB->AFRL_f.PIN6 = 7)
#define PB06_AFx_SPI3MOSI()                (CW_GPIOB->AFRL_f.PIN6 = 8)
#define PB06_AFx_HALLTIMCH2()              (CW_GPIOB->AFRL_f.PIN6 = 9)
#define PB07_AFx_GPIO()                    (CW_GPIOB->AFRL_f.PIN7 = 0)
#define PB07_AFx_UART1RXD()                (CW_GPIOB->AFRL_f.PIN7 = 1)
#define PB07_AFx_UART2TXD()                (CW_GPIOB->AFRL_f.PIN7 = 2)
#define PB07_AFx_I2C1SDA()                 (CW_GPIOB->AFRL_f.PIN7 = 3)
#define PB07_AFx_BTIM3TOGP()               (CW_GPIOB->AFRL_f.PIN7 = 4)
#define PB07_AFx_GTIM2CH4()                (CW_GPIOB->AFRL_f.PIN7 = 5)
#define PB07_AFx_GTIM1CH4()                (CW_GPIOB->AFRL_f.PIN7 = 6)
#define PB07_AFx_ATIMCH3()                 (CW_GPIOB->AFRL_f.PIN7 = 7)
#define PB07_AFx_SPI3MISO()                (CW_GPIOB->AFRL_f.PIN7 = 8)
#define PB07_AFx_HALLTIMCH3()              (CW_GPIOB->AFRL_f.PIN7 = 9)
#define PB08_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN8 = 0)
#define PB08_AFx_UART2RXD()                (CW_GPIOB->AFRH_f.PIN8 = 1)
#define PB08_AFx_UART3TXD()                (CW_GPIOB->AFRH_f.PIN8 = 2)
#define PB08_AFx_I2C1SCL()                 (CW_GPIOB->AFRH_f.PIN8 = 3)
#define PB08_AFx_ADC2SAM()                 (CW_GPIOB->AFRH_f.PIN8 = 4)
#define PB08_AFx_ATIMCH4N()                (CW_GPIOB->AFRH_f.PIN8 = 5)
#define PB08_AFx_GTIM1CH3()                (CW_GPIOB->AFRH_f.PIN8 = 6)
#define PB08_AFx_ATIMETR()                 (CW_GPIOB->AFRH_f.PIN8 = 7)
#define PB08_AFx_SPI3SCK()                 (CW_GPIOB->AFRH_f.PIN8 = 8)
#define PB09_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN9 = 0)
#define PB09_AFx_UART2TXD()                (CW_GPIOB->AFRH_f.PIN9 = 1)
#define PB09_AFx_UART3RXD()                (CW_GPIOB->AFRH_f.PIN9 = 2)
#define PB09_AFx_I2C1SDA()                 (CW_GPIOB->AFRH_f.PIN9 = 3)
#define PB09_AFx_IROUT()                   (CW_GPIOB->AFRH_f.PIN9 = 4)
#define PB09_AFx_ATIMCH4()                 (CW_GPIOB->AFRH_f.PIN9 = 5)
#define PB09_AFx_GTIM1CH4()                (CW_GPIOB->AFRH_f.PIN9 = 6)
#define PB09_AFx_ATIMBKIN()                (CW_GPIOB->AFRH_f.PIN9 = 7)
#define PB09_AFx_SPI3NCS()                 (CW_GPIOB->AFRH_f.PIN9 = 8)
#define PB10_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN10 = 0)
#define PB10_AFx_UART3RXD()                (CW_GPIOB->AFRH_f.PIN10 = 1)
#define PB10_AFx_UART2RTS()                (CW_GPIOB->AFRH_f.PIN10 = 2)
#define PB10_AFx_I2C1SCL()                 (CW_GPIOB->AFRH_f.PIN10 = 3)
#define PB10_AFx_ATIMBK2IN()               (CW_GPIOB->AFRH_f.PIN10 = 4)
#define PB10_AFx_VC4OUT()                  (CW_GPIOB->AFRH_f.PIN10 = 5)
#define PB10_AFx_GTIM2CH3()                (CW_GPIOB->AFRH_f.PIN10 = 6)
#define PB10_AFx_ATIMCH2()                 (CW_GPIOB->AFRH_f.PIN10 = 7)
#define PB10_AFx_I2C2SCL()                 (CW_GPIOB->AFRH_f.PIN10 = 8)
#define PB10_AFx_HALLTIMCH2()              (CW_GPIOB->AFRH_f.PIN10 = 9)
#define PB11_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN11 = 0)
#define PB11_AFx_UART1RXD()                (CW_GPIOB->AFRH_f.PIN11 = 1)
#define PB11_AFx_ATIMBK2OUT()              (CW_GPIOB->AFRH_f.PIN11 = 2)
#define PB11_AFx_I2C1SDA()                 (CW_GPIOB->AFRH_f.PIN11 = 3)
#define PB11_AFx_LSIOUT()                  (CW_GPIOB->AFRH_f.PIN11 = 4)
#define PB11_AFx_BTIM1ETR()                (CW_GPIOB->AFRH_f.PIN11 = 5)
#define PB11_AFx_GTIM2CH4()                (CW_GPIOB->AFRH_f.PIN11 = 6)
#define PB11_AFx_ATIMCH3()                 (CW_GPIOB->AFRH_f.PIN11 = 7)
#define PB11_AFx_I2C2SDA()                 (CW_GPIOB->AFRH_f.PIN11 = 8)
#define PB11_AFx_HALLTIMCH3()              (CW_GPIOB->AFRH_f.PIN11 = 9)
#define PB12_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN12 = 0)
#define PB12_AFx_UART1TXD()                (CW_GPIOB->AFRH_f.PIN12 = 1)
#define PB12_AFx_LPTIMOUT()                (CW_GPIOB->AFRH_f.PIN12 = 2)
#define PB12_AFx_SPI1NCS()                 (CW_GPIOB->AFRH_f.PIN12 = 3)
#define PB12_AFx_LSEOUT()                  (CW_GPIOB->AFRH_f.PIN12 = 4)
#define PB12_AFx_VC1OUT()                  (CW_GPIOB->AFRH_f.PIN12 = 5)
#define PB12_AFx_ATIMTRGO()                (CW_GPIOB->AFRH_f.PIN12 = 6)
#define PB12_AFx_ATIMBKIN()                (CW_GPIOB->AFRH_f.PIN12 = 7)
#define PB12_AFx_SPI2NCS()                 (CW_GPIOB->AFRH_f.PIN12 = 8)
#define PB12_AFx_HALLTIMOUT()              (CW_GPIOB->AFRH_f.PIN12 = 9)
#define PB13_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN13 = 0)
#define PB13_AFx_UART2RXD()                (CW_GPIOB->AFRH_f.PIN13 = 1)
#define PB13_AFx_LPTIMETR()                (CW_GPIOB->AFRH_f.PIN13 = 2)
#define PB13_AFx_SPI1SCK()                 (CW_GPIOB->AFRH_f.PIN13 = 3)
#define PB13_AFx_ATIMBK2IN()               (CW_GPIOB->AFRH_f.PIN13 = 4)
#define PB13_AFx_VC2OUT()                  (CW_GPIOB->AFRH_f.PIN13 = 5)
#define PB13_AFx_ATIMTRGO2()               (CW_GPIOB->AFRH_f.PIN13 = 6)
#define PB13_AFx_ATIMCH1N()                (CW_GPIOB->AFRH_f.PIN13 = 7)
#define PB13_AFx_SPI2SCK()                 (CW_GPIOB->AFRH_f.PIN13 = 8)
#define PB13_AFx_HALLTIMCH1()              (CW_GPIOB->AFRH_f.PIN13 = 9)
#define PB14_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN14 = 0)
#define PB14_AFx_UART2TXD()                (CW_GPIOB->AFRH_f.PIN14 = 1)
#define PB14_AFx_LPTIMCH2()                (CW_GPIOB->AFRH_f.PIN14 = 2)
#define PB14_AFx_SPI1MISO()                (CW_GPIOB->AFRH_f.PIN14 = 3)
#define PB14_AFx_RTCOUT()                  (CW_GPIOB->AFRH_f.PIN14 = 4)
#define PB14_AFx_VC3OUT()                  (CW_GPIOB->AFRH_f.PIN14 = 5)
#define PB14_AFx_GTIM2CH1()                (CW_GPIOB->AFRH_f.PIN14 = 6)
#define PB14_AFx_ATIMCH2N()                (CW_GPIOB->AFRH_f.PIN14 = 7)
#define PB14_AFx_SPI2MISO()                (CW_GPIOB->AFRH_f.PIN14 = 8)
#define PB14_AFx_HALLTIMCH2()              (CW_GPIOB->AFRH_f.PIN14 = 9)
#define PB15_AFx_GPIO()                    (CW_GPIOB->AFRH_f.PIN15 = 0)
#define PB15_AFx_UART3RXD()                (CW_GPIOB->AFRH_f.PIN15 = 1)
#define PB15_AFx_LPTIMCH1()                (CW_GPIOB->AFRH_f.PIN15 = 2)
#define PB15_AFx_SPI1MOSI()                (CW_GPIOB->AFRH_f.PIN15 = 3)
#define PB15_AFx_RTCOUT()                  (CW_GPIOB->AFRH_f.PIN15 = 4)
#define PB15_AFx_BTIM2TOGN()               (CW_GPIOB->AFRH_f.PIN15 = 5)
#define PB15_AFx_GTIM2CH2()                (CW_GPIOB->AFRH_f.PIN15 = 6)
#define PB15_AFx_ATIMCH3N()                (CW_GPIOB->AFRH_f.PIN15 = 7)
#define PB15_AFx_SPI2MOSI()                (CW_GPIOB->AFRH_f.PIN15 = 8)
#define PB15_AFx_HALLTIMCH3()              (CW_GPIOB->AFRH_f.PIN15 = 9)

//============================================================
// GPIOC
#define PC13_AFx_GPIO()                    (CW_GPIOC->AFRH_f.PIN13 = 0)
#define PC13_AFx_MCOOUT()                  (CW_GPIOC->AFRH_f.PIN13 = 1)
#define PC13_AFx_RTCTAMP()                 (CW_GPIOC->AFRH_f.PIN13 = 3)
#define PC13_AFx_RTCOUT()                  (CW_GPIOC->AFRH_f.PIN13 = 4)
#define PC13_AFx_BTIM2ETR()                (CW_GPIOC->AFRH_f.PIN13 = 5)
#define PC13_AFx_ATIMBKIN()                (CW_GPIOC->AFRH_f.PIN13 = 6)
#define PC13_AFx_ATIMETR()                 (CW_GPIOC->AFRH_f.PIN13 = 7)
#define PC13_AFx_GTIM3ETR()                (CW_GPIOC->AFRH_f.PIN13 = 8)
#define PC13_AFx_GTIM4ETR()                (CW_GPIOC->AFRH_f.PIN13 = 9)
#define PC14_AFx_GPIO()                    (CW_GPIOC->AFRH_f.PIN14 = 0)
#define PC14_AFx_UART1RXD()                (CW_GPIOC->AFRH_f.PIN14 = 1)
#define PC14_AFx_UART2RXD()                (CW_GPIOC->AFRH_f.PIN14 = 2)
#define PC14_AFx_UART3CTS()                (CW_GPIOC->AFRH_f.PIN14 = 3)
#define PC14_AFx_I2C1SDA()                 (CW_GPIOC->AFRH_f.PIN14 = 4)
#define PC14_AFx_BTIM2TOGN()               (CW_GPIOC->AFRH_f.PIN14 = 5)
#define PC14_AFx_ATIMCH6()                 (CW_GPIOC->AFRH_f.PIN14 = 6)
#define PC14_AFx_ATIMCH5N()                (CW_GPIOC->AFRH_f.PIN14 = 7)
#define PC14_AFx_SPI3MISO()                (CW_GPIOC->AFRH_f.PIN14 = 8)
#define PC14_AFx_GTIM4CH1()                (CW_GPIOC->AFRH_f.PIN14 = 9)
#define PC15_AFx_GPIO()                    (CW_GPIOC->AFRH_f.PIN15 = 0)
#define PC15_AFx_UART1TXD()                (CW_GPIOC->AFRH_f.PIN15 = 1)
#define PC15_AFx_UART2TXD()                (CW_GPIOC->AFRH_f.PIN15 = 2)
#define PC15_AFx_UART3RTS()                (CW_GPIOC->AFRH_f.PIN15 = 3)
#define PC15_AFx_I2C1SCL()                 (CW_GPIOC->AFRH_f.PIN15 = 4)
#define PC15_AFx_BTIM2TOGP()               (CW_GPIOC->AFRH_f.PIN15 = 5)
#define PC15_AFx_ATIMCH6N()                (CW_GPIOC->AFRH_f.PIN15 = 6)
#define PC15_AFx_ATIMCH5()                 (CW_GPIOC->AFRH_f.PIN15 = 7)
#define PC15_AFx_SPI3MOSI()                (CW_GPIOC->AFRH_f.PIN15 = 8)
#define PC15_AFx_GTIM4CH2()                (CW_GPIOC->AFRH_f.PIN15 = 9)

//============================================================
// GPIOF
#define PF00_AFx_GPIO()                    (CW_GPIOF->AFRL_f.PIN0 = 0)
#define PF00_AFx_UART1RXD()                (CW_GPIOF->AFRL_f.PIN0 = 1)
#define PF00_AFx_I2C1SDA()                 (CW_GPIOF->AFRL_f.PIN0 = 4)
#define PF00_AFx_BTIM1TOGN()               (CW_GPIOF->AFRL_f.PIN0 = 5)
#define PF00_AFx_GTIM1TRGO()               (CW_GPIOF->AFRL_f.PIN0 = 6)
#define PF00_AFx_ATIMCH6N()                (CW_GPIOF->AFRL_f.PIN0 = 7)
#define PF00_AFx_SPI3SCK()                 (CW_GPIOF->AFRL_f.PIN0 = 8)
#define PF00_AFx_GTIM4CH3()                (CW_GPIOF->AFRL_f.PIN0 = 9)
#define PF01_AFx_GPIO()                    (CW_GPIOF->AFRL_f.PIN1 = 0)
#define PF01_AFx_UART1TXD()                (CW_GPIOF->AFRL_f.PIN1 = 1)
#define PF01_AFx_HEXEN()                   (CW_GPIOF->AFRL_f.PIN1 = 2)
#define PF01_AFx_LSEOUT()                  (CW_GPIOF->AFRL_f.PIN1 = 3)
#define PF01_AFx_I2C1SCL()                 (CW_GPIOF->AFRL_f.PIN1 = 4)
#define PF01_AFx_BTIM1TOGP()               (CW_GPIOF->AFRL_f.PIN1 = 5)
#define PF01_AFx_GTIM2TRGO()               (CW_GPIOF->AFRL_f.PIN1 = 6)
#define PF01_AFx_ATIMCH6()                 (CW_GPIOF->AFRL_f.PIN1 = 7)
#define PF01_AFx_SPI3NCS()                 (CW_GPIOF->AFRL_f.PIN1 = 8)
#define PF01_AFx_GTIM4CH4()                (CW_GPIOF->AFRL_f.PIN1 = 9)
#define PF03_AFx_GPIO()                    (CW_GPIOF->AFRL_f.PIN3 = 0)
#define PF03_AFx_LSEOUT()                  (CW_GPIOF->AFRL_f.PIN3 = 1)
#define PF03_AFx_LSIOUT()                  (CW_GPIOF->AFRL_f.PIN3 = 2)
#define PF03_AFx_ADC1SAM()                 (CW_GPIOF->AFRL_f.PIN3 = 3)
#define PF03_AFx_LVDOUT()                  (CW_GPIOF->AFRL_f.PIN3 = 4)
#define PF03_AFx_HCLKOUT()                 (CW_GPIOF->AFRL_f.PIN3 = 5)
#define PF03_AFx_ATIMTRGO()                (CW_GPIOF->AFRL_f.PIN3 = 6)
#define PF03_AFx_IROUT()                   (CW_GPIOF->AFRL_f.PIN3 = 7)
#define PF03_AFx_GTIM3TRGO()               (CW_GPIOF->AFRL_f.PIN3 = 8)
#define PF03_AFx_GTIM4TRGO()               (CW_GPIOF->AFRL_f.PIN3 = 9)
#define PF06_AFx_GPIO()                    (CW_GPIOF->AFRL_f.PIN6 = 0)
#define PF06_AFx_UART1CTS()                (CW_GPIOF->AFRL_f.PIN6 = 1)
#define PF06_AFx_UART3RXD()                (CW_GPIOF->AFRL_f.PIN6 = 2)
#define PF06_AFx_UART2CTS()                (CW_GPIOF->AFRL_f.PIN6 = 3)
#define PF06_AFx_I2C1SCL()                 (CW_GPIOF->AFRL_f.PIN6 = 4)
#define PF06_AFx_BTIM3TOGN()               (CW_GPIOF->AFRL_f.PIN6 = 5)
#define PF06_AFx_GTIM2TRGO()               (CW_GPIOF->AFRL_f.PIN6 = 6)
#define PF06_AFx_ATIMCH5()                 (CW_GPIOF->AFRL_f.PIN6 = 7)
#define PF06_AFx_I2C2SCL()                 (CW_GPIOF->AFRL_f.PIN6 = 8)
#define PF06_AFx_GTIM4TRGO()               (CW_GPIOF->AFRL_f.PIN6 = 9)
#define PF07_AFx_GPIO()                    (CW_GPIOF->AFRL_f.PIN7 = 0)
#define PF07_AFx_UART1RTS()                (CW_GPIOF->AFRL_f.PIN7 = 1)
#define PF07_AFx_UART3TXD()                (CW_GPIOF->AFRL_f.PIN7 = 2)
#define PF07_AFx_UART2RTS()                (CW_GPIOF->AFRL_f.PIN7 = 3)
#define PF07_AFx_I2C1SDA()                 (CW_GPIOF->AFRL_f.PIN7 = 4)
#define PF07_AFx_BTIM3TOGP()               (CW_GPIOF->AFRL_f.PIN7 = 5)
#define PF07_AFx_GTIM1TRGO()               (CW_GPIOF->AFRL_f.PIN7 = 6)
#define PF07_AFx_ATIMCH5N()                (CW_GPIOF->AFRL_f.PIN7 = 7)
#define PF07_AFx_I2C2SDA()                 (CW_GPIOF->AFRL_f.PIN7 = 8)
#define PF07_AFx_SPI2NCS()                 (CW_GPIOF->AFRL_f.PIN7 = 9)


//============================================================

void GPIO_SWD2GPIO(void);
void GPIO_GPIO2SWD(void);
void GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pins);
void GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init);
void GPIO_ConfigFilter(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pins, uint32_t FltClk);
void GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pins, GPIO_PinState PinState);
void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t Value);
void GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pins);
GPIO_PinState GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin);
void GPIO_SetAlternateFunction(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint16_t GPIO_AFx);

#ifdef __cplusplus
}
#endif

#endif
