Goertek SPA06 and SPL06 pressure sensor driver for I2C and SPI bus
No detailed description...
Example for airframe file
Add to your firmware section: This example contains all possible configuration options, not all of them are mandatory!
<module name="baro_spa06">
b'<define name="SPA06_SLAVE_ADDR" value="SPA06_I2C_ADDR|SPA06_I2C_ADDR_ALT" />\n '
b'<define name="SPA06_SYNC_SEND" />\n '
b'<configure name="SPA06_USE_SPI" default="FALSE" />\n '
b'<configure name="SPA06_DEV" value="i2cX/spiX" />\n '
b'<configure name="SPA06_SLAVE_IDX" value="spi_slave0" />\n '
</module>
Module configuration options
Configure Options
- name:
SPA06_USE_SPI value: None
Description: select which bus type use (default I2C -> FALSE, SPI -> TRUE)
- name:
SPA06_DEV value: i2cX/spiX
Description: select which i2c/spi peripheral to use (default i2c1/spi1)
- name:
SPA06_SLAVE_IDX value: spi_slave0
Description: select which slave peripheral to use when bus is spi (default spi_slave0)
Define Options
- name:
SPA06_SLAVE_ADDR value: SPA06_I2C_ADDR|SPA06_I2C_ADDR_ALT
Description: i2c slave address (default SPA06_I2C_ADDR)
- name:
SPA06_SYNC_SEND value: None
Description: flag to transmit the data as it is acquired, good for debugging only
Module functions
Init Functions
These initialization functions are called once on startup.
Event Functions
These event functions are called in each cycle of the module event loop.
Periodic Functions
These functions are called periodically at the specified frequency from the module periodic loop.
- baro_spa06_periodic()
- Frequency in Hz: 25
- Autorun: LOCK
Periodic function automatically starts after init and can't be stopped.
Files
Header Files
The following headers are automatically included in modules.h
Source Files
Raw baro_spa06.xml file:
<!DOCTYPE module SYSTEM "module.dtd">
<module name="baro_spa06" dir="sensors" task="sensors">
<doc>
<description>
Goertek SPA06 and SPL06 pressure sensor driver for I2C and SPI bus
</description>
<configure name="SPA06_USE_SPI" default="FALSE" description="select which bus type use (default I2C -> FALSE, SPI -> TRUE)"/>
<configure name="SPA06_DEV" value="i2cX/spiX" description="select which i2c/spi peripheral to use (default i2c1/spi1)"/>
<configure name="SPA06_SLAVE_IDX" value="spi_slave0" description="select which slave peripheral to use when bus is spi (default spi_slave0)"/>
<define name="SPA06_SLAVE_ADDR" value="SPA06_I2C_ADDR|SPA06_I2C_ADDR_ALT" description="i2c slave address (default SPA06_I2C_ADDR)"/>
<define name="SPA06_SYNC_SEND" description="flag to transmit the data as it is acquired, good for debugging only"/>
</doc>
<dep>
<depends>i2c|spi_master</depends>
<provides>baro</provides>
</dep>
<header>
<file name="baro_spa06.h"/>
</header>
<init fun="baro_spa06_init()"/>
<periodic fun="baro_spa06_periodic()" freq="25"/>
<event fun="baro_spa06_event()"/>
<makefile target="ap" >
<configure name="SPA06_USE_SPI" default="FALSE"/>
<define name="SPA06_USE_SPI" value="$(SPA06_USE_SPI)" />
<file name="baro_spa06.c"/>
<file name="spa06.c" dir="peripherals"/>
<test>
<define name="SPA06_USE_SPI"/>
<define name="SPA06_DEV" value="spi1"/>
<define name="SPA06_SLAVE_IDX" value="0"/>
<define name="SPI_MASTER"/>
<define name="USE_SPI1"/>
</test>
<test>
<define name="SPA06_DEV" value="i2c1"/>
<define name="USE_I2C1"/>
</test>
</makefile>
<makefile target="ap" cond="ifeq ($(SPA06_USE_SPI), TRUE)">
<configure name="SPA06_DEV" default="spi1" case="upper|lower"/>
<configure name="SPA06_SLAVE_IDX" default="spi_slave0" case="upper|lower"/>
<define name="USE_$(SPA06_DEV_UPPER)"/>
<define name="SPA06_DEV" value="$(SPA06_DEV_LOWER)"/>
<define name="SPA06_SLAVE_IDX" value="$(SPA06_SLAVE_IDX_UPPER)" />
<define name="USE_$(SPA06_SLAVE_IDX_UPPER)" />
</makefile>
<makefile target="ap" cond="ifeq ($(SPA06_USE_SPI), FALSE)">
<configure name="SPA06_DEV" default="i2c1" case="upper|lower"/>
<configure name="SPA06_SLAVE_ADDR" default="SPA06_I2C_ADDR"/>
<define name="USE_$(SPA06_DEV_UPPER)"/>
<define name="SPA06_DEV" value="$(SPA06_DEV_LOWER)"/>
</makefile>
</module>