Threads I2C and SPI (#3471)
Issues due date / Add labels to issues (push) Has been cancelled
Doxygen / build (push) Has been cancelled

* [threads] Add binary semaphore timeout wait.

* [i2c] Update blocking functions to be RTOS aware.

* [SHT25] Refactor SHT25 driver as threaded I2C example.

* [spi] Update blocking function to be RTOS aware.

* [AMT22] add AMT22 driver using SPI blocking mode.

---------

Co-authored-by: Fabien-B <Fabien-B@github.com>
This commit is contained in:
Fabien-B
2025-06-23 20:08:33 +02:00
committed by GitHub
parent 486ae432e1
commit 982c6947a3
25 changed files with 565 additions and 281 deletions
+33
View File
@@ -0,0 +1,33 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="encoder_amt22" dir="sensors" task="sensors">
<doc>
<description>Driver for AMT22 encoder from CUI devices.</description>
</doc>
<dep>
<depends>spi_master</depends>
</dep>
<header>
<file name="encoder_amt22.h"/>
</header>
<init fun="encoder_amt22_init()"/>
<periodic fun="encoder_amt22_periodic()" freq="50.0" autorun="TRUE"/>
<makefile target="ap">
<configure name="AMT22_SPI_DEV" default="SPI2" case="upper|lower"/>
<configure name="AMT22_SPI_SLAVE_IDX" default="SPI_SLAVE0"/>
<define name="USE_$(AMT22_SPI_DEV_UPPER)"/>
<define name="USE_$(AMT22_SPI_SLAVE_IDX)"/>
<define name="AMT22_SPI_DEV" value="$(AMT22_SPI_DEV_LOWER)"/>
<define name="AMT22_SPI_SLAVE_IDX" value="$(AMT22_SPI_SLAVE_IDX)"/>
<file name="encoder_amt22.c"/>
<file name="amt22.c" dir="peripherals"/>
<test>
<define name="AMT22_SPI_DEV" value="spi1" />
<define name="USE_SPI1" />
<define name="AMT22_SPI_SLAVE_IDX" value="0" />
<define name="SPI_MASTER"/>
<define name="DOWNLINK_TRANSPORT" value="pprz_tp"/>
<define name="DOWNLINK_DEVICE" value="uart0"/>
<define name="USE_UART0" />
</test>
</makefile>
</module>
+1 -5
View File
@@ -3,18 +3,14 @@
<module name="humid_sht_i2c" dir="meteo">
<doc>
<description>Sensirion SHT25 humidity sensor (I2C)</description>
<define name="SCP_I2C_DEV" value="i2cX" description="select i2c peripheral to use (default i2c0)"/>
<define name="SHT_I2C_DEV" value="i2cX" description="select i2c peripheral to use (default i2c0)"/>
</doc>
<header>
<file name="humid_sht_i2c.h"/>
</header>
<init fun="humid_sht_init_i2c()"/>
<periodic fun="humid_sht_periodic_i2c()" freq="4" delay="0."/>
<periodic fun="humid_sht_p_temp()" freq="4" delay="0.4"/>
<periodic fun="humid_sht_p_humid()" freq="4" delay="0.6"/>
<event fun="humid_sht_event_i2c()"/>
<makefile target="ap">
<file name="humid_sht_i2c.c"/>
</makefile>
</module>