7-Segment Display Driver class, via an 8-bit shift register (such as the 74HC595)

Fork of 7SegSRDriver by Paul Law

Committer:
sefyou
Date:
Tue Jun 06 13:50:47 2017 +0000
Revision:
2:5f76214d096c
Parent:
1:e55f543bc06b
yoo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
paul80nd 0:1832d0ed8da8 1 #ifndef LIB_SSEGSRDRIVER_H
paul80nd 0:1832d0ed8da8 2 #define LIB_SSEGSRDRIVER_H
paul80nd 0:1832d0ed8da8 3
paul80nd 0:1832d0ed8da8 4 #include "mbed.h"
paul80nd 0:1832d0ed8da8 5
paul80nd 0:1832d0ed8da8 6 #define SSegSRDriver_COMN_ANODE 0
paul80nd 0:1832d0ed8da8 7 #define SSegSRDriver_COMN_CATHODE 1
paul80nd 0:1832d0ed8da8 8
sefyou 2:5f76214d096c 9 const unsigned char nbr_envoye[11] = {0x3f, 0x30 , 0x6d, 0x79, 0x72, 0x5b, 0x5f, 0x33, 0x7f, 0x7b, 0x00};
sefyou 2:5f76214d096c 10 const unsigned char nbr_envoye_2[11] = {0x3f, 0x30 , 0x6d, 0x79, 0x72, 0x5b, 0x5f, 0x33, 0x7f, 0x7b, 0x00};
sefyou 2:5f76214d096c 11 const unsigned char nbr_envoye_3[11] = {0x3f, 0x30 , 0x6d, 0x79, 0x72, 0x5b, 0x5f, 0x33, 0x7f, 0x7b, 0x00};
sefyou 2:5f76214d096c 12 const unsigned char nbr_envoye_4[11] = {0x3f, 0x30 , 0x6d, 0x79, 0x72, 0x5b, 0x5f, 0x33, 0x7f, 0x7b, 0x00};
paul80nd 0:1832d0ed8da8 13
sefyou 2:5f76214d096c 14
sefyou 2:5f76214d096c 15 /************************************************** CHRONOMETRE ****************************************************/
sefyou 2:5f76214d096c 16
sefyou 2:5f76214d096c 17
sefyou 2:5f76214d096c 18 class SSegSRDriver_chronometre {
paul80nd 0:1832d0ed8da8 19
paul80nd 0:1832d0ed8da8 20 public:
paul80nd 0:1832d0ed8da8 21
sefyou 2:5f76214d096c 22 SSegSRDriver_chronometre(PinName srData, PinName srClock, PinName srLatch, bool disp_type);
sefyou 2:5f76214d096c 23 void write_chronometre(unsigned char number, bool dp);
sefyou 2:5f76214d096c 24 void write_chronometre_2(unsigned char number_deux, bool dp); //
sefyou 2:5f76214d096c 25 void write_chronometre_3(unsigned char number_trois, bool dp);
sefyou 2:5f76214d096c 26 void write_chronometre_4(unsigned char number_quatre, bool dp);
sefyou 2:5f76214d096c 27
sefyou 2:5f76214d096c 28 void bus_chronometre_1(unsigned char number); // inustruction pour le bus 1 de 0 a 8 bit
sefyou 2:5f76214d096c 29 void bus_chronometre_2(unsigned char number_deux); // inustruction pour le bus 2 de 0 a 8 bit
sefyou 2:5f76214d096c 30 void bus_chronometre_3(unsigned char number_trois);
sefyou 2:5f76214d096c 31 void bus_chronometre_4(unsigned char number_quatre);
sefyou 2:5f76214d096c 32 void clear();
paul80nd 0:1832d0ed8da8 33
sefyou 2:5f76214d096c 34 private:
sefyou 2:5f76214d096c 35
sefyou 2:5f76214d096c 36 DigitalOut _srData;
sefyou 2:5f76214d096c 37 DigitalOut _srClock;
sefyou 2:5f76214d096c 38 DigitalOut _srLatch;
sefyou 2:5f76214d096c 39 bool _disp_type;
sefyou 2:5f76214d096c 40 };
sefyou 2:5f76214d096c 41
sefyou 2:5f76214d096c 42
sefyou 2:5f76214d096c 43 /************************************************** DOMICILE ****************************************************/
sefyou 2:5f76214d096c 44
sefyou 2:5f76214d096c 45
sefyou 2:5f76214d096c 46 class SSegSRDriver_domicile {
sefyou 2:5f76214d096c 47
sefyou 2:5f76214d096c 48 public:
sefyou 2:5f76214d096c 49
sefyou 2:5f76214d096c 50 SSegSRDriver_domicile(PinName srData, PinName srClock, PinName srLatch, bool disp_type);
sefyou 2:5f76214d096c 51
sefyou 2:5f76214d096c 52 void set_type(bool disp_type);
sefyou 2:5f76214d096c 53 void write_domicile(unsigned char number, bool dp);
sefyou 2:5f76214d096c 54 void write_domicile_2(unsigned char number_deux, bool dp);
sefyou 2:5f76214d096c 55 void write_domicile_3(unsigned char number_trois, bool dp);
sefyou 2:5f76214d096c 56
sefyou 2:5f76214d096c 57 void bus_domicile_1(unsigned char number); // inustruction pour le bus 1 de 0 a 8 bit
sefyou 2:5f76214d096c 58 void bus_domicile_2(unsigned char number_deux); // inustruction pour le bus 2 de 0 a 8 bit
sefyou 2:5f76214d096c 59 void bus_domicile_3(unsigned char number_trois);
sefyou 2:5f76214d096c 60 void clear();
paul80nd 0:1832d0ed8da8 61
sefyou 2:5f76214d096c 62 private:
sefyou 2:5f76214d096c 63
sefyou 2:5f76214d096c 64 DigitalOut _srData;
sefyou 2:5f76214d096c 65 DigitalOut _srClock;
sefyou 2:5f76214d096c 66 DigitalOut _srLatch;
sefyou 2:5f76214d096c 67 bool _disp_type;
sefyou 2:5f76214d096c 68 };
sefyou 2:5f76214d096c 69
sefyou 2:5f76214d096c 70
sefyou 2:5f76214d096c 71 /************************************************** VISITEUR ****************************************************/
sefyou 2:5f76214d096c 72
sefyou 2:5f76214d096c 73
sefyou 2:5f76214d096c 74 class SSegSRDriver_visiteur {
sefyou 2:5f76214d096c 75
sefyou 2:5f76214d096c 76 public:
sefyou 2:5f76214d096c 77
sefyou 2:5f76214d096c 78 SSegSRDriver_visiteur(PinName srData, PinName srClock, PinName srLatch, bool disp_type);
sefyou 2:5f76214d096c 79
sefyou 2:5f76214d096c 80 void set_type(bool disp_type);
sefyou 2:5f76214d096c 81 void write_visiteur(unsigned char number, bool dp);
sefyou 2:5f76214d096c 82 void write_visiteur_2(unsigned char number_deux, bool dp);
sefyou 2:5f76214d096c 83 void write_visiteur_3(unsigned char number_trois, bool dp);
paul80nd 0:1832d0ed8da8 84
sefyou 2:5f76214d096c 85 void bus_visiteur_1(unsigned char number); // inustruction pour le bus 1 de 0 a 8 bit
sefyou 2:5f76214d096c 86 void bus_visiteur_2(unsigned char number_deux); // inustruction pour le bus 2 de 0 a 8 bit
sefyou 2:5f76214d096c 87 void bus_visiteur_3(unsigned char number_trois);
sefyou 2:5f76214d096c 88 void clear();
paul80nd 0:1832d0ed8da8 89
paul80nd 0:1832d0ed8da8 90 private:
paul80nd 0:1832d0ed8da8 91
paul80nd 0:1832d0ed8da8 92 DigitalOut _srData;
paul80nd 0:1832d0ed8da8 93 DigitalOut _srClock;
paul80nd 0:1832d0ed8da8 94 DigitalOut _srLatch;
paul80nd 0:1832d0ed8da8 95 bool _disp_type;
paul80nd 0:1832d0ed8da8 96 };
paul80nd 0:1832d0ed8da8 97
paul80nd 0:1832d0ed8da8 98 #endif