Skip to content

Commit 649f69b

Browse files
committed
CMake: Add acceleration sensor configuration
The DRIVER_ACC configuration variable can be used to select the acceleration sensor driver to be used.
1 parent d59aac1 commit 649f69b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,15 @@ add_definitions(-D__HEAP_SIZE=4096)
810810
add_definitions(-DTARGET_DEVICE_${TARGET_DEVICE})
811811
if(TARGET_DEVICE STREQUAL "PINETIME")
812812
add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
813+
add_definitions(-DDRIVER_ACC_BMA421)
813814
elseif(TARGET_DEVICE STREQUAL "P8A")
814815
add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
816+
add_definitions(-DDRIVER_ACC_BMA421)
815817
elseif(TARGET_DEVICE STREQUAL "P8B")
816818
add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC
817819
add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500)
818820
add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
821+
add_definitions(-DDRIVER_ACC_SC7A20)
819822
else()
820823
message(FATAL_ERROR "Invalid TARGET_DEVICE")
821824
endif()

src/main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,11 @@ Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress};
9090
Pinetime::Components::LittleVgl lvgl {lcd, touchPanel};
9191

9292
#if (defined DRIVER_ACC_SC7A20)
93-
#include <drivers/SC7A20.h>
94-
static constexpr uint8_t motionSensorTwiAddress = 0x18;
93+
#include <drivers/SC7A20.h>
94+
static constexpr uint8_t motionSensorTwiAddress = 0x18;
9595
Pinetime::Drivers::SC7A20 motionSensor {twiMaster, motionSensorTwiAddress};
9696
#else
97-
// Assume DRIVER_ACC_BMA421,
98-
// this is needed for the LVGL simulator,
99-
// which does not set any target hardware configuration variables
97+
// Assume PineTime (DRIVER_ACC_BMA421)
10098
#include <drivers/Bma421.h>
10199
static constexpr uint8_t motionSensorTwiAddress = 0x18;
102100
Pinetime::Drivers::Bma421 motionSensor {twiMaster, motionSensorTwiAddress};

0 commit comments

Comments
 (0)