TRR 2018 / Mbed 2 deprecated biniou-TRR2019-DLVV

Dependencies:   mbed MPU6050

utils.cpp

Committer:
GaspardD
Date:
2019-10-02
Revision:
8:f23601373e8b
Parent:
6:ab9f3695633f
Child:
9:1b54bac6d9a7

File content as of revision 8:f23601373e8b:

#include "utils.h"

bool b_UTILS_flag_button_ESC = false;
bool b_UTILS_flag_button_SECTIONS = false;
bool b_UTILS_flag_emergency_stop = false;
Timer t_utils_timerSinceStart;
s_Section* s_UTILS_currentSection = NULL;

Serial rs_UTILS_pc(USBTX, USBRX);
Serial rs_UTILS_odroid(PC_10, PC_11,115200);
InterruptIn b_UTILS_button(USER_BUTTON);
InterruptIn b_UTILS_emergency_signal(PD_0);


void it_pressed()
{
    rs_UTILS_pc.printf("t_utils_timerSinceStart.read_ms(): %ld\r\n", t_utils_timerSinceStart.read_ms());
    if(t_utils_timerSinceStart.read_ms() > 500) {
        t_utils_timerSinceStart.reset();
        rs_UTILS_pc.printf("Button pressed\r\n");
        b_UTILS_flag_button_SECTIONS = true;
        b_UTILS_flag_button_ESC = true;
        b_UTILS_flag_emergency_stop = false;
    }
    return;
}

void it_emergency_signal_recieved()
{
    b_UTILS_flag_emergency_stop = true;
    }