Gordon Williams 8d763e7a6e oops
2022-04-22 11:51:26 +01:00

40 lines
1.2 KiB
C

/*
* This file is part of Espruino, a JavaScript interpreter for Microcontrollers
*
* Copyright (C) 2021 Gordon Williams <gw@pur3.co.uk>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* ----------------------------------------------------------------------------
* heart rate sensor common functions
* ----------------------------------------------------------------------------
*/
#include "jsvar.h"
#ifdef BANGLEJS_Q3
#define HRM_POLL_INTERVAL_DEFAULT 40 // in msec - 25hz
#else
#define HRM_POLL_INTERVAL_DEFAULT 20 // in msec - 50hz
#endif
extern uint16_t hrmPollInterval; // in msec, so 20 = 50hz
typedef void(*HrmCallback)(int ppgValue);
/// Turn heart rate sensor on - callback called on each data point
void hrm_sensor_on(HrmCallback callback);
/// Turn heart rate sensor off
void hrm_sensor_off();
/// Get extra HRM data as a JS Object
JsVar *hrm_sensor_getJsVar();
/// Called when JS engine torn down (disable timer/watch/etc)
void hrm_sensor_kill();
/// Called when JS engine initialised
void hrm_sensor_init();