summaryrefslogtreecommitdiff
path: root/bsp/ht32/libraries/ht32_drivers/drv_gpio.h
blob: 01ec12fc247c198c52a427b732c692131138f1c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
 * Copyright (c) 2006-2024, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-04-08     QT-one       first version
 */

#ifndef __DRV_GPIO_H__
#define __DRV_GPIO_H__

#include <rthw.h>
#include <rtdevice.h>
#include "drv_common.h"

#ifdef __cplusplus
extern "C" {
#endif

#define __HT32_PORT(port)  HT_GPIO##port##_BASE

#define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__HT32_PORT(PORTx) - (rt_base_t)HT_GPIOA_BASE)/(0x2000UL) )) + PIN)

#ifdef __cplusplus
}
#endif

#endif /* __DRV_GPIO_H__ */