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.
Afficheur.cpp@9:b9ac1d914762, 2017-09-05 (annotated)
- Committer:
- ThierryLeonard
- Date:
- Tue Sep 05 10:27:28 2017 +0000
- Revision:
- 9:b9ac1d914762
- Parent:
- 8:5124be43c963
Merged, working UART with accelerometer
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ThierryLeonard | 2:3576839565ae | 1 | |
| ThierryLeonard | 2:3576839565ae | 2 | |
| ThierryLeonard | 2:3576839565ae | 3 | #include "Afficheur.h" |
| ThierryLeonard | 7:b1b4db3eedb4 | 4 | #ifdef USESPI |
| ThierryLeonard | 2:3576839565ae | 5 | Afficheur::Afficheur():afficheur(p5,p6,p7),chipSelect(p8) |
| ThierryLeonard | 2:3576839565ae | 6 | { |
| ThierryLeonard | 2:3576839565ae | 7 | afficheur.format(8,0); |
| ThierryLeonard | 2:3576839565ae | 8 | afficheur.frequency(50000); |
| ThierryLeonard | 2:3576839565ae | 9 | chipSelect = 0; |
| ThierryLeonard | 2:3576839565ae | 10 | } |
| ThierryLeonard | 7:b1b4db3eedb4 | 11 | #else |
| ThierryLeonard | 7:b1b4db3eedb4 | 12 | Afficheur::Afficheur():afficheur(),chipSelect(p8) |
| ThierryLeonard | 7:b1b4db3eedb4 | 13 | { |
| ThierryLeonard | 7:b1b4db3eedb4 | 14 | chipSelect = 1; |
| ThierryLeonard | 7:b1b4db3eedb4 | 15 | } |
| ThierryLeonard | 7:b1b4db3eedb4 | 16 | #endif |
| ThierryLeonard | 9:b9ac1d914762 | 17 | void Afficheur::write(char* characters,int length, int commaFlags ) |
| ThierryLeonard | 2:3576839565ae | 18 | { |
| evrast | 6:909e7877d915 | 19 | |
| ThierryLeonard | 8:5124be43c963 | 20 | Serial pc(USBTX, USBRX); |
| ThierryLeonard | 2:3576839565ae | 21 | static char buf[20]; |
| ThierryLeonard | 2:3576839565ae | 22 | resetDisplay(); |
| evrast | 6:909e7877d915 | 23 | afficheur.write(characters,length,buf,20); |
| ThierryLeonard | 9:b9ac1d914762 | 24 | showDot(commaFlags); |
| ThierryLeonard | 2:3576839565ae | 25 | } |
| ThierryLeonard | 2:3576839565ae | 26 | void Afficheur::write(char ch) |
| ThierryLeonard | 2:3576839565ae | 27 | { |
| ThierryLeonard | 7:b1b4db3eedb4 | 28 | char buf[1]; |
| ThierryLeonard | 2:3576839565ae | 29 | afficheur.write(&ch,1,buf,1); |
| ThierryLeonard | 2:3576839565ae | 30 | } |
| ThierryLeonard | 2:3576839565ae | 31 | void Afficheur::resetDisplay() |
| ThierryLeonard | 2:3576839565ae | 32 | { |
| ThierryLeonard | 2:3576839565ae | 33 | char buf[1]; |
| ThierryLeonard | 2:3576839565ae | 34 | afficheur.write("v",1,buf,1); |
| ThierryLeonard | 2:3576839565ae | 35 | } |
| evrast | 6:909e7877d915 | 36 | void Afficheur::showDot(int expo) |
| ThierryLeonard | 2:3576839565ae | 37 | { |
| evrast | 6:909e7877d915 | 38 | char command[2] = {'w',expo}; |
| ThierryLeonard | 2:3576839565ae | 39 | char buf[2]; |
| ThierryLeonard | 2:3576839565ae | 40 | afficheur.write(command,2,buf, 2); |
| ThierryLeonard | 2:3576839565ae | 41 | } |
| ThierryLeonard | 2:3576839565ae | 42 | void Afficheur::hideDot() |
| ThierryLeonard | 2:3576839565ae | 43 | { |
| ThierryLeonard | 2:3576839565ae | 44 | char command[2] = {'w',0}; |
| ThierryLeonard | 2:3576839565ae | 45 | char buf[2]; |
| ThierryLeonard | 2:3576839565ae | 46 | afficheur.write(command,2,buf, 2); |
| ThierryLeonard | 2:3576839565ae | 47 | } |
