Skip to content

Commit

Permalink
Fixed bmm150 nrfxxx CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Jul 24, 2024
1 parent 74d49d1 commit 1a902f3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
36 changes: 36 additions & 0 deletions src/SensorBMM150.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
*
* @license MIT License
*
* Copyright (c) 2024 lewis he
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* @file SensorBMM150.cpp
* @author Lewis He (lewishe@outlook.com)
* @date 2024-07-24
*
*/
#include "SensorBMM150.hpp"

#if defined(ARDUINO)
volatile bool SensorBMM150::__data_available;
#endif


16 changes: 13 additions & 3 deletions src/SensorBMM150.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,10 @@ class SensorBMM150

private:

static void IRAM_ATTR handleISR(void *available)
static void IRAM_ATTR handleISR(/*void *available*/)
{
*(bool *)(available) = true;
// *(bool *)(available) = true;
__data_available = true;
}

bool initImpl()
Expand Down Expand Up @@ -306,10 +307,19 @@ class SensorBMM150
bmm150_get_sensor_settings(&settings, dev);

if (__handler.irq != SENSOR_PIN_NONE) {
/*
#if defined(ARDUINO_ARCH_RP2040)
attachInterruptParam((pin_size_t)(__handler.irq), handleISR, (PinStatus )RISING, (void *)&__data_available);
#else
attachInterruptArg(__handler.irq, handleISR, (void *)&__data_available, RISING);
#endif
*/
#if defined(ARDUINO_ARCH_RP2040)
attachInterrupt((pin_size_t)(__handler.irq), handleISR, (PinStatus )RISING);
#elif defined(NRF52840_XXAA) || defined(NRF52832_XXAA) || defined(ESP32) || defined(ARDUINO_ARCH_ESP32)
attachInterrupt(__handler.irq, handleISR, RISING);
#else
#error "Interrupt registration not implemented"
#endif
}

Expand All @@ -321,7 +331,7 @@ class SensorBMM150
struct bmm150_dev *dev = NULL;
SensorLibConfigure __handler;
int8_t __error_code;
volatile bool __data_available;
static volatile bool __data_available;
};


Expand Down

0 comments on commit 1a902f3

Please sign in to comment.