[rtduino][lpc55s69] 添加RTduino所需i2c引脚定义及结构体对象声明 (#6984)
This commit is contained in:
parent
c5cb58383c
commit
ae0296e802
@ -21,6 +21,9 @@
|
||||
|
||||
enum
|
||||
{
|
||||
#ifdef BSP_USING_I2C1
|
||||
I2C1_INDEX,
|
||||
#endif
|
||||
#ifdef BSP_USING_I2C4
|
||||
I2C4_INDEX,
|
||||
#endif
|
||||
@ -48,6 +51,17 @@ struct lpc_i2c_bus
|
||||
|
||||
struct lpc_i2c_bus lpc_obj[] =
|
||||
{
|
||||
#ifdef BSP_USING_I2C1
|
||||
{
|
||||
.I2C = I2C1,
|
||||
.DMA = DMA0,
|
||||
.dma_chl = 12,
|
||||
.device_name = "i2c1",
|
||||
.baud = 100000U,
|
||||
.instance = 1U,
|
||||
.i2c_clock_id = kFRO12M_to_FLEXCOMM1,
|
||||
},
|
||||
#endif
|
||||
#ifdef BSP_USING_I2C4
|
||||
{
|
||||
.I2C = I2C4,
|
||||
|
@ -102,7 +102,7 @@ void get_mma8562(uint8_t data)
|
||||
|
||||
rt_kprintf("*** MMA8562 X %d, Y %d, Z %d\r\n", (accel.x), (accel.y), (accel.z) );
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(get_mma8562, get mma8562. e.g: get_mma8562(0))
|
||||
MSH_CMD_EXPORT(get_mma8562, get mma8562. e.g: get_mma8562(0))
|
||||
#endif
|
||||
|
||||
int mma8562_hw_init(void)
|
||||
|
@ -45,7 +45,7 @@ Hardware Drivers Config --->
|
||||
| 18 (A2) | -- | 是/否 | |
|
||||
| 19 (A3) | P(1,31) | 是/否 | |
|
||||
| 20 (A4) | P(0,13) | 是/否 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 |
|
||||
| 21 (A5) | P(1,14) | 是/否 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 |
|
||||
| 21 (A5) | P(0,14) | 是/否 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 |
|
||||
| 22 (A6) | -- | | 芯片内部参考电压 ADC,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
| 23 (A7) | -- | | 芯片内部温度 ADC,默认被RT-Thread的ADC设备框架adc1接管 |
|
||||
|
||||
|
@ -44,7 +44,7 @@ const pin_map_t pin_map_table[]=
|
||||
{A2, RT_NULL},
|
||||
{A3, GET_PINS(1,31)},
|
||||
{A4, GET_PINS(0,13), "i2c1"}, /* I2C-SDA (Wire) */
|
||||
{A5, GET_PINS(1,14), "i2c1"}, /* I2C-SCL (Wire) */
|
||||
{A5, GET_PINS(0,14), "i2c1"}, /* I2C-SCL (Wire) */
|
||||
{A6, RT_NULL, "adc0", 13}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
|
||||
{A7, RT_NULL, "adc0", 26}, /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
|
||||
};
|
||||
|
@ -47,7 +47,7 @@ menu "On-chip Peripheral Drivers"
|
||||
default n
|
||||
if BSP_USING_UART1
|
||||
choice
|
||||
prompt "Select UART2 badurate"
|
||||
prompt "Select UART1 badurate"
|
||||
default HW_UART1_BAUDRATE_115200
|
||||
|
||||
config HW_UART1_BAUDRATE_9600
|
||||
|
@ -76,6 +76,32 @@ void BOARD_InitPins(void)
|
||||
/* Enables the clock for the I/O controller.: Enable Clock. */
|
||||
CLOCK_EnableClock(kCLOCK_Iocon);
|
||||
|
||||
IOCON->PIO[0][13] = ((IOCON->PIO[0][13] &
|
||||
/* Mask bits to zero which are setting */
|
||||
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
|
||||
|
||||
/* Selects pin function.
|
||||
* : PORT013 (pin 71) is configured as FC1_RXD_SDA_MOSI_DATA. */
|
||||
| IOCON_PIO_FUNC(PIO0_13_FUNC_ALT5)
|
||||
|
||||
/* Select Digital mode.
|
||||
* : Enable Digital mode.
|
||||
* Digital input is enabled. */
|
||||
| IOCON_PIO_DIGIMODE(PIO0_13_DIGIMODE_DIGITAL));
|
||||
|
||||
IOCON->PIO[0][14] = ((IOCON->PIO[0][14] &
|
||||
/* Mask bits to zero which are setting */
|
||||
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
|
||||
|
||||
/* Selects pin function.
|
||||
* : PORT014 (pin 72) is configured as FC1_TXD_SCL_MISO_WS. */
|
||||
| IOCON_PIO_FUNC(PIO0_14_FUNC_ALT6)
|
||||
|
||||
/* Select Digital mode.
|
||||
* : Enable Digital mode.
|
||||
* Digital input is enabled. */
|
||||
| IOCON_PIO_DIGIMODE(PIO0_14_DIGIMODE_DIGITAL));
|
||||
|
||||
IOCON->PIO[0][17] = ((IOCON->PIO[0][17] &
|
||||
/* Mask bits to zero which are setting */
|
||||
(~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))
|
||||
@ -319,7 +345,6 @@ void BOARD_InitPins(void)
|
||||
* : Digital mode, digital input is enabled. */
|
||||
| IOCON_PIO_DIGIMODE(PIO1_7_DIGIMODE_DIGITAL));
|
||||
|
||||
|
||||
/* I2C4 */
|
||||
IOCON_PinMuxSet(IOCON, 1U, 20, 5 | IOCON_PIO_MODE_INACT | IOCON_PIO_SLEW_STANDARD | IOCON_PIO_INV_DI | IOCON_PIO_DIGITAL_EN | IOCON_PIO_OPENDRAIN_DI);
|
||||
IOCON_PinMuxSet(IOCON, 1U, 21, 5 | IOCON_PIO_MODE_INACT | IOCON_PIO_SLEW_STANDARD | IOCON_PIO_INV_DI | IOCON_PIO_DIGITAL_EN | IOCON_PIO_OPENDRAIN_DI);
|
||||
|
@ -43,6 +43,18 @@ void BOARD_InitBootPins(void);
|
||||
/*!
|
||||
* @brief Standard mode, output slew rate control is enabled */
|
||||
#define IOCON_PIO_SLEW_STANDARD 0x00u
|
||||
/*!
|
||||
* @brief Select Digital mode.: Enable Digital mode. Digital input is enabled. */
|
||||
#define PIO0_13_DIGIMODE_DIGITAL 0x01u
|
||||
/*!
|
||||
* @brief Selects pin function.: Alternative connection 5. */
|
||||
#define PIO0_13_FUNC_ALT5 0x05u
|
||||
/*!
|
||||
* @brief Select Digital mode.: Enable Digital mode. Digital input is enabled. */
|
||||
#define PIO0_14_DIGIMODE_DIGITAL 0x01u
|
||||
/*!
|
||||
* @brief Selects pin function.: Alternative connection 6. */
|
||||
#define PIO0_14_FUNC_ALT6 0x06u
|
||||
/*!
|
||||
* @brief Select Digital mode.: Digital mode, digital input is enabled. */
|
||||
#define PIO0_17_DIGIMODE_DIGITAL 0x01u
|
||||
|
Loading…
x
Reference in New Issue
Block a user