Skip to content

Commit

Permalink
Avoid linking to jostle detection code for boards that do not support it
Browse files Browse the repository at this point in the history
  • Loading branch information
ps2 committed May 22, 2017
1 parent 94cb5cd commit 194fd36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions bsp/lesson_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern "C" {
#define SIMBLEE

#define MMA8541
#define JOSTLE_DETECT

#define LEDS_NUMBER 0
#define BUTTONS_NUMBER 0
Expand Down
6 changes: 6 additions & 0 deletions src/sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ void sensor_init() {
#ifdef ACCEL_ADXL337
shoe_accel_init();
#endif

#ifdef JOSTLE_DETECT
jostle_detect_init();
#endif

uint32_t error_code;
error_code = rbc_mesh_value_enable(SENSOR_HANDLE);
Expand All @@ -34,10 +37,13 @@ void gather_sensor_data() {
memset(&m_value, 0, sizeof(sensor_value_t));
m_value.valid_time = get_clock_time();
m_value.battery = get_battery_adc();

#ifdef JOSTLE_DETECT
if (jostle_detect_get_flag()) {
m_value.status |= STATUS_FLAG_JOSTLE_DETECTED;
jostle_detect_clear_flag();
}
#endif

#ifdef ACCEL_ADXL337
read_shoe_accel(&m_value.accel_x, &m_value.accel_y, &m_value.accel_z);
Expand Down

0 comments on commit 194fd36

Please sign in to comment.