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