2024-09-05 10:01:45 +08:00
|
|
|
#ifndef __DRV_GPIO_H__
|
|
|
|
#define __DRV_GPIO_H__
|
2024-08-22 16:24:54 +08:00
|
|
|
|
2024-09-05 10:01:45 +08:00
|
|
|
#include <rtthread.h>
|
|
|
|
#include "ciu32l051.h"
|
|
|
|
|
|
|
|
#ifdef RT_USING_PIN
|
|
|
|
|
2024-09-05 15:30:19 +08:00
|
|
|
#define __CIU_PORT(port) (GPIO##port##_BASE)
|
2024-09-05 10:01:45 +08:00
|
|
|
|
2024-09-05 15:30:19 +08:00
|
|
|
#define GET_PIN(port, pin) (rt_base_t)((16 * (((rt_base_t)__CIU_PORT(port) - (rt_base_t)GPIOA_BASE) / (0x0400UL))) + pin)
|
2024-09-05 10:01:45 +08:00
|
|
|
|
2024-09-05 15:30:19 +08:00
|
|
|
#define __CIU32_PIN(index, gpio, gpio_index) {index, GPIO##gpio, GPIO_PIN_##gpio_index}
|
2024-09-05 10:01:45 +08:00
|
|
|
|
2024-09-05 15:30:19 +08:00
|
|
|
/*uart1*/
|
|
|
|
#define UART1_TX_GPIO_PIN GPIO_PIN_11
|
|
|
|
#define UART1_TX_GPIO_PORT GPIOA
|
2024-09-05 10:01:45 +08:00
|
|
|
|
2024-09-05 15:30:19 +08:00
|
|
|
#define UART1_RX_GPIO_PIN GPIO_PIN_12
|
|
|
|
#define UART1_RX_GPIO_PORT GPIOA
|
|
|
|
|
|
|
|
/* LPUART1*/
|
|
|
|
#define LPUART1_TX_GPIO_PIN GPIO_PIN_11
|
|
|
|
#define LPUART1_TX_GPIO_PORT GPIOB
|
|
|
|
|
|
|
|
#define LPUART1_RX_GPIO_PIN GPIO_PIN_10
|
|
|
|
#define LPUART1_RX_GPIO_PORT GPIOB
|
|
|
|
|
|
|
|
/*voice 引脚*/
|
|
|
|
#define VOICE_CLK_PIN GET_PIN(C, 9)
|
|
|
|
#define VOICE_DATA_PIN GET_PIN(A, 8)
|
|
|
|
#define VOICE_BUSY_PIN GET_PIN(C, 8)
|
|
|
|
|
|
|
|
/*按键*/
|
|
|
|
#define BUTTON_0 GET_PIN(C, 11)
|
|
|
|
|
|
|
|
/*LED*/
|
|
|
|
#define RED_LED_PIN GET_PIN(B, 4)
|
|
|
|
#define GREEN_LED_PIN GET_PIN(B, 8)
|
|
|
|
#define YELLOW_LED_PIN GET_PIN(B, 6)
|
|
|
|
|
|
|
|
/*联动设备*/
|
|
|
|
#define EMV_LED_PIN GET_PIN(B, 0)
|
|
|
|
#define FJ_LED_PIN GET_PIN(B, 1)
|
|
|
|
|
|
|
|
struct pin_index
|
2024-09-05 10:01:45 +08:00
|
|
|
{
|
|
|
|
int index;
|
2024-09-05 15:30:19 +08:00
|
|
|
GPIO_t *gpio;
|
2024-09-05 10:01:45 +08:00
|
|
|
uint32_t pin;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // !
|