... | ... | @@ -147,7 +147,7 @@ Import the header file and in the constructor simply initialize the _odr_ and _b |
|
|
|
|
|
#include "TempSensor.h"
|
|
|
|
|
|
using namespace Boardcore;
|
|
|
namespace Boardcore {
|
|
|
|
|
|
TempSensor::TempSensor(uint8_t odr, uint8_t bdu)
|
|
|
: odr(odr), bdu(bdu)
|
... | ... | @@ -240,6 +240,8 @@ int8_t TempSensor::getTemperature() |
|
|
// also, reading zero means 25 °C, so add the temperature reference
|
|
|
return spi_driver.read(OUT_T) + TEMPERATURE_REF;
|
|
|
}
|
|
|
|
|
|
} // namespace Boardcore
|
|
|
```
|
|
|
|
|
|
## Create your entrypoint
|
... | ... | @@ -299,22 +301,17 @@ int main() |
|
|
|
|
|
## Compile with SBS
|
|
|
|
|
|
Let's write our dependencies variables:
|
|
|
Let's write our dependencies variables; in boardcore.cmake, under Drivers, add:
|
|
|
|
|
|
```cmake
|
|
|
set(LIS3DSH_SENSOR_SOURCES
|
|
|
src/shared/drivers/spi/SpiDriver.h
|
|
|
src/shared/sensors/LIS3DSH/LIS3DSH.h
|
|
|
src/shared/sensors/LIS3DSH/LIS3DSHData.h
|
|
|
)
|
|
|
${SBS_BASE}/src/shared/drivers/spi/TempSensor.cpp
|
|
|
${SBS_BASE}/src/shared/drivers/spi/SpiDriver.cpp
|
|
|
```
|
|
|
|
|
|
And then specify the entrypoint, including the dependencies variable:
|
|
|
|
|
|
```cmake
|
|
|
add_executable(test-tempsensor
|
|
|
src/entrypoints/test-tempsensor.cpp
|
|
|
${LIS3DSH_SENSOR_SOURCES}
|
|
|
add_executable(test-tempsensor src/entrypoints/test-tempsensor.cpp
|
|
|
)
|
|
|
sbs_target(test-tempsensor stm32f407vg_stm32f4discovery)
|
|
|
```
|
... | ... | |