S5 / Mbed 2 deprecated APP2-Examen

Dependencies:   mbed-rtos mbed

main.cpp

Committer:
JosephMarinier
Date:
2017-02-03
Revision:
1:a47e9e7852fd
Parent:
0:e581bdd1b2a6
Child:
2:99e36af00b06

File content as of revision 1:a47e9e7852fd:

#include "mbed.h"

DigitalOut myled(LED1);
BusOut leds(LED4, LED3, LED2, LED1);

Ticker ticker;

Thread *thread;

#define periode 16
unsigned short out[period] = {0};

unsigned short t = 0;

void tick() {
    leds = i;
    t = (t + 1) % period;
}

int main() {
    leds = 0b0000;
    
    ticker.attach(&tick, 0.01);
    
    thread = &Thread();
    thread->start(tick);
    
    RTC::attach(tick, RTC::Second);
}

//https://docs.mbed.com/docs/mbed-os-api-reference/en/5.3/APIs/tasks/rtos/

//Semaphore(count)
//int32_t wait(millisec)
//osStatus release()

//Mutex();
//osStatus lock();
//bool trylock();
//osStatus unlock();