Skip to content

Commit ca60633

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 25cf1c3 commit ca60633

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -795,22 +795,27 @@ add_definitions(-DTARGET_DEVICE_${TARGET_DEVICE})
795795
if(TARGET_DEVICE STREQUAL "PINETIME")
796796
add_definitions(-DDRIVER_PINMAP_PINETIME)
797797
add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
798+
add_definitions(-DDRIVER_ACC_BMA421)
798799
elseif(TARGET_DEVICE STREQUAL "MOY-TFK5") # P8a
799800
add_definitions(-DDRIVER_PINMAP_P8)
800801
add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
802+
add_definitions(-DDRIVER_ACC_BMA421)
801803
elseif(TARGET_DEVICE STREQUAL "MOY-TIN5") # P8a variant 2
802804
add_definitions(-DDRIVER_PINMAP_P8)
803805
add_definitions(-DCLOCK_CONFIG_LF_SRC=1) # XTAL
806+
add_definitions(-DDRIVER_ACC_SC7A20)
804807
elseif(TARGET_DEVICE STREQUAL "MOY-TON5") # P8b
805808
add_definitions(-DDRIVER_PINMAP_P8)
806809
add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC
807810
add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500)
808811
add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
812+
add_definitions(-DDRIVER_ACC_SC7A20)
809813
elseif(TARGET_DEVICE STREQUAL "MOY-UNK") # P8b mirrored
810814
add_definitions(-DDRIVER_PINMAP_P8)
811815
add_definitions(-DCLOCK_CONFIG_LF_SRC=0) # RC
812816
add_definitions(-DMYNEWT_VAL_BLE_LL_SCA=500)
813817
add_definitions(-DCLOCK_CONFIG_LF_CAL_ENABLED=1)
818+
add_definitions(-DDRIVER_ACC_SC7A20)
814819
else()
815820
message(FATAL_ERROR "Invalid TARGET_DEVICE")
816821
endif()

src/main.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,11 @@ Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress};
8989
Pinetime::Components::LittleVgl lvgl {lcd, touchPanel};
9090

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

0 commit comments

Comments
 (0)