Permalink
Browse files

fixes - works now

  • Loading branch information...
1 parent a6f6070 commit c6a367688c011773620b9b8bbd4b48290ed54851 tz committed Feb 24, 2010
Showing with 74 additions and 45 deletions.
  1. +74 −45 i2cperiph/nh100160.c
View
119 i2cperiph/nh100160.c
@@ -3,63 +3,76 @@
#include "twi2c.h"
#ifndef F_CPU
-#define F_CPU 16000000
+#define F_CPU 8000000
#endif
#include <util/delay.h>
#include <stdio.h>
// len, len bytes of transaction, first even = wrinte, odd=read per i2c
// Start, len bytes, rep start, len bytes, 0 does stop
// 20 char
-#define LCDADDR 0x7e
-
unsigned char lcdi0[] = {
- 14, 0x7E,0x00,
- 0x48,0x64,0xA0,0xC8, 0x44,0x00,0xAB,0x26, 0x81,0x1c,0x56,0x64,
- 0};
+ 14, 0x7E, 0x00,
+ 0x48, 0x64, 0xA0, 0xC8, 0x44, 0x00, 0xAB, 0x26, 0x81, 0x1c, 0x56, 0x64,
+ 0
+};
+
unsigned char lcdi1[] = {
- 4,0x7E,0x00,
- 0x2C,0x66,
- 0};
+ 4, 0x7E, 0x00,
+ 0x2C, 0x66,
+ 0
+};
+
unsigned char lcdi2[] = {
- 3,0x7E,0x00,
+ 3, 0x7E, 0x00,
0x2E,
- 0};
+ 0
+};
+
unsigned char lcdi3[] = {
- 2+7,
- 0x7E,0x00,
- 0x2F,0xF3,0x00,0x96, 0x38,0x75,0x97,
+ 2 + 7,
+ 0x7E, 0x00,
+ 0x2F, 0xF3, 0x00, 0x96, 0x38, 0x75, 0x97,
+ 0
+};
- 2+64,
- 0x7E,0x00,
- 0x80,0x00,0x81,0x00,0x82,0x00,0x83,0x00,0x84,0x06,0x85,0x06,0x86,0x06,0x87,0x06,
- 0x88,0x0B,0x89,0x0B,0x8A,0x0B,0x8B,0x0B,0x8C,0x10,0x8D,0x10,0x8E,0x10,0x8F,0x10,
- 0x90,0x15,0x91,0x15,0x92,0x15,0x93,0x15,0x94,0x1A,0x95,0x1A,0x96,0x1A,0x97,0x1A,
- 0x98,0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xAB, 0x2F, 0xAC, 0x32, 0xAD, 0x32, 0xAE, 0x32, 0xAF, 0x32,
+ 0xB0, 0x35, 0xB1, 0x35, 0xB2, 0x35, 0xB3, 0x35, 0xB4, 0x38, 0xB5, 0x38, 0xB6, 0x38, 0xB7, 0x38,
+ 0xB8, 0x3A, 0xB9, 0x3A, 0xBA, 0x3A, 0xBB, 0x3A, 0xBC, 0x3C, 0xBD, 0x3C, 0xBE, 0x3C, 0xBF, 0x3C,
+ 0
+};
+
+unsigned char lcdi6[] = {
+ 2 + 3,
+ 0x7E, 0x00,
+ 0x38, 0x74, 0xAF,
+ 0
+};
unsigned char sendlcda0[] = {
- 5, LCDADDR,0,0xb0,0x10,1,
- 0,0
+ 7, 0x7e, 0x00, 0xb0, 0x10, 0, 0x00, 0,
+ 0, 0
};
unsigned char sendlcdb0[] = {
- 6, LCDADDR,0,0,0,0,0,
- 0,0
+ 6, 0x7e, 0x40, 0, 0, 0, 0,
+ 0, 0
};
-
-
int main(void)
{
unsigned char text, page;
@@ -73,18 +86,34 @@ int main(void)
TWIdocmd(lcdi2);
_delay_ms(10);
TWIdocmd(lcdi3);
- for (;;)
- for( page = 0xb0; page < 0xbd; page++) {
+ TWIdocmd(lcdi4);
+ TWIdocmd(lcdi5);
+ TWIdocmd(lcdi6);
+ unsigned char flp = 0;
+ for (;;){
+ flp++;
+ for (page = 0xb0; page < 0xbd; page++) {
sendlcda0[3] = page;
TWIdocmd(sendlcda0);
- for( text = 0 ; text < 160; text++ ) {
- sendlcdb0[3] = text;
- sendlcdb0[4] = text;
- sendlcdb0[5] = text;
- sendlcdb0[6] = text;
+ for (text = 0; text < 160; text++) {
+ unsigned char flx[4] = {0xff, 0x55, 0xaa, 0xf0};
+ unsigned char t = flx[flp&3];
+
+ unsigned char g = (text / 8) ^ (page & 15);
+ memset(&sendlcdb0[3], 0, 4);
+ if (g & 8)
+ sendlcdb0[3] = t;
+ if (g & 4)
+ sendlcdb0[4] = t;
+ if (g & 2)
+ sendlcdb0[5] = t;
+ if (g & 1)
+ sendlcdb0[6] = t;
+
TWIdocmd(sendlcdb0);
- _delay_ms(10);
+ //_delay_us(50);
}
}
+ _delay_ms(500);
+ }
}
-

0 comments on commit c6a3676

Please sign in to comment.