[bsp][imxrt1052] add hardware i2c

This commit is contained in:
balanceTWK
2018-04-05 11:44:25 +08:00
parent f06f50f4ba
commit 6d63451e38
4 changed files with 538 additions and 92 deletions
+53 -1
View File
@@ -93,7 +93,7 @@ menu "Select spi bus drivers"
config LPSPI_CLK_SOURCE_DIVIDER
int "SPI bus clock source divider"
range 0 8
range 1 8
default 7
config RT_USING_SPIBUS1
@@ -225,6 +225,58 @@ menu "Select spi bus drivers"
endchoice
endmenu
menu "Select iic drivers"
config LPI2C_CLOCK_SOURCE_DIVIDER
int "lpi2c bus clock source divider"
range 1 64
default 4
config RT_USING_I2C1
bool "USING I2C1"
select RT_USING_I2C
default n
if RT_USING_I2C1
config RT_USING_I2C1_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C1"
endif
config RT_USING_I2C2
bool "USING I2C2"
select RT_USING_I2C
default n
if RT_USING_I2C2
config RT_USING_I2C2_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C2"
endif
config RT_USING_I2C3
bool "USING I2C3"
select RT_USING_I2C
default n
if RT_USING_I2C3
config RT_USING_I2C3_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C3"
endif
config RT_USING_I2C4
bool "USING I2C4"
select RT_USING_I2C
default n
if RT_USING_I2C4
config RT_USING_I2C4_BITOPS
select RT_USING_I2C_BITOPS
default n
bool "using simulate I2C4"
endif
endmenu
#menu "SDRAM driver support"
config RT_USING_SDRAM
bool "Using sdram"
+4
View File
@@ -30,6 +30,10 @@ if GetDepend('RT_USING_RTC_HP'):
if GetDepend('RT_USING_SPI'):
src += ['drv_spi_bus.c']
# add i2cbus driver code
if GetDepend('RT_USING_I2C'):
src += ['drv_i2c.c']
if GetDepend('BOARD_RT1050_EVK'):
src += ['hyper_flash_boot.c']
File diff suppressed because it is too large Load Diff
+34
View File
@@ -0,0 +1,34 @@
/*
* File : drv_i2c.h
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2009, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2018-03-24 LaiYiKeTang the first version
*/
#ifndef __DRVI2C_H__
#define __DRVI2C_H__
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include "board.h"
struct rt1052_i2c_bus
{
struct rt_i2c_bus_device parent;
LPI2C_Type *I2C;
struct rt_i2c_msg *msg;
rt_uint32_t msg_cnt;
volatile rt_uint32_t msg_ptr;
volatile rt_uint32_t dptr;
char *device_name;
};
#endif