test pour buffer

Committer:
gr91
Date:
Sun Nov 22 15:04:32 2020 +0000
Revision:
8:23fca4edc6b9
Parent:
7:37ea12f2b18f
Child:
9:a9dfb95b5d8a
Echo test isr

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gr91 0:3aa4ba0ada56 1 #include "mbed.h"
gr91 8:23fca4edc6b9 2 // Echo
gr91 8:23fca4edc6b9 3 // lien serie via USB avec Terarerm
gr91 3:500dfd62fb76 4 // GR 2020
gr91 6:a58f18b765cd 5 // Universite Paris-Saclay - IUT Cachan
gr91 2:08d83543c8ec 6 //
gr91 5:3f68adfd9cf9 7 //
gr91 8:23fca4edc6b9 8 RawSerial pc_raw(USBTX, USBRX); // ou SERIAL-TX, SERIAL_RX ou PA_2,PA_3
gr91 8:23fca4edc6b9 9 DigitalOut ledB(D8);
gr91 8:23fca4edc6b9 10 void reception_symbole(void);
gr91 0:3aa4ba0ada56 11 int main()
gr91 0:3aa4ba0ada56 12 {
gr91 8:23fca4edc6b9 13
gr91 8:23fca4edc6b9 14 pc_raw.baud(115200);
gr91 8:23fca4edc6b9 15 pc_raw.attach(&reception_symbole);
gr91 8:23fca4edc6b9 16 pc_raw.printf("Echo test\r\n");
gr91 8:23fca4edc6b9 17 ledB=0;
gr91 0:3aa4ba0ada56 18 while(1) {
gr91 8:23fca4edc6b9 19 }
gr91 8:23fca4edc6b9 20 }
gr91 8:23fca4edc6b9 21 void reception_symbole(void)
gr91 8:23fca4edc6b9 22 {
gr91 8:23fca4edc6b9 23 unsigned char c;
gr91 8:23fca4edc6b9 24 if(pc_raw.readable()) {
gr91 8:23fca4edc6b9 25 ledB=!ledB;
gr91 8:23fca4edc6b9 26 c=pc_raw.getc();
gr91 8:23fca4edc6b9 27 pc_raw.putc(c);
gr91 0:3aa4ba0ada56 28 }
gr91 0:3aa4ba0ada56 29 }
gr91 7:37ea12f2b18f 30
gr91 8:23fca4edc6b9 31