2022-04-04 11:07:49 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* Change Logs:
|
2022-08-25 22:24:53 +08:00
|
|
|
* Date Author Notes
|
|
|
|
* 2022-08-25 liYony first version
|
2022-04-04 11:07:49 +08:00
|
|
|
*/
|
|
|
|
|
2022-08-25 22:24:53 +08:00
|
|
|
#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;
|
|
|
|
};
|
2022-04-04 11:07:49 +08:00
|
|
|
|
|
|
|
int rt_hw_pin_init(void);
|
|
|
|
|
2022-08-25 22:24:53 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2022-04-04 11:07:49 +08:00
|
|
|
#endif
|
2022-08-25 22:24:53 +08:00
|
|
|
|
|
|
|
#endif /* __DRV_GPIO_H__ */
|