i2c
This commit is contained in:
parent
9ee3fe3f19
commit
c00bb5d4a7
File diff suppressed because it is too large
Load Diff
@ -318,7 +318,7 @@ CONFIG_NSH_MMCSDMINOR=0
|
|||||||
#
|
#
|
||||||
# Board-Specific Options
|
# Board-Specific Options
|
||||||
#
|
#
|
||||||
# CONFIG_LIB_BOARDCTL is not set
|
CONFIG_LIB_BOARDCTL=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# RTOS Features
|
# RTOS Features
|
||||||
@ -907,8 +907,10 @@ CONFIG_READLINE_ECHO=y
|
|||||||
# CONFIG_SYSTEM_UBLOXMODEM is not set
|
# CONFIG_SYSTEM_UBLOXMODEM is not set
|
||||||
# CONFIG_SYSTEM_ZMODEM is not set
|
# CONFIG_SYSTEM_ZMODEM is not set
|
||||||
|
|
||||||
|
CONFIG_I2C_DRIVER=y
|
||||||
|
|
||||||
CONFIG_SYSTEM_I2CTOOL=y
|
CONFIG_SYSTEM_I2CTOOL=y
|
||||||
CONFIG_I2CTOOL_MINBUS=0
|
CONFIG_I2CTOOL_MINBUS=1
|
||||||
CONFIG_I2CTOOL_MAXBUS=1
|
CONFIG_I2CTOOL_MAXBUS=1
|
||||||
CONFIG_I2CTOOL_MINADDR=0x03
|
CONFIG_I2CTOOL_MINADDR=0x03
|
||||||
CONFIG_I2CTOOL_MAXADDR=0x77
|
CONFIG_I2CTOOL_MAXADDR=0x77
|
||||||
|
@ -40,9 +40,38 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include <debug.h>
|
||||||
|
#include <nuttx/i2c/i2c_master.h>
|
||||||
|
#include <nuttx/leds/userled.h>
|
||||||
|
|
||||||
#include "stm32f746-ws.h"
|
#include "stm32f746-ws.h"
|
||||||
#include <nuttx/leds/userled.h>
|
#include "stm32_i2c.h"
|
||||||
|
|
||||||
|
static void stm32f7_i2c_register(int bus)
|
||||||
|
{
|
||||||
|
FAR struct i2c_master_s *i2c;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
i2c = stm32f7_i2cbus_initialize(bus);
|
||||||
|
if (i2c == NULL)
|
||||||
|
{
|
||||||
|
dbg("ERROR: Failed to get I2C%d interface\n", bus);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = i2c_register(i2c, bus);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
dbg("ERROR: Failed to register I2C%d driver: %d\n", bus, ret);
|
||||||
|
stm32f7_i2cbus_uninitialize(i2c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void stm32f7_i2ctool(void)
|
||||||
|
{
|
||||||
|
stm32f7_i2c_register(1);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
@ -60,6 +89,9 @@
|
|||||||
|
|
||||||
int board_app_initialize(void)
|
int board_app_initialize(void)
|
||||||
{
|
{
|
||||||
|
/* Register I2C drivers on behalf of the I2C tool */
|
||||||
|
|
||||||
|
stm32f7_i2ctool();
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user