Commit dab3279f authored by Philippe Kalaf's avatar Philippe Kalaf

Add and remove callback for interruptIn instead of enabling/disabling IRQ

parent f731127c
......@@ -30,7 +30,6 @@ const int LMT01::_pulse_temp_table[20][2] = {
LMT01::LMT01(PinName pin) : _interrupt(pin), _worker_thread(osPriorityNormal, 1024) { // create the InterruptIn on the pin specified to LMT01
_interrupt.mode(PullUp); // an internal pull up is used, otherwise disable here
_interrupt.fall(callback(this, &LMT01::_increment)); // attach increment function of this counter instance
// Start worker thread for counting pulses and calculating temp
_worker_thread.start(callback(this, &LMT01::_worker));
......@@ -42,7 +41,7 @@ void LMT01::_worker()
while(true)
{
_interrupt.enable_irq();
_interrupt.fall(callback(this, &LMT01::_increment)); // attach increment function of this counter instance
ThisThread::sleep_for(250);
_pulse_count = 0;
_last_pulse_count = 0;
......@@ -79,7 +78,7 @@ void LMT01::_worker()
)
+ _pulse_temp_table[i-1][0] * 1000;
_interrupt.disable_irq();
_interrupt.fall(NULL);
ThisThread::sleep_for(250);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment