forked from xuos/xiuos
APP_Framework support Nuttx on aiit-arm32-board
This commit is contained in:
parent
bd31aad3ef
commit
b342734aad
|
@ -26,7 +26,7 @@ config SENSOR_HS300X_HUMIDITY
|
|||
if ADD_NUTTX_FETURES
|
||||
config SENSOR_DEVICE_HS300X_DEV
|
||||
string "HS300x device name"
|
||||
default "/dev/i2c1"
|
||||
default "/dev/i2c1_dev0"
|
||||
|
||||
config SENSOR_DEVICE_HS300X_I2C_ADDR
|
||||
hex "HS300x device i2c address"
|
||||
|
|
|
@ -25,7 +25,7 @@ config SENSOR_HS300X_TEMPERATURE
|
|||
if ADD_NUTTX_FETURES
|
||||
config SENSOR_DEVICE_HS300X_DEV
|
||||
string "HS300x device name"
|
||||
default "/dev/i2c1"
|
||||
default "/dev/i2c1_dev0"
|
||||
|
||||
config SENSOR_DEVICE_HS300X_I2C_ADDR
|
||||
hex "HS300x device i2c address"
|
||||
|
|
|
@ -62,9 +62,9 @@ extern "C"
|
|||
* Initialize and register the hs300x Temperature Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/i2cN
|
||||
* devno - The device number
|
||||
* busno - The I2C bus number
|
||||
*
|
||||
* used to build the device path as /dev/i2c1_dev0
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
|
|
|
@ -65,12 +65,12 @@
|
|||
* Name: board_hs300x_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the HS300x Temperature Sensor driver.
|
||||
* Initialize and register the hs300x Temperature Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/i2cN
|
||||
* devno - The device number
|
||||
* busno - The I2C bus number
|
||||
*
|
||||
* used to build the device path as /dev/i2c1_dev0
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
|
@ -79,19 +79,20 @@
|
|||
int board_hs300x_initialize(int devno, int busno)
|
||||
{
|
||||
FAR struct i2c_master_s *i2c;
|
||||
char devpath[12];
|
||||
char devpath[20];
|
||||
int ret;
|
||||
|
||||
/* Get an instance of the I2C1 interface */
|
||||
sninfo("Initializing HS300x!\n");
|
||||
|
||||
/* Get an instance of the I2C interface */
|
||||
i2c = stm32_i2cbus_initialize(busno);
|
||||
if (!i2c)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* Then register the temperature sensor */
|
||||
snprintf(devpath, 12, "/dev/i2c%d", devno);
|
||||
/* Then register the temperature sensor,such as /dev/i2c1_dev0. */
|
||||
snprintf(devpath, 20, "/dev/i2c%d_dev%d", busno, devno);
|
||||
ret = hs300x_register(devpath, i2c, CONFIG_SENSOR_DEVICE_HS300X_I2C_ADDR);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
|
|
@ -112,14 +112,14 @@
|
|||
#include "stm32_xen1210.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_HS300X
|
||||
#include "stm32_hs300x.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBADB
|
||||
# include <nuttx/usb/adb.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_HS300X
|
||||
#include "stm32_hs300x.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -535,18 +535,17 @@ int stm32_bringup(void)
|
|||
}
|
||||
#endif /* CONFIG_LPWAN_SX127X */
|
||||
|
||||
#ifdef CONFIG_SENSORS_HS300X
|
||||
ret = board_hs300x_initialize(1,1);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize hs300x:"
|
||||
" %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_SENSORS_HS300X */
|
||||
|
||||
#ifdef CONFIG_USBADB
|
||||
usbdev_adb_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_HS300X
|
||||
ret = board_hs300x_initialize(0, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize HS300x, error %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_SENSORS_HS300X */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ else
|
|||
|
||||
endif
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CFLAGS := $(APPPATHS) $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
|
|
|
@ -116,6 +116,10 @@
|
|||
# include <nuttx/usb/adb.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_HS300X
|
||||
#include "stm32_hs300x.h"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
@ -551,5 +555,13 @@ printf("hello lcd 1");
|
|||
usbdev_adb_initialize();
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_HS300X
|
||||
ret = board_hs300x_initialize(0, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize HS300x, error %d\n", ret);
|
||||
}
|
||||
#endif /* CONFIG_SENSORS_HS300X */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue