esp32[c3|c6|h2]: Add BMP180 sensor support
This commit is contained in:
parent
dda55419f9
commit
43a4f2fbea
@ -53,6 +53,17 @@ All of the configurations presented below can be tested by running the following
|
||||
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, wifi...
|
||||
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
|
||||
|
||||
bmp180
|
||||
------
|
||||
|
||||
This configuration enables the use of the BMP180 pressure sensor over I2C.
|
||||
You can check that the sensor is working by using the ``bmp180`` application::
|
||||
|
||||
nsh> bmp180
|
||||
Pressure value = 91531
|
||||
Pressure value = 91526
|
||||
Pressure value = 91525
|
||||
|
||||
coremark
|
||||
--------
|
||||
|
||||
|
@ -88,6 +88,17 @@ All of the configurations presented below can be tested by running the following
|
||||
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, wifi...
|
||||
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
|
||||
|
||||
bmp180
|
||||
------
|
||||
|
||||
This configuration enables the use of the BMP180 pressure sensor over I2C.
|
||||
You can check that the sensor is working by using the ``bmp180`` application::
|
||||
|
||||
nsh> bmp180
|
||||
Pressure value = 91531
|
||||
Pressure value = 91526
|
||||
Pressure value = 91525
|
||||
|
||||
coremark
|
||||
--------
|
||||
|
||||
|
@ -88,6 +88,17 @@ All of the configurations presented below can be tested by running the following
|
||||
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, wifi...
|
||||
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
|
||||
|
||||
bmp180
|
||||
------
|
||||
|
||||
This configuration enables the use of the BMP180 pressure sensor over I2C.
|
||||
You can check that the sensor is working by using the ``bmp180`` application::
|
||||
|
||||
nsh> bmp180
|
||||
Pressure value = 91531
|
||||
Pressure value = 91526
|
||||
Pressure value = 91525
|
||||
|
||||
coremark
|
||||
--------
|
||||
|
||||
|
@ -87,6 +87,17 @@ All of the configurations presented below can be tested by running the following
|
||||
Where <config_name> is the name of board configuration you want to use, i.e.: nsh, buttons, wifi...
|
||||
Then use a serial console terminal like ``picocom`` configured to 115200 8N1.
|
||||
|
||||
bmp180
|
||||
------
|
||||
|
||||
This configuration enables the use of the BMP180 pressure sensor over I2C.
|
||||
You can check that the sensor is working by using the ``bmp180`` application::
|
||||
|
||||
nsh> bmp180
|
||||
Pressure value = 91531
|
||||
Pressure value = 91526
|
||||
Pressure value = 91525
|
||||
|
||||
coremark
|
||||
--------
|
||||
|
||||
|
74
boards/risc-v/esp32c3/common/include/esp_board_bmp180.h
Normal file
74
boards/risc-v/esp32c3/common/include/esp_board_bmp180.h
Normal file
@ -0,0 +1,74 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32c3/common/include/esp_board_bmp180.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_BMP180_H
|
||||
#define __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_BMP180_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_bmp180_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the BMP180 Pressure Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/pressN
|
||||
*
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
int board_bmp180_initialize(int devno);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_RISCV_ESP32C3_COMMON_INCLUDE_ESP_BOARD_BMP180_H */
|
@ -56,6 +56,10 @@ ifeq ($(CONFIG_ESPRESSIF_WIFI),y)
|
||||
CSRCS += esp_board_wlan.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_BMP180),y)
|
||||
CSRCS += esp_board_bmp180.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
86
boards/risc-v/esp32c3/common/src/esp_board_bmp180.c
Normal file
86
boards/risc-v/esp32c3/common/src/esp_board_bmp180.c
Normal file
@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32c3/common/src/esp_board_bmp180.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sensors/bmp180.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
#include "espressif/esp_i2c.h"
|
||||
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_bmp180_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the BMP180 Pressure Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/pressN
|
||||
*
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_bmp180_initialize(int devno)
|
||||
{
|
||||
struct i2c_master_s *i2c;
|
||||
char devpath[12];
|
||||
int ret;
|
||||
|
||||
sninfo("Initializing BMP180!\n");
|
||||
|
||||
/* Initialize BMP180 */
|
||||
|
||||
i2c = esp_i2cbus_initialize(ESPRESSIF_I2C0);
|
||||
|
||||
if (i2c)
|
||||
{
|
||||
/* Then try to register the barometer sensor in I2C0 */
|
||||
|
||||
snprintf(devpath, 12, "/dev/press%d", devno);
|
||||
ret = bmp180_register(devpath, i2c);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Error registering BMP180 in I2C0\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="risc-v"
|
||||
CONFIG_ARCH_BOARD="esp32c3-generic"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32C3_GENERIC=y
|
||||
CONFIG_ARCH_CHIP="esp32c3"
|
||||
CONFIG_ARCH_CHIP_ESP32C3_GENERIC=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=1536
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15000
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ESPRESSIF_I2C0=y
|
||||
CONFIG_EXAMPLES_BMP180=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SENSORS=y
|
||||
CONFIG_SENSORS_BMP180=y
|
||||
CONFIG_START_DAY=29
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2019
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
@ -37,6 +37,7 @@
|
||||
#include "esp_board_ledc.h"
|
||||
#include "esp_board_spiflash.h"
|
||||
#include "esp_board_i2c.h"
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
# include "espressif/esp_wdt.h"
|
||||
@ -269,6 +270,18 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
/* Try to register BMP180 device in I2C0 */
|
||||
|
||||
ret = board_bmp180_initialize(0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize BMP180 "
|
||||
"Driver for I2C0: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
73
boards/risc-v/esp32c6/common/include/esp_board_bmp180.h
Normal file
73
boards/risc-v/esp32c6/common/include/esp_board_bmp180.h
Normal file
@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32c6/common/include/esp_board_bmp180.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_BMP180_H
|
||||
#define __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_BMP180_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_bmp180_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the BMP180 Pressure Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/pressN
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
int board_bmp180_initialize(int devno);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_RISCV_ESP32C6_COMMON_INCLUDE_ESP_BOARD_BMP180_H */
|
@ -56,6 +56,10 @@ ifeq ($(CONFIG_ESPRESSIF_WIFI),y)
|
||||
CSRCS += esp_board_wlan.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_BMP180),y)
|
||||
CSRCS += esp_board_bmp180.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
86
boards/risc-v/esp32c6/common/src/esp_board_bmp180.c
Normal file
86
boards/risc-v/esp32c6/common/src/esp_board_bmp180.c
Normal file
@ -0,0 +1,86 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32c6/common/src/esp_board_bmp180.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sensors/bmp180.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
#include "espressif/esp_i2c.h"
|
||||
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_bmp180_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the BMP180 Pressure Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/pressN
|
||||
*
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_bmp180_initialize(int devno)
|
||||
{
|
||||
struct i2c_master_s *i2c;
|
||||
char devpath[12];
|
||||
int ret;
|
||||
|
||||
sninfo("Initializing BMP180!\n");
|
||||
|
||||
/* Initialize BMP180 */
|
||||
|
||||
i2c = esp_i2cbus_initialize(ESPRESSIF_I2C0);
|
||||
|
||||
if (i2c)
|
||||
{
|
||||
/* Then try to register the barometer sensor in I2C0 */
|
||||
|
||||
snprintf(devpath, 12, "/dev/press%d", devno);
|
||||
ret = bmp180_register(devpath, i2c);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Error registering BMP180 in I2C0\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="risc-v"
|
||||
CONFIG_ARCH_BOARD="esp32c6-devkitc"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32C6_DEVKITC=y
|
||||
CONFIG_ARCH_CHIP="esp32c6"
|
||||
CONFIG_ARCH_CHIP_ESP32C6=y
|
||||
CONFIG_ARCH_CHIP_ESP32C6WROOM1=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15000
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ESPRESSIF_ESP32C6=y
|
||||
CONFIG_ESPRESSIF_I2C0=y
|
||||
CONFIG_EXAMPLES_BMP180=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SENSORS=y
|
||||
CONFIG_SENSORS_BMP180=y
|
||||
CONFIG_START_DAY=29
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2019
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
@ -37,6 +37,7 @@
|
||||
#include "esp_board_ledc.h"
|
||||
#include "esp_board_spiflash.h"
|
||||
#include "esp_board_i2c.h"
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
# include "espressif/esp_wdt.h"
|
||||
@ -238,6 +239,18 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
/* Try to register BMP180 device in I2C0 */
|
||||
|
||||
ret = board_bmp180_initialize(0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize BMP180 "
|
||||
"Driver for I2C0: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI0
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
@ -0,0 +1,52 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="risc-v"
|
||||
CONFIG_ARCH_BOARD="esp32c6-devkitm"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32C6_DEVKITM=y
|
||||
CONFIG_ARCH_CHIP="esp32c6"
|
||||
CONFIG_ARCH_CHIP_ESP32C6=y
|
||||
CONFIG_ARCH_CHIP_ESP32C6MINI1=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15000
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ESPRESSIF_ESP32C6=y
|
||||
CONFIG_ESPRESSIF_I2C0=y
|
||||
CONFIG_EXAMPLES_BMP180=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SENSORS=y
|
||||
CONFIG_SENSORS_BMP180=y
|
||||
CONFIG_START_DAY=29
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2019
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
@ -37,6 +37,7 @@
|
||||
#include "esp_board_ledc.h"
|
||||
#include "esp_board_spiflash.h"
|
||||
#include "esp_board_i2c.h"
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
# include "espressif/esp_wdt.h"
|
||||
@ -238,6 +239,18 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
/* Try to register BMP180 device in I2C0 */
|
||||
|
||||
ret = board_bmp180_initialize(0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize BMP180 "
|
||||
"Driver for I2C0: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI0
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
73
boards/risc-v/esp32h2/common/include/esp_board_bmp180.h
Normal file
73
boards/risc-v/esp32h2/common/include/esp_board_bmp180.h
Normal file
@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32h2/common/include/esp_board_bmp180.h
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_RISCV_ESP32H2_COMMON_INCLUDE_ESP_BOARD_BMP180_H
|
||||
#define __BOARDS_RISCV_ESP32H2_COMMON_INCLUDE_ESP_BOARD_BMP180_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_bmp180_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the BMP180 Pressure Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/pressN
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
int board_bmp180_initialize(int devno);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_RISCV_ESP32H2_COMMON_INCLUDE_ESP_BOARD_BMP180_H */
|
@ -52,6 +52,10 @@ ifeq ($(CONFIG_ESPRESSIF_TWAI),y)
|
||||
CSRCS += esp_board_twai.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SENSORS_BMP180),y)
|
||||
CSRCS += esp_board_bmp180.c
|
||||
endif
|
||||
|
||||
DEPPATH += --dep-path src
|
||||
VPATH += :src
|
||||
CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)src
|
||||
|
85
boards/risc-v/esp32h2/common/src/esp_board_bmp180.c
Normal file
85
boards/risc-v/esp32h2/common/src/esp_board_bmp180.c
Normal file
@ -0,0 +1,85 @@
|
||||
/****************************************************************************
|
||||
* boards/risc-v/esp32h2/common/src/esp_board_bmp180.c
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sensors/bmp180.h>
|
||||
#include <nuttx/i2c/i2c_master.h>
|
||||
|
||||
#include "espressif/esp_i2c.h"
|
||||
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_bmp180_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize and register the BMP180 Pressure Sensor driver.
|
||||
*
|
||||
* Input Parameters:
|
||||
* devno - The device number, used to build the device path as /dev/pressN
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) on success; a negated errno value on failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_bmp180_initialize(int devno)
|
||||
{
|
||||
struct i2c_master_s *i2c;
|
||||
char devpath[12];
|
||||
int ret;
|
||||
|
||||
sninfo("Initializing BMP180!\n");
|
||||
|
||||
/* Initialize BMP180 */
|
||||
|
||||
i2c = esp_i2cbus_initialize(ESPRESSIF_I2C0);
|
||||
|
||||
if (i2c)
|
||||
{
|
||||
/* Then try to register the barometer sensor in I2C0 */
|
||||
|
||||
snprintf(devpath, 12, "/dev/press%d", devno);
|
||||
ret = bmp180_register(devpath, i2c);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ERROR: Error registering BMP180 in I2C0\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
#
|
||||
# This file is autogenerated: PLEASE DO NOT EDIT IT.
|
||||
#
|
||||
# You can use "make menuconfig" to make any modifications to the installed .config file.
|
||||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
|
||||
# modifications.
|
||||
#
|
||||
# CONFIG_NSH_ARGCAT is not set
|
||||
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
|
||||
CONFIG_ARCH="risc-v"
|
||||
CONFIG_ARCH_BOARD="esp32h2-devkit"
|
||||
CONFIG_ARCH_BOARD_COMMON=y
|
||||
CONFIG_ARCH_BOARD_ESP32H2_DEVKIT=y
|
||||
CONFIG_ARCH_CHIP="esp32h2"
|
||||
CONFIG_ARCH_CHIP_ESP32H2=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_RISCV=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BOARDCTL_RESET=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=15000
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ESPRESSIF_ESP32H2=y
|
||||
CONFIG_ESPRESSIF_I2C0=y
|
||||
CONFIG_EXAMPLES_BMP180=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=2048
|
||||
CONFIG_INIT_ENTRYPOINT="nsh_main"
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_PERROR_STDOUT=y
|
||||
CONFIG_LIBC_STRERROR=y
|
||||
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_NSH_STRERROR=y
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_BACKTRACE=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SENSORS=y
|
||||
CONFIG_SENSORS_BMP180=y
|
||||
CONFIG_START_DAY=29
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2019
|
||||
CONFIG_SYSTEM_DUMPSTACK=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
@ -37,6 +37,7 @@
|
||||
#include "esp_board_ledc.h"
|
||||
#include "esp_board_spiflash.h"
|
||||
#include "esp_board_i2c.h"
|
||||
#include "esp_board_bmp180.h"
|
||||
|
||||
#ifdef CONFIG_WATCHDOG
|
||||
# include "espressif/esp_wdt.h"
|
||||
@ -230,6 +231,18 @@ int esp_bringup(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SENSORS_BMP180
|
||||
/* Try to register BMP180 device in I2C0 */
|
||||
|
||||
ret = board_bmp180_initialize(0);
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "Failed to initialize BMP180 "
|
||||
"Driver for I2C0: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ESPRESSIF_TWAI
|
||||
|
||||
/* Initialize TWAI and register the TWAI driver. */
|
||||
|
Loading…
Reference in New Issue
Block a user