Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@0:34546ec29db9, 2019-03-02 (annotated)
- Committer:
- Sigma884
- Date:
- Sat Mar 02 15:44:19 2019 +0000
- Revision:
- 0:34546ec29db9
ES920 test program (STM32 F303K8); Please set CR+LF to send
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Sigma884 | 0:34546ec29db9 | 1 | #include "mbed.h" |
| Sigma884 | 0:34546ec29db9 | 2 | |
| Sigma884 | 0:34546ec29db9 | 3 | Serial pc(USBTX, USBRX, 115200); |
| Sigma884 | 0:34546ec29db9 | 4 | Serial es920(D1, D0, 115200); |
| Sigma884 | 0:34546ec29db9 | 5 | |
| Sigma884 | 0:34546ec29db9 | 6 | void readPC(); |
| Sigma884 | 0:34546ec29db9 | 7 | void readES(); |
| Sigma884 | 0:34546ec29db9 | 8 | |
| Sigma884 | 0:34546ec29db9 | 9 | int main() { |
| Sigma884 | 0:34546ec29db9 | 10 | pc.attach(&readPC, Serial::RxIrq); |
| Sigma884 | 0:34546ec29db9 | 11 | es920.attach(&readES, Serial::RxIrq); |
| Sigma884 | 0:34546ec29db9 | 12 | while(1) { |
| Sigma884 | 0:34546ec29db9 | 13 | } |
| Sigma884 | 0:34546ec29db9 | 14 | } |
| Sigma884 | 0:34546ec29db9 | 15 | |
| Sigma884 | 0:34546ec29db9 | 16 | void readPC(){ |
| Sigma884 | 0:34546ec29db9 | 17 | char c = pc.getc(); |
| Sigma884 | 0:34546ec29db9 | 18 | es920.printf("%c", c); |
| Sigma884 | 0:34546ec29db9 | 19 | /* |
| Sigma884 | 0:34546ec29db9 | 20 | if(c == '\r'){ |
| Sigma884 | 0:34546ec29db9 | 21 | pc.printf("\n"); |
| Sigma884 | 0:34546ec29db9 | 22 | } |
| Sigma884 | 0:34546ec29db9 | 23 | */ |
| Sigma884 | 0:34546ec29db9 | 24 | pc.printf("%c", c); |
| Sigma884 | 0:34546ec29db9 | 25 | } |
| Sigma884 | 0:34546ec29db9 | 26 | |
| Sigma884 | 0:34546ec29db9 | 27 | void readES(){ |
| Sigma884 | 0:34546ec29db9 | 28 | char c = es920.getc(); |
| Sigma884 | 0:34546ec29db9 | 29 | pc.printf("%c", c); |
| Sigma884 | 0:34546ec29db9 | 30 | } |