fix build warnings in HR implementation
This commit is contained in:
parent
80838d1e42
commit
169b861af1
4 changed files with 6 additions and 8 deletions
|
@ -57,9 +57,7 @@ void HeartRateService::Init() {
|
||||||
int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle,
|
int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle,
|
||||||
ble_gatt_access_ctxt *context) {
|
ble_gatt_access_ctxt *context) {
|
||||||
if(attributeHandle == heartRateMeasurementHandle) {
|
if(attributeHandle == heartRateMeasurementHandle) {
|
||||||
NRF_LOG_INFO("BATTERY : handle = %d", heartRateMeasurementHandle);
|
NRF_LOG_INFO("HEARTRATE : handle = %d", heartRateMeasurementHandle);
|
||||||
static uint8_t batteryValue = heartRateController.HeartRate();
|
|
||||||
|
|
||||||
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value
|
||||||
|
|
||||||
int res = os_mbuf_append(context->om, buffer, 2);
|
int res = os_mbuf_append(context->om, buffer, 2);
|
||||||
|
|
|
@ -38,8 +38,8 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask,
|
||||||
navService{systemTask},
|
navService{systemTask},
|
||||||
batteryInformationService{batteryController},
|
batteryInformationService{batteryController},
|
||||||
immediateAlertService{systemTask, notificationManager},
|
immediateAlertService{systemTask, notificationManager},
|
||||||
serviceDiscovery({¤tTimeClient, &alertNotificationClient}),
|
heartRateService{systemTask, heartRateController},
|
||||||
heartRateService{systemTask, heartRateController} {
|
serviceDiscovery({¤tTimeClient, &alertNotificationClient}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int GAPEventCallback(struct ble_gap_event *event, void *arg) {
|
int GAPEventCallback(struct ble_gap_event *event, void *arg) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ using namespace Pinetime::Controllers;
|
||||||
namespace {
|
namespace {
|
||||||
int Compare(int* d1, int* d2, size_t count) {
|
int Compare(int* d1, int* d2, size_t count) {
|
||||||
int e = 0;
|
int e = 0;
|
||||||
for(int i = 0; i < count; i++) {
|
for(size_t i = 0; i < count; i++) {
|
||||||
auto d = d1[i] - d2[i];
|
auto d = d1[i] - d2[i];
|
||||||
e += d * d;
|
e += d * d;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,11 +73,11 @@ void Hrs3300::SetGain(uint8_t gain) {
|
||||||
static constexpr uint8_t maxGain = 64;
|
static constexpr uint8_t maxGain = 64;
|
||||||
gain = std::min(gain, maxGain);
|
gain = std::min(gain, maxGain);
|
||||||
uint8_t hgain = 0;
|
uint8_t hgain = 0;
|
||||||
while((1 << hgain) < gain)
|
while((1 << hgain) < gain) {
|
||||||
hgain++;
|
hgain++;
|
||||||
|
|
||||||
WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2);
|
WriteRegister(static_cast<uint8_t>(Registers::Hgain), hgain << 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Hrs3300::SetDrive(uint8_t drive) {
|
void Hrs3300::SetDrive(uint8_t drive) {
|
||||||
auto en = ReadRegister(static_cast<uint8_t>(Registers::Enable));
|
auto en = ReadRegister(static_cast<uint8_t>(Registers::Enable));
|
||||||
|
|
Loading…
Reference in a new issue