00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00040 #ifndef __draw_drv_sure_2416_h
00041 #define __draw_drv_sure_2416_h
00042
00043 #include "config.h"
00044 #include "ht1632.h"
00045 #include "draw\draw.h"
00046 #include "draw\draw_screen_buffer.h"
00047
00048 #if ht1632_displays > 1
00049
00050 void drv_paint_display(uns16 buffer_loc) {
00051
00052 uns8 count;
00053 uns8 x, y, inv_y;
00054 uns8 byte_loc, bit_loc;
00055 uns8 data;
00056
00057
00058
00059
00060 set_pin (ht1632_data_port, ht1632_data_pin);
00061
00062 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00063 set_pin (ht1632_wr_port, ht1632_wr_pin);
00064
00065
00066 clear_pin (ht1632_data_port, ht1632_data_pin);
00067
00068 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00069 set_pin (ht1632_wr_port, ht1632_wr_pin);
00070
00071
00072 set_pin (ht1632_data_port, ht1632_data_pin);
00073
00074 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00075 set_pin (ht1632_wr_port, ht1632_wr_pin);
00076
00077
00078 clear_pin(ht1632_data_port, ht1632_data_pin);
00079
00080
00081 for(count = 0 ; count < 7 ; count++) {
00082
00083 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00084 set_pin (ht1632_wr_port, ht1632_wr_pin);
00085 }
00086
00087 for (count = 0; count < 48; count++) {
00088 data = draw_buffer0[buffer_loc];
00089 for (bit_loc = 0; bit_loc < 8; bit_loc++) {
00090 if (data.0) {
00091 set_pin(ht1632_data_port, ht1632_data_pin);
00092 } else {
00093 clear_pin(ht1632_data_port, ht1632_data_pin);
00094 }
00095 data = data >> 1;
00096 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00097 set_pin (ht1632_wr_port, ht1632_wr_pin);
00098 }
00099 buffer_loc++;
00100 }
00101
00102 }
00103
00104 void drv_paint() {
00105
00106 uns16 buffer_loc;
00107
00108 buffer_loc = 0;
00109
00110 #if ht1632_displays > 0
00111 clear_pin(ht1632_cs1_port, ht1632_cs1_pin);
00112 drv_paint_display(buffer_loc);
00113 set_pin(ht1632_cs1_port, ht1632_cs1_pin);
00114 #endif
00115 #if ht1632_displays > 1
00116 buffer_loc = buffer_loc + 48;
00117 clear_pin(ht1632_cs2_port, ht1632_cs2_pin);
00118 drv_paint_display(buffer_loc);
00119 set_pin(ht1632_cs2_port, ht1632_cs2_pin);
00120 #endif
00121 #if ht1632_displays > 2
00122 buffer_loc = buffer_loc + 48;
00123 clear_pin(ht1632_cs3_port, ht1632_cs3_pin);
00124 drv_paint_display(buffer_loc);
00125 set_pin(ht1632_cs3_port, ht1632_cs3_pin);
00126 #endif
00127 #if ht1632_displays > 3
00128 buffer_loc = buffer_loc + 48;
00129 clear_pin(ht1632_cs4_port, ht1632_cs4_pin);
00130 drv_paint_display(buffer_loc);
00131 set_pin(ht1632_cs4_port, ht1632_cs4_pin);
00132 #endif
00133 }
00134
00135 #else
00136
00137 void drv_paint() {
00138
00139 uns8 count;
00140 uns8 x, y, inv_y;
00141 uns16 buffer_loc;
00142 uns8 byte_loc, bit_loc;
00143 uns8 data;
00144
00145 clear_pin(ht1632_cs1_port, ht1632_cs1_pin);
00146
00147
00148
00149
00150 set_pin (ht1632_data_port, ht1632_data_pin);
00151
00152 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00153 set_pin (ht1632_wr_port, ht1632_wr_pin);
00154
00155
00156 clear_pin (ht1632_data_port, ht1632_data_pin);
00157
00158 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00159 set_pin (ht1632_wr_port, ht1632_wr_pin);
00160
00161
00162 set_pin (ht1632_data_port, ht1632_data_pin);
00163
00164 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00165 set_pin (ht1632_wr_port, ht1632_wr_pin);
00166
00167
00168 clear_pin(ht1632_data_port, ht1632_data_pin);
00169
00170
00171 for(count = 0 ; count < 7 ; count++) {
00172
00173
00174 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00175 set_pin (ht1632_wr_port, ht1632_wr_pin);
00176 }
00177
00178 buffer_loc = 0;
00179 for (count = 0; count < 48; count++) {
00180 data = draw_buffer0[count];
00181 for (bit_loc = 0; bit_loc < 8; bit_loc++) {
00182 if (data.0) {
00183 set_pin(ht1632_data_port, ht1632_data_pin);
00184 } else {
00185 clear_pin(ht1632_data_port, ht1632_data_pin);
00186 }
00187 data = data >> 1;
00188 clear_pin(ht1632_wr_port, ht1632_wr_pin);
00189 set_pin (ht1632_wr_port, ht1632_wr_pin);
00190 }
00191 }
00192
00193
00194
00195 set_pin(ht1632_cs1_port, ht1632_cs1_pin);
00196 }
00197 #endif
00198
00199 uns8 drv_get_pixel(uns8 x, uns8 y) {
00200
00201 }
00202
00203 void drv_clear_screen() {
00204
00205 }
00206
00207 void drv_setup_io() {
00208 ht1632_setup_io();
00209 }
00210
00211 void drv_init() {
00212
00213 ht1632_init(HT1632_CMD_PMOS_16_COMMON);
00214 }
00215
00216 #endif