update for mbed-os-5.11 (and Nboard IHM-V2)

Dependencies:   IHM_V2

Committer:
jacquesolivierklein
Date:
Sat Feb 10 20:57:06 2018 +0000
Revision:
27:edb6c6685907
Parent:
22:af9dcf379926
Child:
28:be81ea276c3a
initial

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jacquesolivierklein 27:edb6c6685907 1 // Title : mbed-os-irq-semaphore
jacquesolivierklein 27:edb6c6685907 2 // Author: Jacques-Olivier Klein - IUT de CACHAN
jacquesolivierklein 27:edb6c6685907 3 // Date: 2018-02-10
jacquesolivierklein 27:edb6c6685907 4
Jonathan Austin 0:2757d7abb7d9 5 #include "mbed.h"
jacquesolivierklein 27:edb6c6685907 6 #include "IHM.h"
Jonathan Austin 0:2757d7abb7d9 7
jacquesolivierklein 27:edb6c6685907 8 IHM ihm;
jacquesolivierklein 27:edb6c6685907 9
jacquesolivierklein 27:edb6c6685907 10 DigitalOut L0 (PB_3) ; // led L0
jacquesolivierklein 27:edb6c6685907 11 DigitalOut L1 (PA_7) ; // led L1
jacquesolivierklein 27:edb6c6685907 12
jacquesolivierklein 27:edb6c6685907 13 InterruptIn BP0_Interrupt(PA_9);
jacquesolivierklein 27:edb6c6685907 14
jacquesolivierklein 27:edb6c6685907 15 void thread_Semaphore();
jacquesolivierklein 27:edb6c6685907 16 void isrBP0 ();
Jonathan Austin 0:2757d7abb7d9 17
jacquesolivierklein 27:edb6c6685907 18 Thread thread_waiting_for_semaphore (osPriorityNormal,DEFAULT_STACK_SIZE );;
jacquesolivierklein 27:edb6c6685907 19 Semaphore mysemaphore(0);
jacquesolivierklein 27:edb6c6685907 20
jacquesolivierklein 27:edb6c6685907 21 int main(void)
jacquesolivierklein 27:edb6c6685907 22 { ihm.LCD_clear();
jacquesolivierklein 27:edb6c6685907 23 ihm.LCD_printf("irq-semaphore-%s %s",__DATE__,__TIME__);
jacquesolivierklein 27:edb6c6685907 24 printf("mbed-os-irq-semaphore-%s %s\n\r",__DATE__,__TIME__);
jacquesolivierklein 27:edb6c6685907 25 printf("DEFAULT_STACK_SIZE:%d\n\r", DEFAULT_STACK_SIZE);
jacquesolivierklein 27:edb6c6685907 26
jacquesolivierklein 27:edb6c6685907 27 BP0_Interrupt.mode(PullUp);
jacquesolivierklein 27:edb6c6685907 28 thread_waiting_for_semaphore.start(thread_Semaphore);
jacquesolivierklein 27:edb6c6685907 29 BP0_Interrupt.fall(&isrBP0);
jacquesolivierklein 27:edb6c6685907 30 while(1){
jacquesolivierklein 27:edb6c6685907 31 L0=!L0;
jacquesolivierklein 27:edb6c6685907 32 printf("* [pid-%d]Main \n\r",Thread::gettid());
jacquesolivierklein 27:edb6c6685907 33 Thread::wait(200);
Jonathan Austin 0:2757d7abb7d9 34 }
Jonathan Austin 0:2757d7abb7d9 35 }
Jonathan Austin 1:846c97078558 36
jacquesolivierklein 27:edb6c6685907 37 void isrBP0 (){
jacquesolivierklein 27:edb6c6685907 38 mysemaphore.release();
jacquesolivierklein 27:edb6c6685907 39 }
jacquesolivierklein 27:edb6c6685907 40
jacquesolivierklein 27:edb6c6685907 41 void thread_Semaphore(){
jacquesolivierklein 27:edb6c6685907 42 while(1){
jacquesolivierklein 27:edb6c6685907 43 mysemaphore.wait();
jacquesolivierklein 27:edb6c6685907 44 L1=!L1;
jacquesolivierklein 27:edb6c6685907 45 printf(" * [pid-%d]Main \n\r",Thread::gettid());
jacquesolivierklein 27:edb6c6685907 46 }
jacquesolivierklein 27:edb6c6685907 47 }
jacquesolivierklein 27:edb6c6685907 48