output text on Seven-segment display, 4 digits, SPI, 74HC4094PW
QuadDisplay2.h@0:f8d176816ac2, 2019-06-13 (annotated)
- Committer:
- docent
- Date:
- Thu Jun 13 16:25:50 2019 +0000
- Revision:
- 0:f8d176816ac2
For my students 13.06.2019
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
docent | 0:f8d176816ac2 | 1 | #ifndef QUAD_DISPLAY |
docent | 0:f8d176816ac2 | 2 | #define QUAD_DISPLAY |
docent | 0:f8d176816ac2 | 3 | |
docent | 0:f8d176816ac2 | 4 | #include "mbed.h" |
docent | 0:f8d176816ac2 | 5 | #include <assert.h> |
docent | 0:f8d176816ac2 | 6 | /* |
docent | 0:f8d176816ac2 | 7 | original |
docent | 0:f8d176816ac2 | 8 | ___7___ |
docent | 0:f8d176816ac2 | 9 | / \ |
docent | 0:f8d176816ac2 | 10 | | | |
docent | 0:f8d176816ac2 | 11 | 2| |6 |
docent | 0:f8d176816ac2 | 12 | \___1___/ |
docent | 0:f8d176816ac2 | 13 | / \ |
docent | 0:f8d176816ac2 | 14 | | | |
docent | 0:f8d176816ac2 | 15 | 3| |5 |
docent | 0:f8d176816ac2 | 16 | \___4___/ |
docent | 0:f8d176816ac2 | 17 | *0 |
docent | 0:f8d176816ac2 | 18 | ----my--------- |
docent | 0:f8d176816ac2 | 19 | |
docent | 0:f8d176816ac2 | 20 | ___1___ |
docent | 0:f8d176816ac2 | 21 | / \ |
docent | 0:f8d176816ac2 | 22 | | | |
docent | 0:f8d176816ac2 | 23 | 6| |2 |
docent | 0:f8d176816ac2 | 24 | \___7___/ |
docent | 0:f8d176816ac2 | 25 | / \ |
docent | 0:f8d176816ac2 | 26 | | | |
docent | 0:f8d176816ac2 | 27 | 5| |3 |
docent | 0:f8d176816ac2 | 28 | \___4___/ |
docent | 0:f8d176816ac2 | 29 | *0 |
docent | 0:f8d176816ac2 | 30 | |
docent | 0:f8d176816ac2 | 31 | */ |
docent | 0:f8d176816ac2 | 32 | |
docent | 0:f8d176816ac2 | 33 | #define QD_NONE 0//my 0 |
docent | 0:f8d176816ac2 | 34 | #define QD_DOT 1//my 1 |
docent | 0:f8d176816ac2 | 35 | #define QD_MINUS 0b10000000//my 2 |
docent | 0:f8d176816ac2 | 36 | |
docent | 0:f8d176816ac2 | 37 | #define QD_UNDERSCORE 0b00010000//my 3 |
docent | 0:f8d176816ac2 | 38 | #define QD_DEGREE 0b11000110//my 4 |
docent | 0:f8d176816ac2 | 39 | #define QD_UNDER_DEGREE 0b10111000//my 5 |
docent | 0:f8d176816ac2 | 40 | #define QD_UPPERSCORE 0b00000010//my 6 |
docent | 0:f8d176816ac2 | 41 | #define QD_COMMAS 0b00000100//my 7 |
docent | 0:f8d176816ac2 | 42 | #define QD_UNDERCOMMAS 0b00001000//my 8 |
docent | 0:f8d176816ac2 | 43 | //76543210 |
docent | 0:f8d176816ac2 | 44 | #define QD_0 0b01111110 |
docent | 0:f8d176816ac2 | 45 | #define QD_1 0b00001100//my |
docent | 0:f8d176816ac2 | 46 | #define QD_2 0b10110110//my |
docent | 0:f8d176816ac2 | 47 | #define QD_3 0b10011110//my |
docent | 0:f8d176816ac2 | 48 | #define QD_4 0b11001100//my |
docent | 0:f8d176816ac2 | 49 | #define QD_5 0b11011010//my |
docent | 0:f8d176816ac2 | 50 | #define QD_6 0b11111010//my |
docent | 0:f8d176816ac2 | 51 | #define QD_7 0b00001110//my |
docent | 0:f8d176816ac2 | 52 | #define QD_8 0b11111110//my |
docent | 0:f8d176816ac2 | 53 | #define QD_9 0b11011110//my |
docent | 0:f8d176816ac2 | 54 | |
docent | 0:f8d176816ac2 | 55 | #define QD_A 0b00000000 |
docent | 0:f8d176816ac2 | 56 | #define QD_a 0b00000000 |
docent | 0:f8d176816ac2 | 57 | #define QD_b 0b00000000 |
docent | 0:f8d176816ac2 | 58 | #define QD_C 0b01100000 |
docent | 0:f8d176816ac2 | 59 | #define QD_c 0b00000000 |
docent | 0:f8d176816ac2 | 60 | //76543210 |
docent | 0:f8d176816ac2 | 61 | #define QD_d 0b10111100//my |
docent | 0:f8d176816ac2 | 62 | #define QD_E 0b00000000 |
docent | 0:f8d176816ac2 | 63 | #define QD_f 0b00000000 |
docent | 0:f8d176816ac2 | 64 | #define QD_F QD_f |
docent | 0:f8d176816ac2 | 65 | #define QD_H 0b11101100 //my |
docent | 0:f8d176816ac2 | 66 | #define QD_h 0b00000000 |
docent | 0:f8d176816ac2 | 67 | #define QD_I QD_1 |
docent | 0:f8d176816ac2 | 68 | #define QD_J 0b00000000 |
docent | 0:f8d176816ac2 | 69 | #define QD_K QD_H |
docent | 0:f8d176816ac2 | 70 | #define QD_L 0b00000000 |
docent | 0:f8d176816ac2 | 71 | #define QD_n 0b00000000 |
docent | 0:f8d176816ac2 | 72 | #define QD_o 0b00000000 |
docent | 0:f8d176816ac2 | 73 | #define QD_O QD_0 |
docent | 0:f8d176816ac2 | 74 | //76543210 |
docent | 0:f8d176816ac2 | 75 | #define QD_P 0b11100110//my |
docent | 0:f8d176816ac2 | 76 | #define QD_r 0b00000000 |
docent | 0:f8d176816ac2 | 77 | #define QD_S 0b00000000 |
docent | 0:f8d176816ac2 | 78 | #define QD_t 0b00000000 |
docent | 0:f8d176816ac2 | 79 | #define QD_u 0b00000000 |
docent | 0:f8d176816ac2 | 80 | #define QD_U 0b00000000 |
docent | 0:f8d176816ac2 | 81 | #define QD_Y 0b00000000 |
docent | 0:f8d176816ac2 | 82 | |
docent | 0:f8d176816ac2 | 83 | |
docent | 0:f8d176816ac2 | 84 | class QuadDisplayMy |
docent | 0:f8d176816ac2 | 85 | { |
docent | 0:f8d176816ac2 | 86 | private: |
docent | 0:f8d176816ac2 | 87 | SPI *_dev_spi; |
docent | 0:f8d176816ac2 | 88 | DigitalOut _cs_pin; |
docent | 0:f8d176816ac2 | 89 | uint8_t conv(uint8_t c); |
docent | 0:f8d176816ac2 | 90 | public: |
docent | 0:f8d176816ac2 | 91 | QuadDisplayMy(SPI *spi, PinName cs_pin); |
docent | 0:f8d176816ac2 | 92 | void displayDigits(uint8_t *text); |
docent | 0:f8d176816ac2 | 93 | }; |
docent | 0:f8d176816ac2 | 94 | |
docent | 0:f8d176816ac2 | 95 | #endif |