Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 640 Bytes

File metadata and controls

32 lines (23 loc) · 640 Bytes

DebounceIn

Debounce InterruptIn for mbed. Attached callbacks are ISR, meaning only non-blocking code is allowed there.

Example

#include "mbed.h"
#include "DebounceIn.h"

DebounceIn button(PE_3);

void buttonRise(){
    // note that printf is not allowed in interrupt, this is an example
    printf("btn rise\n");
}

void buttonFall(){
    // note that printf is not allowed in interrupt, this is an example
    printf("btn Fall\n");
}

int main() {
    button.rise(callback(buttonRise));
    button.fall(callback(buttonFall));

    bool current_state = button;

    printf("state: %u\n", sd_inserted);

    while (1) {}
}