00001
00090 #ifndef DRV_LED_7SEG_H
00091 #define DRV_LED_7SEG_H
00092
00093 #include "cfg/cfg_led_7seg.h"
00094 #include <drv/timer.h>
00095 #include <mware/event.h>
00096
00112 #if CONFIG_LED_7SEG_CCAT
00113 static const uint8_t segstable[] =
00114 {
00115 0x3f, 0x6, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x7, 0x7f,
00116 0x6f, 0x80, 0x40, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71,
00117 0x3d, 0x74, 0x30, 0x1e, 0x75, 0x38, 0x15, 0x37, 0x3f,
00118 0x73, 0x67, 0x50, 0x6d, 0x78, 0x3e, 0x2a, 0x6a, 0x76,
00119 0x6e, 0x5b, 0x0
00120 };
00121 #else
00122 static const uint8_t segstable[] =
00123 {
00124 0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80,
00125 0x90, 0x7f, 0xbf, 0x88, 0x83, 0xc6, 0xa1, 0x86, 0x8e,
00126 0xc2, 0x8b, 0xcf, 0xe1, 0x8a, 0xc7, 0xea, 0xc8, 0xc0,
00127 0x8c, 0x98, 0xaf, 0x92, 0x87, 0xc1, 0xd5, 0x95, 0x89,
00128 0x91, 0xa4, 0xff
00129 };
00130 #endif
00131
00137 typedef struct SevenSeg
00138 {
00140 uint8_t string[CONFIG_LED_7SEG_STRLEN];
00142 unsigned int string_len;
00144 bool blink;
00146 uint8_t bdigit;
00148 bool runonce;
00150 unsigned int speed;
00152 unsigned int curspeed;
00154 bool firstrun;
00156 unsigned int curpos;
00158 unsigned int curdigit;
00160 bool busyedit;
00161 } SevenSeg;
00162
00163
00164
00165
00166
00167
00168
00169
00170 int sevenseg_print(SevenSeg *SS, const char *sstring);
00171
00172
00173
00174
00175
00176 void sevenseg_init(SevenSeg *SS);
00177
00178
00179
00180
00181
00182 void sevenseg_test(SevenSeg *SS);
00183
00184
00185
00186
00187
00188 bool sevenseg_isReady(SevenSeg *SS);
00189
00190
00191
00192
00193
00194 bool sevenseg_unlock(SevenSeg *SS);
00195
00196
00197
00198
00199
00200 bool sevenseg_lock(SevenSeg *SS);
00201
00202
00203
00204
00205
00206
00207 bool sevenseg_setBlink(SevenSeg *SS, bool blink, uint8_t digit);
00208
00209
00210
00211
00212
00213 bool sevenseg_setRunonce(SevenSeg *SS, bool runonce);
00214
00215
00216
00217
00218
00219
00220
00221 bool sevenseg_setRunspeed(SevenSeg *SS, unsigned int r_speed);
00222
00223
00224
00225
00226
00227 bool sevenseg_clear(SevenSeg *SS);
00228
00229 #endif
00230