mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-05-31 20:05:59 +08:00
[bsp][imxrt1052] add hardware i2c
This commit is contained in:
@@ -93,7 +93,7 @@ menu "Select spi bus drivers"
|
|||||||
|
|
||||||
config LPSPI_CLK_SOURCE_DIVIDER
|
config LPSPI_CLK_SOURCE_DIVIDER
|
||||||
int "SPI bus clock source divider"
|
int "SPI bus clock source divider"
|
||||||
range 0 8
|
range 1 8
|
||||||
default 7
|
default 7
|
||||||
|
|
||||||
config RT_USING_SPIBUS1
|
config RT_USING_SPIBUS1
|
||||||
@@ -225,6 +225,58 @@ menu "Select spi bus drivers"
|
|||||||
endchoice
|
endchoice
|
||||||
endmenu
|
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"
|
#menu "SDRAM driver support"
|
||||||
config RT_USING_SDRAM
|
config RT_USING_SDRAM
|
||||||
bool "Using sdram"
|
bool "Using sdram"
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ if GetDepend('RT_USING_RTC_HP'):
|
|||||||
if GetDepend('RT_USING_SPI'):
|
if GetDepend('RT_USING_SPI'):
|
||||||
src += ['drv_spi_bus.c']
|
src += ['drv_spi_bus.c']
|
||||||
|
|
||||||
|
# add i2cbus driver code
|
||||||
|
if GetDepend('RT_USING_I2C'):
|
||||||
|
src += ['drv_i2c.c']
|
||||||
|
|
||||||
if GetDepend('BOARD_RT1050_EVK'):
|
if GetDepend('BOARD_RT1050_EVK'):
|
||||||
src += ['hyper_flash_boot.c']
|
src += ['hyper_flash_boot.c']
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
|
|
||||||
Reference in New Issue
Block a user