drv_gpio.h 699 字节
Newer Older
B
blta 已提交
1 2 3 4 5 6
/*
 * Copyright (c) 2006-2022, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
7 8
 * Date           Author       Notes
 * 2022-08-25     liYony       first version
B
blta 已提交
9 10
 */

11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
#ifndef __DRV_GPIO_H__
#define __DRV_GPIO_H__

#include <board.h>
#include <rtthread.h>
#include "rtdevice.h"
#include <rthw.h>

#ifdef __cplusplus
extern "C" {
#endif

#define __CH32_PORT(port)  GPIO##port##_BASE
#define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__CH32_PORT(PORTx) - (rt_base_t)GPIOA_BASE)/(0x0400UL) )) + PIN)

struct pin_irq_map
{
    rt_uint16_t pinbit;
    IRQn_Type irqno;
};
B
blta 已提交
31 32 33

int rt_hw_pin_init(void);

34 35
#ifdef __cplusplus
}
B
blta 已提交
36
#endif
37 38

#endif /* __DRV_GPIO_H__ */