drv_pcd8544.c File Reference
Draw drivers for PCD8544 based LCD display (Nokia 3310).
More...
Detailed Description
Function Documentation
00045 {
00046
00047 uns8 count;
00048 uns8 x, y, inv_y;
00049 uns16 buffer_loc;
00050 uns16 byte_loc;
00051 uns8 bit_loc, byte_out;
00052
00053 serial_print_str("paint! ");
00054
00055
00056 pcd8544_send_command(0x80);
00057
00058 pcd8544_send_command(0x40);
00059
00060
00061 byte_out = 0;
00062
00063 for(x = 0 ; x < DRAW_PIXELS_WIDE ; x++) {
00064
00065 for(y = 0 ; y < DRAW_PIXELS_HIGH ; y++) {
00066 buffer_loc = y * DRAW_PIXELS_WIDE + x;
00067 byte_loc = buffer_loc / DRAW_PIXELS_PER_BYTE;
00068 bit_loc = buffer_loc & (DRAW_PIXELS_PER_BYTE -1);
00069
00070 byte_out = byte_out >> 1;
00071 if (test_bit(get_draw_buffer(byte_loc), bit_loc)) {
00072 byte_out.7 = 1;
00073 } else {
00074 byte_out.7 = 0;
00075 }
00076 if ((y & 0b00000111) == 0b00000111) {
00077 pcd8544_send_data(byte_out);
00078 }
00079 }
00080 }
00081 }