25 lines
470 B
C
25 lines
470 B
C
#ifndef __DRV_GPIO_H__
|
|
#define __DRV_GPIO_H__
|
|
|
|
#include <rtthread.h>
|
|
#include "ciu32l051.h"
|
|
|
|
#ifdef RT_USING_PIN
|
|
|
|
#define __CIU_PORT(port) (GPIO##port##_BASE)
|
|
|
|
#define GET_PIN(port, pin) (rt_base_t)((16 * (((rt_base_t)__CIU_PORT(port) - (rt_base_t)GPIOA_BASE) / (0x0400UL))) + pin)
|
|
|
|
|
|
#define __CIU32_PIN(index, gpio, gpio_index) {index, GPIO##gpio, GPIO_PIN_##gpio_index}
|
|
|
|
struct pin_index
|
|
{
|
|
int index;
|
|
GPIO_t* gpio;
|
|
uint32_t pin;
|
|
};
|
|
#endif
|
|
|
|
#endif // !
|