test pour buffer

main.cpp

Committer:
gr91
Date:
2020-11-22
Revision:
8:23fca4edc6b9
Parent:
7:37ea12f2b18f
Child:
9:a9dfb95b5d8a

File content as of revision 8:23fca4edc6b9:

#include "mbed.h"
// Echo
// lien serie via USB avec Terarerm
// GR 2020
// Universite Paris-Saclay - IUT Cachan
//
//
RawSerial pc_raw(USBTX, USBRX);  // ou SERIAL-TX, SERIAL_RX  ou PA_2,PA_3
DigitalOut ledB(D8);
void reception_symbole(void);
int main()
{

    pc_raw.baud(115200);
    pc_raw.attach(&reception_symbole);
    pc_raw.printf("Echo test\r\n");
    ledB=0;
    while(1) {
    }
}
void reception_symbole(void)
{
    unsigned char c;
    if(pc_raw.readable()) {
        ledB=!ledB;
        c=pc_raw.getc();
        pc_raw.putc(c);
    }
}