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@2:3576839565ae, 2017-09-04 (annotated)
- Committer:
- ThierryLeonard
- Date:
- Mon Sep 04 22:57:54 2017 +0000
- Revision:
- 2:3576839565ae
- Child:
- 6:909e7877d915
- Child:
- 7:b1b4db3eedb4
Afficheur Spi
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 | 2:3576839565ae | 4 | |
| 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 | 2:3576839565ae | 11 | |
| ThierryLeonard | 2:3576839565ae | 12 | void Afficheur::write(char* characters,int length ) |
| ThierryLeonard | 2:3576839565ae | 13 | { |
| ThierryLeonard | 2:3576839565ae | 14 | static char buf[20]; |
| ThierryLeonard | 2:3576839565ae | 15 | resetDisplay(); |
| ThierryLeonard | 2:3576839565ae | 16 | afficheur.write(characters,length,buf,20); |
| ThierryLeonard | 2:3576839565ae | 17 | } |
| ThierryLeonard | 2:3576839565ae | 18 | void Afficheur::write(char ch) |
| ThierryLeonard | 2:3576839565ae | 19 | { |
| ThierryLeonard | 2:3576839565ae | 20 | static char buf[1]; |
| ThierryLeonard | 2:3576839565ae | 21 | afficheur.write(&ch,1,buf,1); |
| ThierryLeonard | 2:3576839565ae | 22 | } |
| ThierryLeonard | 2:3576839565ae | 23 | void Afficheur::resetDisplay() |
| ThierryLeonard | 2:3576839565ae | 24 | { |
| ThierryLeonard | 2:3576839565ae | 25 | char buf[1]; |
| ThierryLeonard | 2:3576839565ae | 26 | afficheur.write("v",1,buf,1); |
| ThierryLeonard | 2:3576839565ae | 27 | } |
| ThierryLeonard | 2:3576839565ae | 28 | void Afficheur::showDot() |
| ThierryLeonard | 2:3576839565ae | 29 | { |
| ThierryLeonard | 2:3576839565ae | 30 | char command[2] = {'w',2}; |
| ThierryLeonard | 2:3576839565ae | 31 | char buf[2]; |
| ThierryLeonard | 2:3576839565ae | 32 | afficheur.write(command,2,buf, 2); |
| ThierryLeonard | 2:3576839565ae | 33 | } |
| ThierryLeonard | 2:3576839565ae | 34 | void Afficheur::hideDot() |
| ThierryLeonard | 2:3576839565ae | 35 | { |
| ThierryLeonard | 2:3576839565ae | 36 | char command[2] = {'w',0}; |
| ThierryLeonard | 2:3576839565ae | 37 | char buf[2]; |
| ThierryLeonard | 2:3576839565ae | 38 | afficheur.write(command,2,buf, 2); |
| ThierryLeonard | 2:3576839565ae | 39 | } |
