This is a driver library for the popular QDSP-6064 bubble display. These miniature displays can be leveraged for small breadboard projects in order to display debug information or even in larger projects where LCD displays are unpractical.

Dependents:   QDSP-6064-hello

Fork of BubbleDisplay by Michael Dushkoff

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers bubble.h Source File

bubble.h

00001 /* * * * * * * * * * * * * * * * * * * * * * * * * * *
00002  * This drives the popular QDSP-6064 bubble display. *
00003  *                                                   *
00004  * Created by: Michael Dushkoff (mad1841@rit.edu)    *
00005  * * * * * * * * * * * * * * * * * * * * * * * * * * */
00006 
00007 #ifndef BUBBLE_DISPLAY_H
00008 #define BUBBLE_DISPLAY_H
00009 
00010 #include "mbed.h"
00011 
00012 // Definitions
00013 #define DEF_DISPL_FREQ (10000.0) // 10kHz display frequency
00014 
00015 // LUT for character to display
00016 const char dispTabl[] = {
00017     0x7E, // 0
00018     0x30, // 1
00019     0x6D, // 2
00020     0x79, // 3
00021     0x33, // 4
00022     0x5B, // 5
00023     0x5F, // 6
00024     0x70, // 7
00025     0x7F, // 8
00026     0x7B, // 9
00027     0x77, // 10  "A"
00028     0x1F, // 11  "B"
00029     0x4E, // 12  "C"
00030     0x3D, // 13  "D"
00031     0x4F, // 14  "E"
00032     0x47, // 15  "F"
00033     0x00, // 16  NO DISPLAY
00034     0x00, // 17  NO DISPLAY
00035     0x00, // 18  NO DISPLAY
00036     0x00, // 19  NO DISPLAY
00037     0x00, // 20  NO DISPLAY
00038     0x00, // 21  NO DISPLAY
00039     0x00, // 22  NO DISPLAY
00040     0x00, // 23  NO DISPLAY
00041     0x00, // 24  NO DISPLAY
00042     0x00, // 25  NO DISPLAY
00043     0x00, // 26  NO DISPLAY
00044     0x00, // 27  NO DISPLAY
00045     0x00, // 28  NO DISPLAY
00046     0x00, // 29  NO DISPLAY
00047     0x00, // 30  NO DISPLAY
00048     0x00, // 31  NO DISPLAY
00049     0x00, // 32 ' '
00050     0x00, // 33 '!'  NO DISPLAY
00051     0x22, // 34 '"'
00052     0x00, // 35 '#'  NO DISPLAY
00053     0x00, // 36 '$'  NO DISPLAY
00054     0x00, // 37 '%'  NO DISPLAY
00055     0x00, // 38 '&'  NO DISPLAY
00056     0x20, // 39 '''
00057     0x4E, // 40 '('
00058     0x78, // 41 ')'
00059     0x00, // 42 '*'  NO DISPLAY
00060     0x00, // 43 '+'  NO DISPLAY
00061     0x04, // 44 ','
00062     0x01, // 45 '-'
00063     0x80, // 46 '.'  Decimal
00064     0x00, // 47 '/'  NO DISPLAY
00065     0x7E, // 48 '0'
00066     0x30, // 49 '1'
00067     0x6D, // 50 '2'
00068     0x79, // 51 '3'
00069     0x33, // 52 '4'
00070     0x5B, // 53 '5'
00071     0x5F, // 54 '6'
00072     0x70, // 55 '7'
00073     0x7F, // 56 '8'
00074     0x7B, // 57 '9'
00075     0x00, // 58 ':'  NO DISPLAY
00076     0x00, // 59 ';'  NO DISPLAY
00077     0x00, // 60 '<'  NO DISPLAY
00078     0x00, // 61 '='  NO DISPLAY
00079     0x00, // 62 '>'  NO DISPLAY
00080     0x00, // 63 '?'  NO DISPLAY
00081     0x00, // 64 '@'  NO DISPLAY
00082     0x77, // 65 'A'
00083     0x1F, // 66 'B'
00084     0x4E, // 67 'C'
00085     0x3D, // 68 'D'
00086     0x4F, // 69 'E'
00087     0x47, // 70 'F'
00088     0x5E, // 71 'G'
00089     0x37, // 72 'H'
00090     0x30, // 73 'I'
00091     0x38, // 74 'J'
00092     0x00, // 75 'K'  NO DISPLAY
00093     0x0E, // 76 'L'
00094     0x00, // 77 'M'  NO DISPLAY
00095     0x15, // 78 'N'
00096     0x7E, // 79 'O'
00097     0x67, // 80 'P'
00098     0x73, // 81 'Q'
00099     0x05, // 82 'R'
00100     0x5B, // 83 'S'
00101     0x0F, // 84 'T'
00102     0x3E, // 85 'U'
00103     0x00, // 86 'V'  NO DISPLAY
00104     0x00, // 87 'W'  NO DISPLAY
00105     0x00, // 88 'X'  NO DISPLAY
00106     0x3B, // 89 'Y'
00107     0x00, // 90 'Z'  NO DISPLAY
00108     0x4E, // 91 '['
00109     0x00, // 92 '\'  NO DISPLAY
00110     0x78, // 93 ']'
00111     0x00, // 94 '^'  NO DISPLAY
00112     0x08, // 95 '_'
00113     0x02, // 96 '`'
00114     0x77, // 97 'a' SAME AS CAP
00115     0x1F, // 98 'b' SAME AS CAP
00116     0x0D, // 99 'c'
00117     0x3D, // 100 'd' SAME AS CAP
00118     0x6F, // 101 'e'
00119     0x47, // 102 'f' SAME AS CAP
00120     0x5E, // 103 'g' SAME AS CAP
00121     0x17, // 104 'h'
00122     0x10, // 105 'i'
00123     0x38, // 106 'j' SAME AS CAP
00124     0x00, // 107 'k'  NO DISPLAY
00125     0x30, // 108 'l'
00126     0x00, // 109 'm'  NO DISPLAY
00127     0x15, // 110 'n' SAME AS CAP
00128     0x1D, // 111 'o'
00129     0x67, // 112 'p' SAME AS CAP
00130     0x73, // 113 'q' SAME AS CAP
00131     0x05, // 114 'r' SAME AS CAP
00132     0x5B, // 115 's' SAME AS CAP
00133     0x0F, // 116 't' SAME AS CAP
00134     0x1C, // 117 'u'
00135     0x00, // 118 'b'  NO DISPLAY
00136     0x00, // 119 'w'  NO DISPLAY
00137     0x00, // 120 'x'  NO DISPLAY
00138     0x00, // 121 'y'  NO DISPLAY
00139     0x00, // 122 'z'  NO DISPLAY
00140     0x00, // 123 '0b'  NO DISPLAY
00141     0x00, // 124 '|'  NO DISPLAY
00142     0x00, // 125 ','  NO DISPLAY
00143     0x00, // 126 '~'  NO DISPLAY
00144     0x00, // 127 'DEL'  NO DISPLAY
00145 };
00146 
00147 class BubbleDisplay{
00148 public:
00149     /*
00150      * This is the default BubbleDisplay constructor that
00151      * maps the pins in a simple way for the LPC11U24.
00152      */ 
00153     BubbleDisplay();
00154 
00155     /*
00156      * This allows a user to map the pins of the bubble display
00157      * to any possible pin that they desire.
00158      */
00159     BubbleDisplay(PinName m0, PinName m1, PinName m2, PinName m3,
00160                   PinName m4, PinName m5, PinName m6, PinName m7,
00161                   PinName m8, PinName m9, PinName m10, PinName m11);
00162                   
00163     /*
00164      * Default destructor
00165      */
00166     ~BubbleDisplay();
00167                   
00168     /*
00169      * This sets the cycle frequency to a specific value instead of the
00170      * default 10kHz.
00171      */
00172      void setFreq(double freq);
00173     
00174     /*
00175      * This writes a sequence of characters from left to right
00176      * to the seven-segment displays.
00177      */
00178     void write(char c1, char c2, char c3, char c4);
00179     
00180     /*
00181      * This writes a sequence of characters from left to right
00182      * to the seven-segment displays.
00183      */
00184     void write(char* c);
00185 
00186     /*
00187      * This writes a sequence of integer number
00188      * to the seven-segment displays.
00189      */
00190     void write(uint16_t num);
00191 
00192 private:
00193     /*
00194      * This is a constructor helper function
00195      */
00196     void init(PinName m0, PinName m1, PinName m2, PinName m3,
00197                   PinName m4, PinName m5, PinName m6, PinName m7,
00198                   PinName m8, PinName m9, PinName m10, PinName m11);
00199     
00200     /*
00201      * This cycles through the four seven segment displays on the
00202      * bubble display by switching on and off the correct cathodes.
00203      */
00204     void cycle();
00205     
00206     /* Private variables */
00207     Ticker _cycler;
00208     double _freq; // The cycle frequency
00209     char _seg; // The current display number
00210     // All of the pins
00211     DigitalOut* _cat1;
00212     DigitalOut* _anE;
00213     DigitalOut* _anC;
00214     DigitalOut* _cat3;
00215     DigitalOut* _anDP;
00216     DigitalOut* _cat4;
00217     DigitalOut* _anG;
00218     DigitalOut* _anD;
00219     DigitalOut* _anF;
00220     DigitalOut* _cat2;
00221     DigitalOut* _anB;
00222     DigitalOut* _anA;
00223     // Segement values
00224     char _chrs[4];
00225 };
00226 
00227 #endif