Browse Source

APP_Framework support Nuttx on aiit-arm32-board

pull/122/head
wgzAIIT 8 months ago
parent
commit
b342734aad
  1. 2
      APP_Framework/Framework/sensor/humidity/Kconfig
  2. 2
      APP_Framework/Framework/sensor/temperature/Kconfig
  3. 4
      Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/arm/stm32/common/include/stm32_hs300x.h
  4. 15
      Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/arm/stm32/common/src/stm32_hs300x.c
  5. 21
      Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c
  6. 2
      Ubiquitous/Nuttx/nuttx/boards/arm/stm32/aiit-arm32-board/scripts/Make.defs
  7. 12
      Ubiquitous/Nuttx/nuttx/boards/arm/stm32/aiit-arm32-board/src/stm32_bringup.c

2
APP_Framework/Framework/sensor/humidity/Kconfig

@ -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"

2
APP_Framework/Framework/sensor/temperature/Kconfig

@ -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"

4
Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/arm/stm32/common/include/stm32_hs300x.h

@ -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.
*

15
Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/arm/stm32/common/src/stm32_hs300x.c

@ -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)
{

21
Ubiquitous/Nuttx/app_match_nuttx/nuttx/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c

@ -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_USBADB
usbdev_adb_initialize();
#endif
#ifdef CONFIG_SENSORS_HS300X
ret = board_hs300x_initialize(1,1);
ret = board_hs300x_initialize(0, 1);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to initialize hs300x:"
" %d\n", ret);
syslog(LOG_ERR, "Failed to initialize HS300x, error %d\n", ret);
}
#endif /* CONFIG_SENSORS_HS300X */
#ifdef CONFIG_USBADB
usbdev_adb_initialize();
#endif
return ret;
}

2
Ubiquitous/Nuttx/nuttx/boards/arm/stm32/aiit-arm32-board/scripts/Make.defs

@ -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)

12
Ubiquitous/Nuttx/nuttx/boards/arm/stm32/aiit-arm32-board/src/stm32_bringup.c

@ -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…
Cancel
Save