From 12cf816b5b5f949b5384fbce3c3cc9718a9cd084 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 8 Sep 2015 00:40:50 +0100 Subject: working displat and cg-rom --- crypto/gt22l16a1y.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'crypto/gt22l16a1y.c') diff --git a/crypto/gt22l16a1y.c b/crypto/gt22l16a1y.c index b997c36..4ee50a1 100644 --- a/crypto/gt22l16a1y.c +++ b/crypto/gt22l16a1y.c @@ -1,7 +1,12 @@ #include "project.h" -#define SCLK 17 -#define MOSI 18 +// P0.20 => ginatop pin 8 MISO +// P0.19 => ginatop pin 7 CS +// P0.18 => ginatop pin 4 SCLK +// P0.17 => ginatop pin 3 MOSI + +#define MOSI 17 +#define SCLK 18 #define NCS 19 #define MISO 20 @@ -55,7 +60,7 @@ gt_init (void) NRF_GPIO->OUTSET = (1 << NCS) | (1<OUTCLR = (1 << SCLK); d(); NRF_GPIO->OUTCLR = (1 << NCS); - NRF_GPIO->OUTSET = (1 << NCS); + //NRF_GPIO->OUTSET = (1 << NCS); d(); a |= READ << 24; - a=0x3000000; - a+=768+80; - for (c=0x80000000;c;c>>=1) { if (c&a) NRF_GPIO->OUTSET = (1 << MOSI); @@ -107,3 +109,17 @@ void gt_read(uint32_t a,uint8_t * buf,size_t len) } +void gt_read_8x8(uint32_t c,uint8_t *d,size_t l) +{ +if (c<0x20) c=0x20; +if (c>0x7e) c=0x20; + +c-=0x20; + +c*=8; +c+=768; + +gt_read(c,d,l); +} + + -- cgit v1.2.3