summaryrefslogtreecommitdiffstats
path: root/crypto/gt22l16a1y.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/gt22l16a1y.c')
-rw-r--r--crypto/gt22l16a1y.c30
1 files changed, 23 insertions, 7 deletions
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<<MISO);
}
-void gt_read(uint32_t a,uint8_t * buf,size_t len)
+static void gt_read(uint32_t a,uint8_t * buf,size_t len)
{
uint32_t c;
uint8_t v;
@@ -63,14 +68,11 @@ void gt_read(uint32_t a,uint8_t * buf,size_t len)
NRF_GPIO->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);
+}
+
+