move to digital
authorMart Lubbers <mart@martlubbers.net>
Mon, 23 Jan 2017 08:36:46 +0000 (09:36 +0100)
committerMart Lubbers <mart@martlubbers.net>
Mon, 23 Jan 2017 08:36:46 +0000 (09:36 +0100)
int/flash [deleted file]
int/interface.c
int/main.c
miTask.icl

diff --git a/int/flash b/int/flash
deleted file mode 100755 (executable)
index d8f717c..0000000
--- a/int/flash
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-openocd \
-       -f interface/stlink-v2-1.cfg\
-       -c "transport select hla_swd"\
-       -f target/stm32f7x.cfg \
-       -c init\
-       -c "reset halt"\
-       -c "flash write_image erase "build/mTask.bin" 0x08000000"\
-       -c "reset run"\
-       -c shutdown
index e94f11c..7fcc148 100644 (file)
@@ -24,37 +24,28 @@ void write_byte(uint8_t b)
        sdPut(&SD3, b);
 }
 
+uint64_t dpins[] = {LINE_ARD_D0, LINE_ARD_D1, LINE_ARD_D2, LINE_ARD_D3,
+       LINE_ARD_D4, LINE_ARD_D5, LINE_ARD_D6, LINE_ARD_D7, LINE_ARD_D8,
+       LINE_ARD_D9, LINE_ARD_D10, LINE_ARD_D11, LINE_ARD_D12, LINE_ARD_D13,
+       LINE_ARD_D14, LINE_ARD_D15};
 void write_dpin(uint8_t i, bool b)
 {
-       (void) i;
-       (void) b;
+       if(i == 0){ palWriteLine(LINE_LED1, b ? PAL_HIGH : PAL_LOW);
+       } else if(i == 1){ palWriteLine(LINE_LED2, b ? PAL_HIGH : PAL_LOW);
+       } else if(i == 2){ palWriteLine(LINE_LED3, b ? PAL_HIGH : PAL_LOW);
+       }
+       palWriteLine(dpins[i], b ? PAL_HIGH : PAL_LOW);
 }
 
 bool read_dpin(uint8_t i)
 {
-       return 0;
-       (void) i;
+       return palReadLine(dpins[i]) == PAL_HIGH;
 }
 
 void write_apin(uint8_t i, uint8_t a)
 {
-       if(a){
-               if(i == 0){
-                       palSetLine(LINE_LED1);
-               } else if(i == 1){
-                       palSetLine(LINE_LED2);
-               } else if(i == 2){
-                       palSetLine(LINE_LED3);
-               }
-       } else {
-               if(i == 0){
-                       palClearLine(LINE_LED1);
-               } else if(i == 1){
-                       palClearLine(LINE_LED2);
-               } else if(i == 2){
-                       palClearLine(LINE_LED3);
-               }
-       }
+       (void) i;
+       (void) a;
 }
 
 uint8_t read_apin(uint8_t i)
index bd0a428..dddd328 100644 (file)
@@ -88,7 +88,6 @@ int main(int argc, char *argv[]){
        gargv = argv;
 #endif
 
-       read_byte();
        //Initialize systems
        setup();
        sds_init();
index d07c760..6aace41 100644 (file)
@@ -68,7 +68,7 @@ mTaskTask ch =
                processSDSs s y [x:xs] = updateSDSs s y x >>= \_->processSDSs s y xs
 
                updateSDSs :: [(Int, Shared Int)] (Shared [String]) MTaskMSGRecv -> Task ()
-               updateSDSs _ m (MTMessage s) = upd (\l->[s:l]) m @! ()
+               updateSDSs _ m (MTMessage s) = upd (\l->take 20 [s:l]) m @! ()
                updateSDSs _ _ MTEmpty = return ()
                updateSDSs [(id, sh):xs] m n=:(MTPub i d)
                | id == i = set ((toInt d.[0])*265 + toInt d.[1]) sh @! ()
@@ -107,19 +107,16 @@ mTaskTask ch =
                bc = sds \x=1 In sds \pinnetje=1 In {main =
                                x =. x +. pinnetje :.
                                pub x :.
+                               digitalWrite D0 (lit False) :.
+                               digitalWrite D1 (lit False) :.
+                               digitalWrite D2 (lit False) :.
                                IF (pinnetje ==. lit 1) (
-                                       analogWrite A0 (lit 1) :.
-                                       analogWrite A1 (lit 0) :.
-                                       analogWrite A2 (lit 0)
+                                       digitalWrite D0 (lit True)
                                ) (
                                        IF (pinnetje ==. lit 2) (
-                                               analogWrite A0 (lit 0) :.
-                                               analogWrite A1 (lit 1) :.
-                                               analogWrite A2 (lit 0)
+                                               digitalWrite D1 (lit True)
                                        ) (
-                                               analogWrite A0 (lit 0):.
-                                               analogWrite A1 (lit 0):.
-                                               analogWrite A2 (lit 1)
+                                               digitalWrite D2 (lit True)
                                        )
                                )}
 //             bc :: Main (ByteCode Int Stmt)