From 3718cf1a36b80505303e77a7a3bbb5b9fd1b20c2 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Wed, 2 Nov 2016 23:30:24 -0400 Subject: [PATCH 01/34] Initial commit of abstraction class --- .../arduino/impeeduino/impeeduino.ino | 157 ++++++++++++++ .../impeeduino/impeeduino.ino.standard.hex | 159 +++++++++++++++ ...mpeeduino.ino.with_bootloader.standard.hex | 193 ++++++++++++++++++ hardware/impeeduino/impeeduino.class.nut | 179 ++++++++++++++++ .../{ => programmer}/impeeduino.agent.nut | 0 .../{ => programmer}/impeeduino.device.nut | 0 6 files changed, 688 insertions(+) create mode 100644 hardware/impeeduino/arduino/impeeduino/impeeduino.ino create mode 100644 hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex create mode 100644 hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex create mode 100644 hardware/impeeduino/impeeduino.class.nut rename hardware/impeeduino/{ => programmer}/impeeduino.agent.nut (100%) rename hardware/impeeduino/{ => programmer}/impeeduino.device.nut (100%) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino new file mode 100644 index 0000000..cce12e7 --- /dev/null +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -0,0 +1,157 @@ +#define VERSION "0.0.0" + +#define MASK_OP 0xF0 +#define OP_CONFIGURE 0x80 +#define OP_DIGITAL_READ 0x90 +#define OP_DIGITAL_WRITE_0 0xA0 +#define OP_DIGITAL_WRITE_1 0xB0 +#define OP_ANALOG 0xE0 +#define OP_ARB 0xF0 + +#define MASK_CONFIG 0x0F +#define CONFIG_INPUT 0x00 +#define CONFIG_INPUT_PULLUP 0x01 +#define CONFIG_OUTPUT 0x02 + +#define MASK_DIGITAL_ADDR 0x0F +#define MASK_ANALOG_RW 0x08 +#define MASK_ANALOG_ADDR 0x07 +#define MASK_CALL 0x1F + +unsigned int rxByte = 0; +unsigned int rxOp = 0; +char rxbuffer[128]; +int rxbufferindex = 0; + +char* function00(char* buf) { return buf; } +char* function01(char* buf) { return buf; } +char* function02(char* buf) { return buf; } +char* function03(char* buf) { return buf; } +char* function04(char* buf) { return buf; } +char* function05(char* buf) { return buf; } +char* function06(char* buf) { return buf; } +char* function07(char* buf) { return buf; } +char* function08(char* buf) { return buf; } +char* function09(char* buf) { return buf; } +char* function0A(char* buf) { return buf; } +char* function0B(char* buf) { return buf; } +char* function0C(char* buf) { return buf; } +char* function0D(char* buf) { return buf; } +char* function0E(char* buf) { return buf; } +char* function0F(char* buf) { return buf; } + +char* function10(char* buf) { return buf; } +char* function11(char* buf) { return buf; } +char* function12(char* buf) { return buf; } +char* function13(char* buf) { return buf; } +char* function14(char* buf) { return buf; } +char* function15(char* buf) { return buf; } +char* function16(char* buf) { return buf; } +char* function17(char* buf) { return buf; } +char* function18(char* buf) { return buf; } +char* function19(char* buf) { return buf; } +char* function1A(char* buf) { return buf; } +char* function1B(char* buf) { return buf; } +char* function1C(char* buf) { return buf; } +char* function1D(char* buf) { return buf; } +char* function1E(char* buf) { return buf; } +char* function1F(char* buf) { return buf; } + + +void setup() { + // put your setup code here, to run once: + Serial.begin(115200); + Serial.print("Impeeduino Version: "); + Serial.println(VERSION); + Serial.flush(); +} + +void loop() { + if (Serial.available()) { + // get the new byte: + + rxByte = (char)Serial.read(); + if (rxByte & 0x80) { + // Not ASCII text, attempt to decode opcode + rxOp = rxByte & MASK_OP; + if (rxOp == OP_DIGITAL_READ) { + if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); + } else { + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); + } + } else if (rxOp == OP_DIGITAL_WRITE_0) { + digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); + } else if (rxOp == OP_DIGITAL_WRITE_1) { + digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); + } else if (rxOp == OP_ANALOG) { + if (rxByte & MASK_ANALOG_RW) { + analogWrite(rxByte & MASK_ANALOG_ADDR, Serial.read()); + } else { + analogRead(rxByte & MASK_ANALOG_ADDR); + // return 10 bit val, TBD + } + + } else if (rxOp == OP_CONFIGURE) { + switch (Serial.read() & MASK_CONFIG) { + case CONFIG_INPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); + break; + case CONFIG_INPUT_PULLUP: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); + break; + case CONFIG_OUTPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); + break; + } + } else if (rxOp == OP_ARB) { + + } else { + // Call Function Op: 10X + rxbuffer[rxbufferindex] = '\0'; + switch (rxByte & MASK_CALL) { + case 0x00: Serial.write(function00(rxbuffer)); break; + case 0x01: Serial.write(function01(rxbuffer)); break; + case 0x02: Serial.write(function02(rxbuffer)); break; + case 0x03: Serial.write(function03(rxbuffer)); break; + case 0x04: Serial.write(function04(rxbuffer)); break; + case 0x05: Serial.write(function05(rxbuffer)); break; + case 0x06: Serial.write(function06(rxbuffer)); break; + case 0x07: Serial.write(function07(rxbuffer)); break; + case 0x08: Serial.write(function08(rxbuffer)); break; + case 0x09: Serial.write(function09(rxbuffer)); break; + case 0x0A: Serial.write(function0A(rxbuffer)); break; + case 0x0B: Serial.write(function0B(rxbuffer)); break; + case 0x0C: Serial.write(function0C(rxbuffer)); break; + case 0x0D: Serial.write(function0D(rxbuffer)); break; + case 0x0E: Serial.write(function0E(rxbuffer)); break; + case 0x0F: Serial.write(function0F(rxbuffer)); break; + + case 0x10: Serial.write(function10(rxbuffer)); break; + case 0x11: Serial.write(function11(rxbuffer)); break; + case 0x12: Serial.write(function12(rxbuffer)); break; + case 0x13: Serial.write(function13(rxbuffer)); break; + case 0x14: Serial.write(function14(rxbuffer)); break; + case 0x15: Serial.write(function15(rxbuffer)); break; + case 0x16: Serial.write(function16(rxbuffer)); break; + case 0x17: Serial.write(function17(rxbuffer)); break; + case 0x18: Serial.write(function18(rxbuffer)); break; + case 0x19: Serial.write(function19(rxbuffer)); break; + case 0x1A: Serial.write(function1A(rxbuffer)); break; + case 0x1B: Serial.write(function1B(rxbuffer)); break; + case 0x1C: Serial.write(function1C(rxbuffer)); break; + case 0x1D: Serial.write(function1D(rxbuffer)); break; + case 0x1E: Serial.write(function1E(rxbuffer)); break; + case 0x1F: Serial.write(function1F(rxbuffer)); break; + } + Serial.write(rxByte); + Serial.flush(); + rxbufferindex = 0; + } + } else { + // Received ASCII text, insert into rxbuffer + rxbuffer[rxbufferindex] = char(rxByte); + rxbufferindex++; + } + } +} diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex new file mode 100644 index 0000000..b6137d8 --- /dev/null +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -0,0 +1,159 @@ +:100000000C9481000C94A9000C94A9000C94A900F4 +:100010000C94A9000C94A9000C94A9000C94A900BC +:100020000C94A9000C94A9000C94A9000C94A900AC +:100030000C94A9000C94A9000C94A9000C94A9009C +:100040000C944B020C94A9000C94BB020C949502E6 +:100050000C94A9000C94A9000C94A9000C94A9007C +:100060000C94A9000C94A9006D046D046D046D043A +:100070006D046D046D046D046D046D046D046D04F8 +:100080006D046D046D046D046D046D046D046D04E8 +:100090006D046D046D046D046D046D046D046D04D8 +:1000A0006D046D046D0400000000240027002A0088 +:1000B00000000000250028002B00000000002300A5 +:1000C00026002900040404040404040402020202B9 +:1000D000020203030303030301020408102040800B +:1000E000010204081020010204081020000000088A +:1000F00000020100000304070000000000000000EF +:100100009C0411241FBECFEFD8E0DEBFCDBF11E0AD +:10011000A0E0B1E0ECEAF9E002C005900D92AE3249 +:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 +:10013000B207E1F710E0C1E8D0E004C02197FE016A +:100140000E94C904C038D107C9F70E94ED020C947F +:10015000D4040C940000CF92DF92EF92FF920F93A1 +:100160001F93CF93DF936C017A018B01C0E0D0E045 +:10017000CE15DF0589F0D8016D918D01D601ED9185 +:10018000FC910190F081E02DC6010995892B11F4B5 +:100190007E0102C02196ECCFC701DF91CF911F9164 +:1001A0000F91FF90EF90DF90CF900895FC01918D1B +:1001B000828D981761F0828DDF01A80FB11D5D96C9 +:1001C0008C91928D9F5F9F73928F90E008958FEF37 +:1001D0009FEF0895FC01918D828D981731F0828DEB +:1001E000E80FF11D858D90E008958FEF9FEF089542 +:1001F000FC01918D228D892F90E0805C9F4F821BA6 +:1002000091098F73992708958DEB91E00E94F80072 +:1002100021E0892B09F420E0822F0895FC01848DD0 +:10022000DF01A80FB11DA35ABF4F2C91848D90E020 +:1002300001968F739927848FA689B7892C93A089FB +:10024000B1898C9180648C93938D848D981306C0B2 +:100250000288F389E02D80818F7D80830895EF925D +:10026000FF920F931F93CF93DF93EC0181E0888F70 +:100270009B8D8C8D981305C0E889F989808185FD57 +:1002800024C0F62E0B8D10E00F5F1F4F0F73112748 +:10029000E02E8C8DE8120CC00FB607FCFACFE8896F +:1002A000F989808185FFF5CFCE010E940E01F1CF43 +:1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B +:1002C000EA89FB898081806207C0EE89FF896083AB +:1002D000E889F98980818064808381E090E0DF9102 +:1002E000CF911F910F91FF90EF900895CF93DF93DF +:1002F000EC01888D8823C9F0EA89FB89808185FD1E +:1003000005C0A889B9898C9186FD0FC00FB607FC7E +:10031000F5CF808185FFF2CFA889B9898C9185FFBF +:10032000EDCFCE010E940E01E7CFDF91CF9108956E +:1003300080E090E0892B29F00E94040181110C9447 +:1003400000000895833081F028F4813099F08230E4 +:10035000A1F008958730A9F08830B9F08430D1F445 +:10036000809180008F7D03C0809180008F77809383 +:100370008000089584B58F7702C084B58F7D84BDD9 +:1003800008958091B0008F7703C08091B0008F7D79 +:100390008093B00008951F93CF93DF93282F30E010 +:1003A000F901E451FF4F8491F901E852FF4FD491D4 +:1003B000F901EC53FF4FC491CC23C9F0162F8111E2 +:1003C0000E94A201EC2FF0E0EE0FFF1FE055FF4F5F +:1003D000A591B4918FB7F894111105C09C91ED2FA0 +:1003E000E095E92302C0EC91ED2BEC938FBFDF91F8 +:1003F000CF911F910895CF93DF9390E0FC01E852D5 +:10040000FF4F2491FC01EC53FF4F8491882361F14D +:1004100090E0880F991FFC01EA55FF4FC591D491D8 +:10042000FC01E055FF4FA591B491611109C09FB740 +:10043000F8948881209582238883EC912E230BC029 +:10044000623061F49FB7F8943881822F80958323BE +:100450008883EC912E2B2C939FBF06C08FB7F89406 +:10046000E8812E2B28838FBFDF91CF9108950097CD +:1004700069F0FC0101900020E9F73197AF01481BBA +:10048000590BBC018DEB91E00C94AB0080E090E047 +:1004900008950E94CF041F920F920FB60F9211245D +:1004A0002F933F938F939F93AF93BF938091B90105 +:1004B0009091BA01A091BB01B091BC013091B801FB +:1004C00023E0230F2D3720F40196A11DB11D05C097 +:1004D00026E8230F0296A11DB11D2093B801809339 +:1004E000B9019093BA01A093BB01B093BC01809174 +:1004F000B4019091B501A091B601B091B7010196F8 +:10050000A11DB11D8093B4019093B501A093B601D4 +:10051000B093B701BF91AF919F918F913F912F9170 +:100520000F900FBE0F901F9018951F920F920FB64D +:100530000F9211242F933F934F935F936F937F9369 +:100540008F939F93AF93BF93EF93FF938DEB91E0C6 +:100550000E940E01FF91EF91BF91AF919F918F91FA +:100560007F916F915F914F913F912F910F900FBEAF +:100570000F901F9018951F920F920FB60F92112493 +:100580002F938F939F93EF93FF93E091CD01F09181 +:10059000CE018081E091D301F091D40182FD12C09F +:1005A00090818091D6018F5F8F732091D701821740 +:1005B00051F0E091D601F0E0E354FE4F958F809327 +:1005C000D60101C08081FF91EF919F918F912F9172 +:1005D0000F900FBE0F901F901895789484B582608D +:1005E00084BD84B5816084BD85B5826085BD85B5D7 +:1005F000816085BD80916E00816080936E00109255 +:1006000081008091810082608093810080918100CF +:100610008160809381008091800081608093800060 +:100620008091B10084608093B1008091B0008160BE +:100630008093B00080917A00846080937A008091EA +:100640007A00826080937A0080917A008160809342 +:100650007A0080917A00806880937A001092C100BD +:10066000E091CD01F091CE0182E08083E091C9015B +:10067000F091CA011082E091CB01F091CC0180E1B0 +:1006800080831092D501E091D101F091D20186E0F2 +:100690008083E091CF01F091D001808180618083DF +:1006A000E091CF01F091D001808188608083E0915A +:1006B000CF01F091D001808180688083E091CF01EB +:1006C000F091D00180818F7D808380E191E00E9454 +:1006D000370285E291E00E9437028BE291E00E94AE +:1006E00037028DEB91E00E9476018DEB91E00E9444 +:1006F000F800892B09F40FC18DEB91E00E94D60020 +:10070000C82F082E000C990B9093B3018093B2016F +:1007100087FFF4C0807F99279093B1018093B00147 +:100720008039910519F51C2F1F70212F30E0F90138 +:10073000E451FF4F8491F901E852FF4FD491F90140 +:10074000EC53FF4FC491CC2309F4E8C081110E94FF +:10075000A201EC2FF0E0EE0FFF1FE654FF4FA59132 +:10076000B491EC91ED2309F4D9C0DDC0803A910534 +:1007700011F460E004C0803B910531F461E08C2FFE +:100780008F700E94CB01C7C0803E910509F06EC0FA +:10079000DC2FD770C3FF59C08DEB91E00E94D600CB +:1007A0008C0161E08D2F0E94FB010115110509F4F8 +:1007B0004AC00F3F110519F461E08D2FE2CFED2FF4 +:1007C000F0E0E451FF4FE491E330F9F048F4E13018 +:1007D000B9F0E230A1F584B5806284BD08BD9BC04C +:1007E000E730E9F0E83019F1E43049F58091800014 +:1007F00080628093800010938B0000938A008BC0EE +:1008000084B5806884BD07BD86C080918000806803 +:100810008093800010938900009388007CC08091B1 +:10082000B00080688093B0000093B30074C08091E2 +:10083000B00080628093B0000093B4006CC00038B8 +:1008400011050CF0B9CF60E0B8CFD064D0937C0034 +:1008500080917A00806480937A0080917A0086FD8E +:10086000FCCF809178008091790055C08038910547 +:10087000C9F48DEB91E00E94D6008F7099278130EA +:10088000910541F08230910539F0892B09F043C080 +:1008900060E003C062E001C061E08C2F8F700E94B5 +:1008A000FB0139C0803F9105B1F1E091AE01F091BB +:1008B000AF01E25DFE4F1082EC2FEF710E2E000CA7 +:1008C000FF0B3197EF31F10530F4EC5CFF4F8EE216 +:1008D00091E00C94C9048EE291E00E94370260918D +:1008E000B2018DEB91E00E942F018DEB91E00E940F +:1008F00076011092AF011092AE010DC08091AE0151 +:100900009091AF01FC01E25DFE4FC0830196909390 +:10091000AF018093AE010E949801E7CE612F110FC5 +:10092000770B606A04C0612F110F770B606B8DEB42 +:1009300091E00E942F01EFCFEDEBF1E013821282E4 +:1009400088EE93E0A0E0B0E084839583A683B7832C +:1009500084E091E09183808385EC90E095878487A3 +:1009600084EC90E09787868780EC90E0918B808B79 +:1009700081EC90E0938B828B82EC90E0958B848B62 +:1009800086EC90E0978B868B118E128E138E148ED0 +:100990000895EE0FFF1F0590F491E02D099481E07A +:0C09A00090E0F8940C94D404F894FFCF7D +:1009AC00000000002F01AB00F800D600EA00760131 +:1009BC00496D7065656475696E6F205665727369F3 +:0E09CC006F6E3A2000302E302E30000D0A00E3 +:00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex new file mode 100644 index 0000000..644bd4d --- /dev/null +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -0,0 +1,193 @@ +:100000000C9481000C94A9000C94A9000C94A900F4 +:100010000C94A9000C94A9000C94A9000C94A900BC +:100020000C94A9000C94A9000C94A9000C94A900AC +:100030000C94A9000C94A9000C94A9000C94A9009C +:100040000C944B020C94A9000C94BB020C949502E6 +:100050000C94A9000C94A9000C94A9000C94A9007C +:100060000C94A9000C94A9006D046D046D046D043A +:100070006D046D046D046D046D046D046D046D04F8 +:100080006D046D046D046D046D046D046D046D04E8 +:100090006D046D046D046D046D046D046D046D04D8 +:1000A0006D046D046D0400000000240027002A0088 +:1000B00000000000250028002B00000000002300A5 +:1000C00026002900040404040404040402020202B9 +:1000D000020203030303030301020408102040800B +:1000E000010204081020010204081020000000088A +:1000F00000020100000304070000000000000000EF +:100100009C0411241FBECFEFD8E0DEBFCDBF11E0AD +:10011000A0E0B1E0ECEAF9E002C005900D92AE3249 +:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 +:10013000B207E1F710E0C1E8D0E004C02197FE016A +:100140000E94C904C038D107C9F70E94ED020C947F +:10015000D4040C940000CF92DF92EF92FF920F93A1 +:100160001F93CF93DF936C017A018B01C0E0D0E045 +:10017000CE15DF0589F0D8016D918D01D601ED9185 +:10018000FC910190F081E02DC6010995892B11F4B5 +:100190007E0102C02196ECCFC701DF91CF911F9164 +:1001A0000F91FF90EF90DF90CF900895FC01918D1B +:1001B000828D981761F0828DDF01A80FB11D5D96C9 +:1001C0008C91928D9F5F9F73928F90E008958FEF37 +:1001D0009FEF0895FC01918D828D981731F0828DEB +:1001E000E80FF11D858D90E008958FEF9FEF089542 +:1001F000FC01918D228D892F90E0805C9F4F821BA6 +:1002000091098F73992708958DEB91E00E94F80072 +:1002100021E0892B09F420E0822F0895FC01848DD0 +:10022000DF01A80FB11DA35ABF4F2C91848D90E020 +:1002300001968F739927848FA689B7892C93A089FB +:10024000B1898C9180648C93938D848D981306C0B2 +:100250000288F389E02D80818F7D80830895EF925D +:10026000FF920F931F93CF93DF93EC0181E0888F70 +:100270009B8D8C8D981305C0E889F989808185FD57 +:1002800024C0F62E0B8D10E00F5F1F4F0F73112748 +:10029000E02E8C8DE8120CC00FB607FCFACFE8896F +:1002A000F989808185FFF5CFCE010E940E01F1CF43 +:1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B +:1002C000EA89FB898081806207C0EE89FF896083AB +:1002D000E889F98980818064808381E090E0DF9102 +:1002E000CF911F910F91FF90EF900895CF93DF93DF +:1002F000EC01888D8823C9F0EA89FB89808185FD1E +:1003000005C0A889B9898C9186FD0FC00FB607FC7E +:10031000F5CF808185FFF2CFA889B9898C9185FFBF +:10032000EDCFCE010E940E01E7CFDF91CF9108956E +:1003300080E090E0892B29F00E94040181110C9447 +:1003400000000895833081F028F4813099F08230E4 +:10035000A1F008958730A9F08830B9F08430D1F445 +:10036000809180008F7D03C0809180008F77809383 +:100370008000089584B58F7702C084B58F7D84BDD9 +:1003800008958091B0008F7703C08091B0008F7D79 +:100390008093B00008951F93CF93DF93282F30E010 +:1003A000F901E451FF4F8491F901E852FF4FD491D4 +:1003B000F901EC53FF4FC491CC23C9F0162F8111E2 +:1003C0000E94A201EC2FF0E0EE0FFF1FE055FF4F5F +:1003D000A591B4918FB7F894111105C09C91ED2FA0 +:1003E000E095E92302C0EC91ED2BEC938FBFDF91F8 +:1003F000CF911F910895CF93DF9390E0FC01E852D5 +:10040000FF4F2491FC01EC53FF4F8491882361F14D +:1004100090E0880F991FFC01EA55FF4FC591D491D8 +:10042000FC01E055FF4FA591B491611109C09FB740 +:10043000F8948881209582238883EC912E230BC029 +:10044000623061F49FB7F8943881822F80958323BE +:100450008883EC912E2B2C939FBF06C08FB7F89406 +:10046000E8812E2B28838FBFDF91CF9108950097CD +:1004700069F0FC0101900020E9F73197AF01481BBA +:10048000590BBC018DEB91E00C94AB0080E090E047 +:1004900008950E94CF041F920F920FB60F9211245D +:1004A0002F933F938F939F93AF93BF938091B90105 +:1004B0009091BA01A091BB01B091BC013091B801FB +:1004C00023E0230F2D3720F40196A11DB11D05C097 +:1004D00026E8230F0296A11DB11D2093B801809339 +:1004E000B9019093BA01A093BB01B093BC01809174 +:1004F000B4019091B501A091B601B091B7010196F8 +:10050000A11DB11D8093B4019093B501A093B601D4 +:10051000B093B701BF91AF919F918F913F912F9170 +:100520000F900FBE0F901F9018951F920F920FB64D +:100530000F9211242F933F934F935F936F937F9369 +:100540008F939F93AF93BF93EF93FF938DEB91E0C6 +:100550000E940E01FF91EF91BF91AF919F918F91FA +:100560007F916F915F914F913F912F910F900FBEAF +:100570000F901F9018951F920F920FB60F92112493 +:100580002F938F939F93EF93FF93E091CD01F09181 +:10059000CE018081E091D301F091D40182FD12C09F +:1005A00090818091D6018F5F8F732091D701821740 +:1005B00051F0E091D601F0E0E354FE4F958F809327 +:1005C000D60101C08081FF91EF919F918F912F9172 +:1005D0000F900FBE0F901F901895789484B582608D +:1005E00084BD84B5816084BD85B5826085BD85B5D7 +:1005F000816085BD80916E00816080936E00109255 +:1006000081008091810082608093810080918100CF +:100610008160809381008091800081608093800060 +:100620008091B10084608093B1008091B0008160BE +:100630008093B00080917A00846080937A008091EA +:100640007A00826080937A0080917A008160809342 +:100650007A0080917A00806880937A001092C100BD +:10066000E091CD01F091CE0182E08083E091C9015B +:10067000F091CA011082E091CB01F091CC0180E1B0 +:1006800080831092D501E091D101F091D20186E0F2 +:100690008083E091CF01F091D001808180618083DF +:1006A000E091CF01F091D001808188608083E0915A +:1006B000CF01F091D001808180688083E091CF01EB +:1006C000F091D00180818F7D808380E191E00E9454 +:1006D000370285E291E00E9437028BE291E00E94AE +:1006E00037028DEB91E00E9476018DEB91E00E9444 +:1006F000F800892B09F40FC18DEB91E00E94D60020 +:10070000C82F082E000C990B9093B3018093B2016F +:1007100087FFF4C0807F99279093B1018093B00147 +:100720008039910519F51C2F1F70212F30E0F90138 +:10073000E451FF4F8491F901E852FF4FD491F90140 +:10074000EC53FF4FC491CC2309F4E8C081110E94FF +:10075000A201EC2FF0E0EE0FFF1FE654FF4FA59132 +:10076000B491EC91ED2309F4D9C0DDC0803A910534 +:1007700011F460E004C0803B910531F461E08C2FFE +:100780008F700E94CB01C7C0803E910509F06EC0FA +:10079000DC2FD770C3FF59C08DEB91E00E94D600CB +:1007A0008C0161E08D2F0E94FB010115110509F4F8 +:1007B0004AC00F3F110519F461E08D2FE2CFED2FF4 +:1007C000F0E0E451FF4FE491E330F9F048F4E13018 +:1007D000B9F0E230A1F584B5806284BD08BD9BC04C +:1007E000E730E9F0E83019F1E43049F58091800014 +:1007F00080628093800010938B0000938A008BC0EE +:1008000084B5806884BD07BD86C080918000806803 +:100810008093800010938900009388007CC08091B1 +:10082000B00080688093B0000093B30074C08091E2 +:10083000B00080628093B0000093B4006CC00038B8 +:1008400011050CF0B9CF60E0B8CFD064D0937C0034 +:1008500080917A00806480937A0080917A0086FD8E +:10086000FCCF809178008091790055C08038910547 +:10087000C9F48DEB91E00E94D6008F7099278130EA +:10088000910541F08230910539F0892B09F043C080 +:1008900060E003C062E001C061E08C2F8F700E94B5 +:1008A000FB0139C0803F9105B1F1E091AE01F091BB +:1008B000AF01E25DFE4F1082EC2FEF710E2E000CA7 +:1008C000FF0B3197EF31F10530F4EC5CFF4F8EE216 +:1008D00091E00C94C9048EE291E00E94370260918D +:1008E000B2018DEB91E00E942F018DEB91E00E940F +:1008F00076011092AF011092AE010DC08091AE0151 +:100900009091AF01FC01E25DFE4FC0830196909390 +:10091000AF018093AE010E949801E7CE612F110FC5 +:10092000770B606A04C0612F110F770B606B8DEB42 +:1009300091E00E942F01EFCFEDEBF1E013821282E4 +:1009400088EE93E0A0E0B0E084839583A683B7832C +:1009500084E091E09183808385EC90E095878487A3 +:1009600084EC90E09787868780EC90E0918B808B79 +:1009700081EC90E0938B828B82EC90E0958B848B62 +:1009800086EC90E0978B868B118E128E138E148ED0 +:100990000895EE0FFF1F0590F491E02D099481E07A +:0C09A00090E0F8940C94D404F894FFCF7D +:1009AC00000000002F01AB00F800D600EA00760131 +:1009BC00496D7065656475696E6F205665727369F3 +:0E09CC006F6E3A2000302E302E30000D0A00E3 +:107E0000112484B714BE81FFF0D085E080938100F7 +:107E100082E08093C00088E18093C10086E0809377 +:107E2000C20080E18093C4008EE0C9D0259A86E02C +:107E300020E33CEF91E0309385002093840096BBD3 +:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4 +:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7 +:107E6000A2D0813461F49FD0082FAFD0023811F036 +:107E7000013811F484E001C083E08DD089C08234E0 +:107E800011F484E103C0853419F485E0A6D080C0E4 +:107E9000853579F488D0E82EFF2485D0082F10E0AE +:107EA000102F00270E291F29000F111F8ED06801E7 +:107EB0006FC0863521F484E090D080E0DECF843638 +:107EC00009F040C070D06FD0082F6DD080E0C81688 +:107ED00080E7D80618F4F601B7BEE895C0E0D1E017 +:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8 +:107EF00018F0F601B7BEE89568D007B600FCFDCFD4 +:107F0000A601A0E0B1E02C9130E011968C91119780 +:107F100090E0982F8827822B932B1296FA010C0160 +:107F200087BEE89511244E5F5F4FF1E0A038BF0790 +:107F300051F7F601A7BEE89507B600FCFDCF97BE46 +:107F4000E89526C08437B1F42ED02DD0F82E2BD052 +:107F50003CD0F601EF2C8F010F5F1F4F84911BD097 +:107F6000EA94F801C1F70894C11CD11CFA94CF0C13 +:107F7000D11C0EC0853739F428D08EE10CD085E9AC +:107F80000AD08FE07ACF813511F488E018D01DD067 +:107F900080E101D065CF982F8091C00085FFFCCF94 +:107FA0009093C60008958091C00087FFFCCF809118 +:107FB000C00084FD01C0A8958091C6000895E0E648 +:107FC000F0E098E1908380830895EDDF803219F02E +:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA +:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6 +:047FF000FF270994CA +:027FFE00040479 +:0400000300007E007B +:00000001FF diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut new file mode 100644 index 0000000..1e194d2 --- /dev/null +++ b/hardware/impeeduino/impeeduino.class.nut @@ -0,0 +1,179 @@ +class Impeeduino { + + static version = [0, 0, 0] + + static BAUD_RATE = 115200; + static DIGITAL_READ_TIME = 0.01; + + static MASK_OP = 0xF0; + static OP_CONFIGURE = 0x80; + static OP_DIGITAL_READ = 0x90; + static OP_DIGITAL_WRITE_0 = 0xA0; + static OP_DIGITAL_WRITE_1 = 0xB0; + static OP_ANALOG = 0xE0; + static OP_ARB = 0xF0; + + static MASK_CONFIG = 0x0F; + static CONFIG_INPUT = 0x00; + static CONFIG_INPUT_PULLUP = 0x01; + static CONFIG_OUTPUT = 0x02; + static CONFIG_OUTPUT_PWM = 0x03; + + static MASK_DIGITAL_ADDR = 0x0F; + static MASK_DIGITAL_WRITE = 0x10; + static MASK_ANALOG_W = 0x08; + static MASK_ANALOG_ADDR = 0x07; + static MASK_CALL = 0x1F; + + _rxBuf = null; // Buffer for incoming data + _funcBuf = null; // Buffer for function return values + _serial = null; // UART bus to communicate with AVR + _reset = null; // AVR reset pin + _pinsPWM = null; // PWM enabled pins + + constructor(serial = hardware.uart57, reset = hardware.pin1) { + _serial = serial; + _serial.configure(BAUD_RATE, 8, PARITY_NONE, 1, NO_CTSRTS, uartEvent.bindenv(this)); + + _reset = reset; + _reset.configure(DIGITAL_OUT); + + // Define PWM enabled pins + _pinsPWM = {}; + _pinsPWM[3] <- 0; + _pinsPWM[5] <- 1; + _pinsPWM[6] <- 2; + _pinsPWM[9] <- 3; + _pinsPWM[10] <- 4; + _pinsPWM[11] <- 5; + + _funcBuf = blob(); + _rxBuf = blob(); + + this.reset(); + } + + function parseRXBuffer() { + local buf = _rxBuf; + _rxBuf = blob(); + buf.seek(0, 'b'); + local readByte = 0; + while (!buf.eos()) { + readByte = buf.readn('b'); + if (readByte & 0x80) { + // Interpret as Opcode + } else { + // Save ASCII data to function return buffer + _funcBuf.seek(0, 'e'); + _funcBuf.writen(readByte, 'b'); + } + } + } + + function uartEvent() { + _rxBuf.seek(0, 'e'); + _rxBuf.writeblob(_serial.readblob()); + parseRXBuffer(); + if (_funcBuf[0] == 0) + _funcBuf[0] = 0x20 + server.log(format("%s", _funcBuf.tostring())); + } + + function reset() { + server.log("Resetting Duino...") + _reset.write(1); + imp.sleep(0.2); + _reset.write(0); + } + + // Configures the specified GPIO pin to behave either as an input or an output. + function pinMode(pin, mode) { + _serial.write(OP_CONFIGURE | pin); + server.log("Configuring " + pin); + switch (mode) { + case DIGITAL_IN: + _serial.write(OP_ARB | CONFIG_INPUT); + break; + case DIGITAL_IN_PULLUP: + _serial.write(OP_ARB | CONFIG_INPUT_PULLUP); + break; + case DIGITAL_OUT: + server.log("to Output"); + _serial.write(OP_ARB | CONFIG_OUTPUT); + break; + case PWM_OUT: + assert (pin in _pinsPWM); + _serial.write(OP_ARB | CONFIG_OUTPUT_PWM); + break; + default: + server.error("Invalid pin mode: " + mode); + _serial.write(OP_ARB | CONFIG_INPUT); + break; + } + } + + // Writes a value to a digital pin + function digitalWrite(pin, value) { + assert (typeof value == "integer" || typeof value == "bool"); + server.log("Writing " + value + " to " + pin); + if (value) { + _serial.write(OP_DIGITAL_WRITE_1 | pin); + } else { + _serial.write(OP_DIGITAL_WRITE_0 | pin); + } + _serial.flush(); + } + + // Reads the value from a specified digital pin + function digitalRead(pin, cb = null) { + _serial.write(OP_DIGITAL_READ | pin); + _serial.flush(); + + if (cb) { + imp.wakeup(DIGITAL_READ_TIME, function() { + cb({ "value": _pinState[pin]}); + }.bindenv(this)); + } else { + local target = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin + local readByte = _serial.read(); + while (readByte & target != target) { + // Save other data to buffer + _rxBuf.seek(0, 'e'); + _rxBuf.writen(readByte, 'b'); + readByte = _serial.read(); + } + imp.wakeup(0, parseRXBuffer); + return readByte & MASK_DIGITAL_WRITE ? 1 : 0; + } + } + + // Reads the value from the specified analog pin. The Arduino board contains a 6 channel , 10-bit analog to digital converter. + function analogRead(pin) { + _serial.write(OP_ANALOG | _pinsPWM[pin]); + _serial.flush(); + + } + + // Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). + function analogWrite(pin, value) { + assert (typeof value == "integer"); + assert (value <= 255); + assert (value >= 0); + assert (pin in _pinsPWM); + + _serial.write(OP_ANALOG | MASK_ANALOG_W | _pinsPWM[pin]); + _serial.flush(); + } +} + +impeeduino <- Impeeduino(); +impeeduino.pinMode(7, DIGITAL_OUT); + +isOn <- false; + +function loop() { + impeeduino.digitalWrite(7, isOn); + isOn = !isOn; + imp.wakeup(1, loop); +} +loop(); \ No newline at end of file diff --git a/hardware/impeeduino/impeeduino.agent.nut b/hardware/impeeduino/programmer/impeeduino.agent.nut similarity index 100% rename from hardware/impeeduino/impeeduino.agent.nut rename to hardware/impeeduino/programmer/impeeduino.agent.nut diff --git a/hardware/impeeduino/impeeduino.device.nut b/hardware/impeeduino/programmer/impeeduino.device.nut similarity index 100% rename from hardware/impeeduino/impeeduino.device.nut rename to hardware/impeeduino/programmer/impeeduino.device.nut From 94481c7a738c05695e888d85c339de5db8fee0b4 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Thu, 3 Nov 2016 12:35:38 -0400 Subject: [PATCH 02/34] First draft of digitalRead, correct sequencing but incorrect values --- .../arduino/impeeduino/impeeduino.ino | 4 + .../impeeduino/impeeduino.ino.standard.hex | 203 +++++++++--------- ...mpeeduino.ino.with_bootloader.standard.hex | 203 +++++++++--------- hardware/impeeduino/impeeduino.class.nut | 28 ++- 4 files changed, 232 insertions(+), 206 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index cce12e7..07c6ec2 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -76,13 +76,17 @@ void loop() { rxOp = rxByte & MASK_OP; if (rxOp == OP_DIGITAL_READ) { if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { + Serial.println("Digital HIGH"); Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); } else { + Serial.println("Digital LOW"); Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); } } else if (rxOp == OP_DIGITAL_WRITE_0) { + Serial.println("Writing LOW"); digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); } else if (rxOp == OP_DIGITAL_WRITE_1) { + Serial.println("Writing HIGH"); digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); } else if (rxOp == OP_ANALOG) { if (rxByte & MASK_ANALOG_RW) { diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex index b6137d8..6c992d3 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C944B020C94A9000C94BB020C949502E6 +:100040000C9459020C94A9000C94C9020C94A302BC :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9006D046D046D046D043A -:100070006D046D046D046D046D046D046D046D04F8 -:100080006D046D046D046D046D046D046D046D04E8 -:100090006D046D046D046D046D046D046D046D04D8 -:1000A0006D046D046D0400000000240027002A0088 +:100060000C94A9000C94A9008104810481048104EA +:100070008104810481048104810481048104810458 +:100080008104810481048104810481048104810448 +:100090008104810481048104810481048104810438 +:1000A00081048104810400000000240027002A004C :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:100100009C0411241FBECFEFD8E0DEBFCDBF11E0AD -:10011000A0E0B1E0ECEAF9E002C005900D92AE3249 -:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 +:10010000BE0411241FBECFEFD8E0DEBFCDBF11E08B +:10011000A0E0B1E0E0EFF9E002C005900D92A0365A +:10012000B107D9F722E0A0E6B1E001C01D92AC38DA :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E94C904C038D107C9F70E94ED020C947F -:10015000D4040C940000CF92DF92EF92FF920F93A1 +:100140000E94EB04C038D107C9F70E94FB020C944F +:10015000F6040C940000CF92DF92EF92FF920F937F :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958DEB91E00E94F80072 +:1002000091098F73992708958FEE91E00E94F8006D :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -70,90 +70,97 @@ :100450008883EC912E2B2C939FBF06C08FB7F89406 :10046000E8812E2B28838FBFDF91CF9108950097CD :1004700069F0FC0101900020E9F73197AF01481BBA -:10048000590BBC018DEB91E00C94AB0080E090E047 -:1004900008950E94CF041F920F920FB60F9211245D -:1004A0002F933F938F939F93AF93BF938091B90105 -:1004B0009091BA01A091BB01B091BC013091B801FB -:1004C00023E0230F2D3720F40196A11DB11D05C097 -:1004D00026E8230F0296A11DB11D2093B801809339 -:1004E000B9019093BA01A093BB01B093BC01809174 -:1004F000B4019091B501A091B601B091B7010196F8 -:10050000A11DB11D8093B4019093B501A093B601D4 -:10051000B093B701BF91AF919F918F913F912F9170 -:100520000F900FBE0F901F9018951F920F920FB64D -:100530000F9211242F933F934F935F936F937F9369 -:100540008F939F93AF93BF93EF93FF938DEB91E0C6 -:100550000E940E01FF91EF91BF91AF919F918F91FA -:100560007F916F915F914F913F912F910F900FBEAF -:100570000F901F9018951F920F920FB60F92112493 -:100580002F938F939F93EF93FF93E091CD01F09181 -:10059000CE018081E091D301F091D40182FD12C09F -:1005A00090818091D6018F5F8F732091D701821740 -:1005B00051F0E091D601F0E0E354FE4F958F809327 -:1005C000D60101C08081FF91EF919F918F912F9172 -:1005D0000F900FBE0F901F901895789484B582608D -:1005E00084BD84B5816084BD85B5826085BD85B5D7 -:1005F000816085BD80916E00816080936E00109255 -:1006000081008091810082608093810080918100CF -:100610008160809381008091800081608093800060 -:100620008091B10084608093B1008091B0008160BE -:100630008093B00080917A00846080937A008091EA -:100640007A00826080937A0080917A008160809342 -:100650007A0080917A00806880937A001092C100BD -:10066000E091CD01F091CE0182E08083E091C9015B -:10067000F091CA011082E091CB01F091CC0180E1B0 -:1006800080831092D501E091D101F091D20186E0F2 -:100690008083E091CF01F091D001808180618083DF -:1006A000E091CF01F091D001808188608083E0915A -:1006B000CF01F091D001808180688083E091CF01EB -:1006C000F091D00180818F7D808380E191E00E9454 -:1006D000370285E291E00E9437028BE291E00E94AE -:1006E00037028DEB91E00E9476018DEB91E00E9444 -:1006F000F800892B09F40FC18DEB91E00E94D60020 -:10070000C82F082E000C990B9093B3018093B2016F -:1007100087FFF4C0807F99279093B1018093B00147 -:100720008039910519F51C2F1F70212F30E0F90138 -:10073000E451FF4F8491F901E852FF4FD491F90140 -:10074000EC53FF4FC491CC2309F4E8C081110E94FF -:10075000A201EC2FF0E0EE0FFF1FE654FF4FA59132 -:10076000B491EC91ED2309F4D9C0DDC0803A910534 -:1007700011F460E004C0803B910531F461E08C2FFE -:100780008F700E94CB01C7C0803E910509F06EC0FA -:10079000DC2FD770C3FF59C08DEB91E00E94D600CB -:1007A0008C0161E08D2F0E94FB010115110509F4F8 -:1007B0004AC00F3F110519F461E08D2FE2CFED2FF4 -:1007C000F0E0E451FF4FE491E330F9F048F4E13018 -:1007D000B9F0E230A1F584B5806284BD08BD9BC04C -:1007E000E730E9F0E83019F1E43049F58091800014 -:1007F00080628093800010938B0000938A008BC0EE -:1008000084B5806884BD07BD86C080918000806803 -:100810008093800010938900009388007CC08091B1 -:10082000B00080688093B0000093B30074C08091E2 -:10083000B00080628093B0000093B4006CC00038B8 -:1008400011050CF0B9CF60E0B8CFD064D0937C0034 -:1008500080917A00806480937A0080917A0086FD8E -:10086000FCCF809178008091790055C08038910547 -:10087000C9F48DEB91E00E94D6008F7099278130EA -:10088000910541F08230910539F0892B09F043C080 -:1008900060E003C062E001C061E08C2F8F700E94B5 -:1008A000FB0139C0803F9105B1F1E091AE01F091BB -:1008B000AF01E25DFE4F1082EC2FEF710E2E000CA7 -:1008C000FF0B3197EF31F10530F4EC5CFF4F8EE216 -:1008D00091E00C94C9048EE291E00E94370260918D -:1008E000B2018DEB91E00E942F018DEB91E00E940F -:1008F00076011092AF011092AE010DC08091AE0151 -:100900009091AF01FC01E25DFE4FC0830196909390 -:10091000AF018093AE010E949801E7CE612F110FC5 -:10092000770B606A04C0612F110F770B606B8DEB42 -:1009300091E00E942F01EFCFEDEBF1E013821282E4 -:1009400088EE93E0A0E0B0E084839583A683B7832C -:1009500084E091E09183808385EC90E095878487A3 -:1009600084EC90E09787868780EC90E0918B808B79 -:1009700081EC90E0938B828B82EC90E0958B848B62 -:1009800086EC90E0978B868B118E128E138E148ED0 -:100990000895EE0FFF1F0590F491E02D099481E07A -:0C09A00090E0F8940C94D404F894FFCF7D -:1009AC00000000002F01AB00F800D600EA00760131 -:1009BC00496D7065656475696E6F205665727369F3 -:0E09CC006F6E3A2000302E302E30000D0A00E3 +:10048000590BBC018FEE91E00C94AB0080E090E042 +:100490000895CF93DF930E943702EC0180E191E051 +:1004A0000E9437028C0F9D1FDF91CF9108950E940B +:1004B000F1041F920F920FB60F9211242F933F93C6 +:1004C0008F939F93AF93BF938091EB019091EC0139 +:1004D000A091ED01B091EE013091EA0123E0230FEC +:1004E0002D3720F40196A11DB11D05C026E8230F6C +:1004F0000296A11DB11D2093EA018093EB01909318 +:10050000EC01A093ED01B093EE018091E601909192 +:10051000E701A091E801B091E9010196A11DB11D8B +:100520008093E6019093E701A093E801B093E9017D +:10053000BF91AF919F918F913F912F910F900FBEDF +:100540000F901F9018951F920F920FB60F921124C3 +:100550002F933F934F935F936F937F938F939F93CB +:10056000AF93BF93EF93FF938FEE91E00E940E0144 +:10057000FF91EF91BF91AF919F918F917F916F917B +:100580005F914F913F912F910F900FBE0F901F9051 +:1005900018951F920F920FB60F9211242F938F93DD +:1005A0009F93EF93FF93E091FF01F0910002808110 +:1005B000E0910502F091060282FD12C090818091C7 +:1005C00008028F5F8F7320910902821751F0E0912A +:1005D0000802F0E0E151FE4F958F8093080201C0C0 +:1005E0008081FF91EF919F918F912F910F900FBE7E +:1005F0000F901F901895789484B5826084BD84B55F +:10060000816084BD85B5826085BD85B5816085BD0D +:1006100080916E00816080936E00109281008091C5 +:10062000810082608093810080918100816080934D +:100630008100809180008160809380008091B10072 +:1006400084608093B1008091B00081608093B0009D +:1006500080917A00846080937A0080917A00826031 +:1006600080937A0080917A00816080937A008091F3 +:100670007A00806880937A001092C100E091FF01B7 +:10068000F091000282E08083E091FB01F091FC0197 +:100690001082E091FD01F091FE0180E180831092D3 +:1006A0000702E0910302F091040286E08083E0916A +:1006B0000102F0910202808180618083E091010259 +:1006C000F0910202808188608083E0910102F091C4 +:1006D0000202808180688083E0910102F091020231 +:1006E00080818F7D808383E191E00E94370288E2E0 +:1006F00091E00E9449028FEE91E00E9476018FEE18 +:1007000091E00E94F800892B09F419C18FEE91E065 +:100710000E94D600C82F082E000C990B9093E5017B +:100720008093E40187FFFEC0807F99279093E301C7 +:100730008093E2018039910511F5CF702C2F30E0C4 +:10074000F901E451FF4F8491F901E852FF4FD49130 +:10075000F901EC53FF4FC491CC2309F4F3C081118C +:100760000E94A201EC2FF0E0EE0FFF1FE654FF4FB6 +:10077000A591B491EC91ED2309F4E4C0EFC0803A67 +:10078000910541F48EE291E00E9449028091E401DA +:1007900060E00AC0803B910559F48AE391E00E9431 +:1007A00049028091E40161E08F700E94CB01C7C0D3 +:1007B000803E910509F06EC0DC2FD770C3FF59C091 +:1007C0008FEE91E00E94D6008C0161E08D2F0E9497 +:1007D000FB010115110509F44AC00F3F110519F479 +:1007E00061E08D2FE2CFED2FF0E0E451FF4FE49177 +:1007F000E330F9F048F4E130B9F0E230A1F584B526 +:10080000806284BD08BD9BC0E730E9F0E83019F193 +:10081000E43049F5809180008062809380001093DD +:100820008B0000938A008BC084B5806884BD07BDAF +:1008300086C080918000806880938000109389003A +:10084000009388007CC08091B00080688093B000E5 +:100850000093B30074C08091B00080628093B000B8 +:100860000093B4006CC0003811050CF0B9CF60E003 +:10087000B8CFD064D0937C0080917A00806480935C +:100880007A0080917A0086FDFCCF8091780080917B +:10089000790055C080389105C9F48FEE91E00E942F +:1008A000D6008F7099278130910541F082309105F3 +:1008B00039F0892B09F043C060E003C062E001C059 +:1008C00061E08C2F8F700E94FB0139C0803F910541 +:1008D000B1F1E091E001F091E101E05AFE4F1082A8 +:1008E000EC2FEF710E2E000CFF0B3197EF31F1055D +:1008F00030F4EC5CFF4F80E691E00C94EB0480E672 +:1009000091E00E9437026091E4018FEE91E00E9435 +:100910002F018FEE91E00E9476011092E10110927A +:10092000E0010DC08091E0019091E101FC01E05AED +:10093000FE4FC08301969093E1018093E0010E94F5 +:100940009801DDCE87E491E00E9449026091E401C4 +:100950007091E5016F707727606A0BC083E591E0C5 +:100960000E9449026091E4017091E5016F70772760 +:10097000606B8FEE91E00E942F01E1CFEFEEF1E08E +:100980001382128288EE93E0A0E0B0E08483958326 +:10099000A683B78384E091E09183808385EC90E027 +:1009A0009587848784EC90E09787868780EC90E039 +:1009B000918B808B81EC90E0938B828B82EC90E02A +:1009C000958B848B86EC90E0978B868B118E128EA4 +:1009D000138E148E0895EE0FFF1F0590F491E02DF5 +:1009E000099481E090E0F8940C94F604F894FFCF19 +:1009F000000000002F01AB00F800D600EA007601ED +:100A00000D0A00496D7065656475696E6F205665E5 +:100A10007273696F6E3A2000302E302E300057729C +:100A20006974696E67204C4F570057726974696E1C +:100A3000672048494748004469676974616C204CE5 +:100A40004F57004469676974616C20484947480002 :00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex index 644bd4d..480e2c8 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C944B020C94A9000C94BB020C949502E6 +:100040000C9459020C94A9000C94C9020C94A302BC :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9006D046D046D046D043A -:100070006D046D046D046D046D046D046D046D04F8 -:100080006D046D046D046D046D046D046D046D04E8 -:100090006D046D046D046D046D046D046D046D04D8 -:1000A0006D046D046D0400000000240027002A0088 +:100060000C94A9000C94A9008104810481048104EA +:100070008104810481048104810481048104810458 +:100080008104810481048104810481048104810448 +:100090008104810481048104810481048104810438 +:1000A00081048104810400000000240027002A004C :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:100100009C0411241FBECFEFD8E0DEBFCDBF11E0AD -:10011000A0E0B1E0ECEAF9E002C005900D92AE3249 -:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 +:10010000BE0411241FBECFEFD8E0DEBFCDBF11E08B +:10011000A0E0B1E0E0EFF9E002C005900D92A0365A +:10012000B107D9F722E0A0E6B1E001C01D92AC38DA :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E94C904C038D107C9F70E94ED020C947F -:10015000D4040C940000CF92DF92EF92FF920F93A1 +:100140000E94EB04C038D107C9F70E94FB020C944F +:10015000F6040C940000CF92DF92EF92FF920F937F :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958DEB91E00E94F80072 +:1002000091098F73992708958FEE91E00E94F8006D :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -70,92 +70,99 @@ :100450008883EC912E2B2C939FBF06C08FB7F89406 :10046000E8812E2B28838FBFDF91CF9108950097CD :1004700069F0FC0101900020E9F73197AF01481BBA -:10048000590BBC018DEB91E00C94AB0080E090E047 -:1004900008950E94CF041F920F920FB60F9211245D -:1004A0002F933F938F939F93AF93BF938091B90105 -:1004B0009091BA01A091BB01B091BC013091B801FB -:1004C00023E0230F2D3720F40196A11DB11D05C097 -:1004D00026E8230F0296A11DB11D2093B801809339 -:1004E000B9019093BA01A093BB01B093BC01809174 -:1004F000B4019091B501A091B601B091B7010196F8 -:10050000A11DB11D8093B4019093B501A093B601D4 -:10051000B093B701BF91AF919F918F913F912F9170 -:100520000F900FBE0F901F9018951F920F920FB64D -:100530000F9211242F933F934F935F936F937F9369 -:100540008F939F93AF93BF93EF93FF938DEB91E0C6 -:100550000E940E01FF91EF91BF91AF919F918F91FA -:100560007F916F915F914F913F912F910F900FBEAF -:100570000F901F9018951F920F920FB60F92112493 -:100580002F938F939F93EF93FF93E091CD01F09181 -:10059000CE018081E091D301F091D40182FD12C09F -:1005A00090818091D6018F5F8F732091D701821740 -:1005B00051F0E091D601F0E0E354FE4F958F809327 -:1005C000D60101C08081FF91EF919F918F912F9172 -:1005D0000F900FBE0F901F901895789484B582608D -:1005E00084BD84B5816084BD85B5826085BD85B5D7 -:1005F000816085BD80916E00816080936E00109255 -:1006000081008091810082608093810080918100CF -:100610008160809381008091800081608093800060 -:100620008091B10084608093B1008091B0008160BE -:100630008093B00080917A00846080937A008091EA -:100640007A00826080937A0080917A008160809342 -:100650007A0080917A00806880937A001092C100BD -:10066000E091CD01F091CE0182E08083E091C9015B -:10067000F091CA011082E091CB01F091CC0180E1B0 -:1006800080831092D501E091D101F091D20186E0F2 -:100690008083E091CF01F091D001808180618083DF -:1006A000E091CF01F091D001808188608083E0915A -:1006B000CF01F091D001808180688083E091CF01EB -:1006C000F091D00180818F7D808380E191E00E9454 -:1006D000370285E291E00E9437028BE291E00E94AE -:1006E00037028DEB91E00E9476018DEB91E00E9444 -:1006F000F800892B09F40FC18DEB91E00E94D60020 -:10070000C82F082E000C990B9093B3018093B2016F -:1007100087FFF4C0807F99279093B1018093B00147 -:100720008039910519F51C2F1F70212F30E0F90138 -:10073000E451FF4F8491F901E852FF4FD491F90140 -:10074000EC53FF4FC491CC2309F4E8C081110E94FF -:10075000A201EC2FF0E0EE0FFF1FE654FF4FA59132 -:10076000B491EC91ED2309F4D9C0DDC0803A910534 -:1007700011F460E004C0803B910531F461E08C2FFE -:100780008F700E94CB01C7C0803E910509F06EC0FA -:10079000DC2FD770C3FF59C08DEB91E00E94D600CB -:1007A0008C0161E08D2F0E94FB010115110509F4F8 -:1007B0004AC00F3F110519F461E08D2FE2CFED2FF4 -:1007C000F0E0E451FF4FE491E330F9F048F4E13018 -:1007D000B9F0E230A1F584B5806284BD08BD9BC04C -:1007E000E730E9F0E83019F1E43049F58091800014 -:1007F00080628093800010938B0000938A008BC0EE -:1008000084B5806884BD07BD86C080918000806803 -:100810008093800010938900009388007CC08091B1 -:10082000B00080688093B0000093B30074C08091E2 -:10083000B00080628093B0000093B4006CC00038B8 -:1008400011050CF0B9CF60E0B8CFD064D0937C0034 -:1008500080917A00806480937A0080917A0086FD8E -:10086000FCCF809178008091790055C08038910547 -:10087000C9F48DEB91E00E94D6008F7099278130EA -:10088000910541F08230910539F0892B09F043C080 -:1008900060E003C062E001C061E08C2F8F700E94B5 -:1008A000FB0139C0803F9105B1F1E091AE01F091BB -:1008B000AF01E25DFE4F1082EC2FEF710E2E000CA7 -:1008C000FF0B3197EF31F10530F4EC5CFF4F8EE216 -:1008D00091E00C94C9048EE291E00E94370260918D -:1008E000B2018DEB91E00E942F018DEB91E00E940F -:1008F00076011092AF011092AE010DC08091AE0151 -:100900009091AF01FC01E25DFE4FC0830196909390 -:10091000AF018093AE010E949801E7CE612F110FC5 -:10092000770B606A04C0612F110F770B606B8DEB42 -:1009300091E00E942F01EFCFEDEBF1E013821282E4 -:1009400088EE93E0A0E0B0E084839583A683B7832C -:1009500084E091E09183808385EC90E095878487A3 -:1009600084EC90E09787868780EC90E0918B808B79 -:1009700081EC90E0938B828B82EC90E0958B848B62 -:1009800086EC90E0978B868B118E128E138E148ED0 -:100990000895EE0FFF1F0590F491E02D099481E07A -:0C09A00090E0F8940C94D404F894FFCF7D -:1009AC00000000002F01AB00F800D600EA00760131 -:1009BC00496D7065656475696E6F205665727369F3 -:0E09CC006F6E3A2000302E302E30000D0A00E3 +:10048000590BBC018FEE91E00C94AB0080E090E042 +:100490000895CF93DF930E943702EC0180E191E051 +:1004A0000E9437028C0F9D1FDF91CF9108950E940B +:1004B000F1041F920F920FB60F9211242F933F93C6 +:1004C0008F939F93AF93BF938091EB019091EC0139 +:1004D000A091ED01B091EE013091EA0123E0230FEC +:1004E0002D3720F40196A11DB11D05C026E8230F6C +:1004F0000296A11DB11D2093EA018093EB01909318 +:10050000EC01A093ED01B093EE018091E601909192 +:10051000E701A091E801B091E9010196A11DB11D8B +:100520008093E6019093E701A093E801B093E9017D +:10053000BF91AF919F918F913F912F910F900FBEDF +:100540000F901F9018951F920F920FB60F921124C3 +:100550002F933F934F935F936F937F938F939F93CB +:10056000AF93BF93EF93FF938FEE91E00E940E0144 +:10057000FF91EF91BF91AF919F918F917F916F917B +:100580005F914F913F912F910F900FBE0F901F9051 +:1005900018951F920F920FB60F9211242F938F93DD +:1005A0009F93EF93FF93E091FF01F0910002808110 +:1005B000E0910502F091060282FD12C090818091C7 +:1005C00008028F5F8F7320910902821751F0E0912A +:1005D0000802F0E0E151FE4F958F8093080201C0C0 +:1005E0008081FF91EF919F918F912F910F900FBE7E +:1005F0000F901F901895789484B5826084BD84B55F +:10060000816084BD85B5826085BD85B5816085BD0D +:1006100080916E00816080936E00109281008091C5 +:10062000810082608093810080918100816080934D +:100630008100809180008160809380008091B10072 +:1006400084608093B1008091B00081608093B0009D +:1006500080917A00846080937A0080917A00826031 +:1006600080937A0080917A00816080937A008091F3 +:100670007A00806880937A001092C100E091FF01B7 +:10068000F091000282E08083E091FB01F091FC0197 +:100690001082E091FD01F091FE0180E180831092D3 +:1006A0000702E0910302F091040286E08083E0916A +:1006B0000102F0910202808180618083E091010259 +:1006C000F0910202808188608083E0910102F091C4 +:1006D0000202808180688083E0910102F091020231 +:1006E00080818F7D808383E191E00E94370288E2E0 +:1006F00091E00E9449028FEE91E00E9476018FEE18 +:1007000091E00E94F800892B09F419C18FEE91E065 +:100710000E94D600C82F082E000C990B9093E5017B +:100720008093E40187FFFEC0807F99279093E301C7 +:100730008093E2018039910511F5CF702C2F30E0C4 +:10074000F901E451FF4F8491F901E852FF4FD49130 +:10075000F901EC53FF4FC491CC2309F4F3C081118C +:100760000E94A201EC2FF0E0EE0FFF1FE654FF4FB6 +:10077000A591B491EC91ED2309F4E4C0EFC0803A67 +:10078000910541F48EE291E00E9449028091E401DA +:1007900060E00AC0803B910559F48AE391E00E9431 +:1007A00049028091E40161E08F700E94CB01C7C0D3 +:1007B000803E910509F06EC0DC2FD770C3FF59C091 +:1007C0008FEE91E00E94D6008C0161E08D2F0E9497 +:1007D000FB010115110509F44AC00F3F110519F479 +:1007E00061E08D2FE2CFED2FF0E0E451FF4FE49177 +:1007F000E330F9F048F4E130B9F0E230A1F584B526 +:10080000806284BD08BD9BC0E730E9F0E83019F193 +:10081000E43049F5809180008062809380001093DD +:100820008B0000938A008BC084B5806884BD07BDAF +:1008300086C080918000806880938000109389003A +:10084000009388007CC08091B00080688093B000E5 +:100850000093B30074C08091B00080628093B000B8 +:100860000093B4006CC0003811050CF0B9CF60E003 +:10087000B8CFD064D0937C0080917A00806480935C +:100880007A0080917A0086FDFCCF8091780080917B +:10089000790055C080389105C9F48FEE91E00E942F +:1008A000D6008F7099278130910541F082309105F3 +:1008B00039F0892B09F043C060E003C062E001C059 +:1008C00061E08C2F8F700E94FB0139C0803F910541 +:1008D000B1F1E091E001F091E101E05AFE4F1082A8 +:1008E000EC2FEF710E2E000CFF0B3197EF31F1055D +:1008F00030F4EC5CFF4F80E691E00C94EB0480E672 +:1009000091E00E9437026091E4018FEE91E00E9435 +:100910002F018FEE91E00E9476011092E10110927A +:10092000E0010DC08091E0019091E101FC01E05AED +:10093000FE4FC08301969093E1018093E0010E94F5 +:100940009801DDCE87E491E00E9449026091E401C4 +:100950007091E5016F707727606A0BC083E591E0C5 +:100960000E9449026091E4017091E5016F70772760 +:10097000606B8FEE91E00E942F01E1CFEFEEF1E08E +:100980001382128288EE93E0A0E0B0E08483958326 +:10099000A683B78384E091E09183808385EC90E027 +:1009A0009587848784EC90E09787868780EC90E039 +:1009B000918B808B81EC90E0938B828B82EC90E02A +:1009C000958B848B86EC90E0978B868B118E128EA4 +:1009D000138E148E0895EE0FFF1F0590F491E02DF5 +:1009E000099481E090E0F8940C94F604F894FFCF19 +:1009F000000000002F01AB00F800D600EA007601ED +:100A00000D0A00496D7065656475696E6F205665E5 +:100A10007273696F6E3A2000302E302E300057729C +:100A20006974696E67204C4F570057726974696E1C +:100A3000672048494748004469676974616C204CE5 +:100A40004F57004469676974616C20484947480002 :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 1e194d2..1b2d398 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -3,7 +3,6 @@ class Impeeduino { static version = [0, 0, 0] static BAUD_RATE = 115200; - static DIGITAL_READ_TIME = 0.01; static MASK_OP = 0xF0; static OP_CONFIGURE = 0x80; @@ -65,18 +64,21 @@ class Impeeduino { } else { // Save ASCII data to function return buffer _funcBuf.seek(0, 'e'); + if (readByte == 0) + readByte = ' '; _funcBuf.writen(readByte, 'b'); } } + if (_funcBuf.len() > 0) { + server.log(format("%s", _funcBuf.tostring())); + //server.log(_funcBuf.tostring()); + } } function uartEvent() { _rxBuf.seek(0, 'e'); _rxBuf.writeblob(_serial.readblob()); - parseRXBuffer(); - if (_funcBuf[0] == 0) - _funcBuf[0] = 0x20 - server.log(format("%s", _funcBuf.tostring())); + imp.wakeup(0, parseRXBuffer.bindenv(this)); } function reset() { @@ -136,13 +138,13 @@ class Impeeduino { } else { local target = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin local readByte = _serial.read(); - while (readByte & target != target) { + while ((readByte & target) != target) { // Save other data to buffer _rxBuf.seek(0, 'e'); _rxBuf.writen(readByte, 'b'); readByte = _serial.read(); } - imp.wakeup(0, parseRXBuffer); + imp.wakeup(0, parseRXBuffer.bindenv(this)); return readByte & MASK_DIGITAL_WRITE ? 1 : 0; } } @@ -167,13 +169,19 @@ class Impeeduino { } impeeduino <- Impeeduino(); -impeeduino.pinMode(7, DIGITAL_OUT); +impeeduino.pinMode(8, DIGITAL_OUT); isOn <- false; +count <- 5; function loop() { - impeeduino.digitalWrite(7, isOn); + server.log("Loop " + count) + impeeduino.digitalWrite(8, isOn); + server.log("Read value: " + impeeduino.digitalRead(6)) isOn = !isOn; - imp.wakeup(1, loop); + if (count > 0) { + count--; + imp.wakeup(1, loop); + } } loop(); \ No newline at end of file From 0ba46968eb5fa74b6f4b2929a4acc83847f604ae Mon Sep 17 00:00:00 2001 From: Sunny He Date: Thu, 3 Nov 2016 17:34:33 -0400 Subject: [PATCH 03/34] Update README.md --- hardware/impeeduino/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/impeeduino/README.md b/hardware/impeeduino/README.md index 5f0bd63..5574a94 100644 --- a/hardware/impeeduino/README.md +++ b/hardware/impeeduino/README.md @@ -7,7 +7,7 @@ It parses Intel HEX files delivered via HTTP POST (form) and implements the STK5 You will need to install the "[optiboot](https://code.google.com/p/optiboot/)" bootloader using an ICSP cable. At the time of writing, the latest version was [v5.0a](https://code.google.com/p/optiboot/downloads/detail?name=optiboot-v5.0a.zip). To do this you will need an ISP or use [another Ardiuno as the ISP](http://arduino.cc/en/Tutorial/ArduinoISP) and the ArduinoISP sketch. -You might need to adjust the signature of the ATmega328P in the avrdude configuration to make avrdude think its an ATmega328P. +You might need to adjust the signature of the ATmega328P in the avrdude configuration to make avrdude think its an ATmega328P. This is on line 8486 on my installation. /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf From: signature = 0x1e 0x95 0x0f; From 6e0004ac35f9a1cc1a746b6254dcb19dc864b19d Mon Sep 17 00:00:00 2001 From: AG6GR Date: Fri, 4 Nov 2016 15:21:48 -0400 Subject: [PATCH 04/34] Fixed digitalRead(), still strangeness with Arduino input pin not pulling down correctly --- .../arduino/impeeduino/impeeduino.ino | 14 +- .../impeeduino/impeeduino.ino.standard.hex | 219 +++++++++--------- ...mpeeduino.ino.with_bootloader.standard.hex | 219 +++++++++--------- hardware/impeeduino/impeeduino.class.nut | 30 ++- 4 files changed, 258 insertions(+), 224 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 07c6ec2..94a0952 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,5 +1,7 @@ #define VERSION "0.0.0" +#define DELAY_WRITE 50 + #define MASK_OP 0xF0 #define OP_CONFIGURE 0x80 #define OP_DIGITAL_READ 0x90 @@ -76,18 +78,20 @@ void loop() { rxOp = rxByte & MASK_OP; if (rxOp == OP_DIGITAL_READ) { if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { - Serial.println("Digital HIGH"); + //Serial.println("Digital HIGH"); Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); } else { - Serial.println("Digital LOW"); + //Serial.println("Digital LOW"); Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); } } else if (rxOp == OP_DIGITAL_WRITE_0) { - Serial.println("Writing LOW"); + //Serial.println("Writing LOW"); digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); + delay(DELAY_WRITE); } else if (rxOp == OP_DIGITAL_WRITE_1) { - Serial.println("Writing HIGH"); + //Serial.println("Writing HIGH"); digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); + delay(DELAY_WRITE); } else if (rxOp == OP_ANALOG) { if (rxByte & MASK_ANALOG_RW) { analogWrite(rxByte & MASK_ANALOG_ADDR, Serial.read()); @@ -158,4 +162,4 @@ void loop() { rxbufferindex++; } } -} +} diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex index 6c992d3..9bdc7eb 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C9459020C94A9000C94C9020C94A302BC +:100040000C94FF020C94A9000C94CD020C94A7020E :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9008104810481048104EA -:100070008104810481048104810481048104810458 -:100080008104810481048104810481048104810448 -:100090008104810481048104810481048104810438 -:1000A00081048104810400000000240027002A004C +:100060000C94A9000C94A900CD04CD04CD04CD04BA +:10007000CD04CD04CD04CD04CD04CD04CD04CD04F8 +:10008000CD04CD04CD04CD04CD04CD04CD04CD04E8 +:10009000CD04CD04CD04CD04CD04CD04CD04CD04D8 +:1000A000CD04CD04CD0400000000240027002A0068 :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:10010000BE0411241FBECFEFD8E0DEBFCDBF11E08B -:10011000A0E0B1E0E0EFF9E002C005900D92A0365A -:10012000B107D9F722E0A0E6B1E001C01D92AC38DA +:10010000FC0411241FBECFEFD8E0DEBFCDBF11E04D +:10011000A0E0B1E0ECE6FAE002C005900D92AE324C +:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E94EB04C038D107C9F70E94FB020C944F -:10015000F6040C940000CF92DF92EF92FF920F937F +:100140000E942905C038D107C9F70E9449030C94C1 +:1001500034050C940000CF92DF92EF92FF920F9340 :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958FEE91E00E94F8006D +:1002000091098F73992708958DEB91E00E94F80072 :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -68,99 +68,104 @@ :10043000F8948881209582238883EC912E230BC029 :10044000623061F49FB7F8943881822F80958323BE :100450008883EC912E2B2C939FBF06C08FB7F89406 -:10046000E8812E2B28838FBFDF91CF9108950097CD -:1004700069F0FC0101900020E9F73197AF01481BBA -:10048000590BBC018FEE91E00C94AB0080E090E042 -:100490000895CF93DF930E943702EC0180E191E051 -:1004A0000E9437028C0F9D1FDF91CF9108950E940B -:1004B000F1041F920F920FB60F9211242F933F93C6 -:1004C0008F939F93AF93BF938091EB019091EC0139 -:1004D000A091ED01B091EE013091EA0123E0230FEC -:1004E0002D3720F40196A11DB11D05C026E8230F6C -:1004F0000296A11DB11D2093EA018093EB01909318 -:10050000EC01A093ED01B093EE018091E601909192 -:10051000E701A091E801B091E9010196A11DB11D8B -:100520008093E6019093E701A093E801B093E9017D -:10053000BF91AF919F918F913F912F910F900FBEDF -:100540000F901F9018951F920F920FB60F921124C3 -:100550002F933F934F935F936F937F938F939F93CB -:10056000AF93BF93EF93FF938FEE91E00E940E0144 -:10057000FF91EF91BF91AF919F918F917F916F917B -:100580005F914F913F912F910F900FBE0F901F9051 -:1005900018951F920F920FB60F9211242F938F93DD -:1005A0009F93EF93FF93E091FF01F0910002808110 -:1005B000E0910502F091060282FD12C090818091C7 -:1005C00008028F5F8F7320910902821751F0E0912A -:1005D0000802F0E0E151FE4F958F8093080201C0C0 -:1005E0008081FF91EF919F918F912F910F900FBE7E -:1005F0000F901F901895789484B5826084BD84B55F -:10060000816084BD85B5826085BD85B5816085BD0D -:1006100080916E00816080936E00109281008091C5 -:10062000810082608093810080918100816080934D -:100630008100809180008160809380008091B10072 -:1006400084608093B1008091B00081608093B0009D -:1006500080917A00846080937A0080917A00826031 -:1006600080937A0080917A00816080937A008091F3 -:100670007A00806880937A001092C100E091FF01B7 -:10068000F091000282E08083E091FB01F091FC0197 -:100690001082E091FD01F091FE0180E180831092D3 -:1006A0000702E0910302F091040286E08083E0916A -:1006B0000102F0910202808180618083E091010259 -:1006C000F0910202808188608083E0910102F091C4 -:1006D0000202808180688083E0910102F091020231 -:1006E00080818F7D808383E191E00E94370288E2E0 -:1006F00091E00E9449028FEE91E00E9476018FEE18 -:1007000091E00E94F800892B09F419C18FEE91E065 -:100710000E94D600C82F082E000C990B9093E5017B -:100720008093E40187FFFEC0807F99279093E301C7 -:100730008093E2018039910511F5CF702C2F30E0C4 -:10074000F901E451FF4F8491F901E852FF4FD49130 -:10075000F901EC53FF4FC491CC2309F4F3C081118C -:100760000E94A201EC2FF0E0EE0FFF1FE654FF4FB6 -:10077000A591B491EC91ED2309F4E4C0EFC0803A67 -:10078000910541F48EE291E00E9449028091E401DA -:1007900060E00AC0803B910559F48AE391E00E9431 -:1007A00049028091E40161E08F700E94CB01C7C0D3 -:1007B000803E910509F06EC0DC2FD770C3FF59C091 -:1007C0008FEE91E00E94D6008C0161E08D2F0E9497 -:1007D000FB010115110509F44AC00F3F110519F479 -:1007E00061E08D2FE2CFED2FF0E0E451FF4FE49177 -:1007F000E330F9F048F4E130B9F0E230A1F584B526 -:10080000806284BD08BD9BC0E730E9F0E83019F193 -:10081000E43049F5809180008062809380001093DD -:100820008B0000938A008BC084B5806884BD07BDAF -:1008300086C080918000806880938000109389003A -:10084000009388007CC08091B00080688093B000E5 -:100850000093B30074C08091B00080628093B000B8 -:100860000093B4006CC0003811050CF0B9CF60E003 -:10087000B8CFD064D0937C0080917A00806480935C -:100880007A0080917A0086FDFCCF8091780080917B -:10089000790055C080389105C9F48FEE91E00E942F -:1008A000D6008F7099278130910541F082309105F3 -:1008B00039F0892B09F043C060E003C062E001C059 -:1008C00061E08C2F8F700E94FB0139C0803F910541 -:1008D000B1F1E091E001F091E101E05AFE4F1082A8 -:1008E000EC2FEF710E2E000CFF0B3197EF31F1055D -:1008F00030F4EC5CFF4F80E691E00C94EB0480E672 -:1009000091E00E9437026091E4018FEE91E00E9435 -:100910002F018FEE91E00E9476011092E10110927A -:10092000E0010DC08091E0019091E101FC01E05AED -:10093000FE4FC08301969093E1018093E0010E94F5 -:100940009801DDCE87E491E00E9449026091E401C4 -:100950007091E5016F707727606A0BC083E591E0C5 -:100960000E9449026091E4017091E5016F70772760 -:10097000606B8FEE91E00E942F01E1CFEFEEF1E08E -:100980001382128288EE93E0A0E0B0E08483958326 -:10099000A683B78384E091E09183808385EC90E027 -:1009A0009587848784EC90E09787868780EC90E039 -:1009B000918B808B81EC90E0938B828B82EC90E02A -:1009C000958B848B86EC90E0978B868B118E128EA4 -:1009D000138E148E0895EE0FFF1F0590F491E02DF5 -:1009E000099481E090E0F8940C94F604F894FFCF19 -:1009F000000000002F01AB00F800D600EA007601ED -:100A00000D0A00496D7065656475696E6F205665E5 -:100A10007273696F6E3A2000302E302E300057729C -:100A20006974696E67204C4F570057726974696E1C -:100A3000672048494748004469676974616C204CE5 -:100A40004F57004469676974616C20484947480002 +:10046000E8812E2B28838FBFDF91CF9108953FB76E +:10047000F8948091330190913401A0913501B091AD +:10048000360126B5A89B05C02F3F19F00196A11D86 +:10049000B11D3FBFBA2FA92F982F8827820F911D1A +:1004A000A11DB11DBC01CD0142E0660F771F881F61 +:1004B000991F4A95D1F708958F929F92AF92BF925C +:1004C000CF92DF92EF92FF920E9437024B015C01C4 +:1004D00082E3C82ED12CE12CF12C0E943702DC01E2 +:1004E000CB0188199909AA09BB09883E9340A10547 +:1004F000B10558F021E0C21AD108E108F10888EEF0 +:10050000880E83E0981EA11CB11CC114D104E10423 +:10051000F10419F7FF90EF90DF90CF90BF90AF906C +:100520009F908F900895009769F0FC010190002042 +:10053000E9F73197AF01481B590BBC018DEB91E0F6 +:100540000C94AB0080E090E008950E942F051F926C +:100550000F920FB60F9211242F933F934F935F93F7 +:100560006F937F938F939F93AF93BF93EF93FF937B +:100570008DEB91E00E940E01FF91EF91BF91AF9141 +:100580009F918F917F916F915F914F913F912F91AB +:100590000F900FBE0F901F9018951F920F920FB6DD +:1005A0000F9211242F938F939F93EF93FF93E091DA +:1005B000CD01F091CE018081E091D301F091D40181 +:1005C00082FD12C090818091D6018F5F8F73209140 +:1005D000D701821751F0E091D601F0E0E354FE4FCD +:1005E000958F8093D60101C08081FF91EF919F91FB +:1005F0008F912F910F900FBE0F901F9018951F9203 +:100600000F920FB60F9211242F933F938F939F93C6 +:10061000AF93BF9380912F0190913001A091310150 +:10062000B091320130912E0123E0230F2D3720F4B9 +:100630000196A11DB11D05C026E8230F0296A11D3C +:10064000B11D20932E0180932F0190933001A09330 +:100650003101B09332018091330190913401A09126 +:100660003501B09136010196A11DB11D8093330172 +:1006700090933401A0933501B0933601BF91AF91AF +:100680009F918F913F912F910F900FBE0F901F90D0 +:100690001895789484B5826084BD84B5816084BDEA +:1006A00085B5826085BD85B5816085BD80916E0010 +:1006B000816080936E001092810080918100826041 +:1006C000809381008091810081608093810080917E +:1006D00080008160809380008091B100846080936D +:1006E000B1008091B00081608093B00080917A0069 +:1006F000846080937A0080917A00826080937A008F +:1007000080917A00816080937A0080917A0080687D +:1007100080937A001092C100E091CD01F091CE015A +:1007200082E08083E091C901F091CA011082E091DA +:10073000CB01F091CC0180E180831092D501E09152 +:10074000D101F091D20186E08083E091CF01F09158 +:10075000D001808180618083E091CF01F091D00150 +:10076000808188608083E091CF01F091D001808109 +:1007700080688083E091CF01F091D00180818F7DEE +:10078000808380E191E00E94930285E291E00E94E3 +:1007900093028BE291E00E9493028DEB91E00E9424 +:1007A00076018DEB91E00E94F800892B09F413C1CA +:1007B0008DEB91E00E94D600C82F082E000C990BFB +:1007C0009093BC018093BB0187FFF8C0807F99277D +:1007D0009093BA018093B9018039910519F51C2FC6 +:1007E0001F70212F30E0F901E451FF4F8491F9018E +:1007F000E852FF4FD491F901EC53FF4FC491CC2341 +:1008000009F4ECC081110E94A201EC2FF0E0EE0F80 +:10081000FF1FE654FF4FA591B491EC91ED2309F42D +:10082000DDC0E1C0803A910511F460E004C0803B76 +:10083000910541F461E08C2F8F700E94CB010E94E2 +:100840005C02C9C0803E910509F070C0DC2FD770F2 +:10085000C3FF5BC08DEB91E00E94D6008C0161E08C +:100860008D2F0E94FB010115110509F44CC00F3FAB +:10087000110529F461E08D2F0E94CB01ACC0ED2F52 +:10088000F0E0E451FF4FE491E330F9F048F4E13057 +:10089000B9F0E230A1F584B5806284BD08BD9BC08B +:1008A000E730E9F0E83019F1E43049F58091800053 +:1008B00080628093800010938B0000938A008BC02D +:1008C00084B5806884BD07BD86C080918000806843 +:1008D0008093800010938900009388007CC08091F1 +:1008E000B00080688093B0000093B30074C0809122 +:1008F000B00080628093B0000093B4006CC00038F8 +:1009000011050CF0B7CF60E0B6CFD064D0937C0077 +:1009100080917A00806480937A0080917A0086FDCD +:10092000FCCF809178008091790055C08038910586 +:10093000C9F48DEB91E00E94D6008F709927813029 +:10094000910541F08230910539F0892B09F043C0BF +:1009500060E003C062E001C061E08C2F8F700E94F4 +:10096000FB0139C0803F9105B1F1E091B701F091F1 +:10097000B801E95CFE4F1082EC2FEF710E2E000CD7 +:10098000FF0B3197EF31F10530F4EC5CFF4F87E35B +:1009900091E00C94290587E391E00E949302609115 +:1009A000BB018DEB91E00E942F018DEB91E00E9445 +:1009B00076011092B8011092B7010DC08091B70175 +:1009C0009091B801FC01E95CFE4FC08301969093C1 +:1009D000B8018093B7010E949801E3CE612F110FF7 +:1009E000770B606A04C0612F110F770B606B8DEB82 +:1009F00091E00E942F01EFCFEDEBF1E01382128224 +:100A000088EE93E0A0E0B0E084839583A683B7836B +:100A100084E091E09183808385EC90E095878487E2 +:100A200084EC90E09787868780EC90E0918B808BB8 +:100A300081EC90E0938B828B82EC90E0958B848BA1 +:100A400086EC90E0978B868B118E128E138E148E0F +:100A50000895EE0FFF1F0590F491E02D099481E0B9 +:0C0A600090E0F8940C943405F894FFCF5B +:100A6C00000000002F01AB00F800D600EA00760170 +:100A7C00496D7065656475696E6F20566572736932 +:0E0A8C006F6E3A2000302E302E30000D0A0022 :00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex index 480e2c8..592285a 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C9459020C94A9000C94C9020C94A302BC +:100040000C94FF020C94A9000C94CD020C94A7020E :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9008104810481048104EA -:100070008104810481048104810481048104810458 -:100080008104810481048104810481048104810448 -:100090008104810481048104810481048104810438 -:1000A00081048104810400000000240027002A004C +:100060000C94A9000C94A900CD04CD04CD04CD04BA +:10007000CD04CD04CD04CD04CD04CD04CD04CD04F8 +:10008000CD04CD04CD04CD04CD04CD04CD04CD04E8 +:10009000CD04CD04CD04CD04CD04CD04CD04CD04D8 +:1000A000CD04CD04CD0400000000240027002A0068 :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:10010000BE0411241FBECFEFD8E0DEBFCDBF11E08B -:10011000A0E0B1E0E0EFF9E002C005900D92A0365A -:10012000B107D9F722E0A0E6B1E001C01D92AC38DA +:10010000FC0411241FBECFEFD8E0DEBFCDBF11E04D +:10011000A0E0B1E0ECE6FAE002C005900D92AE324C +:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E94EB04C038D107C9F70E94FB020C944F -:10015000F6040C940000CF92DF92EF92FF920F937F +:100140000E942905C038D107C9F70E9449030C94C1 +:1001500034050C940000CF92DF92EF92FF920F9340 :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958FEE91E00E94F8006D +:1002000091098F73992708958DEB91E00E94F80072 :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -68,101 +68,106 @@ :10043000F8948881209582238883EC912E230BC029 :10044000623061F49FB7F8943881822F80958323BE :100450008883EC912E2B2C939FBF06C08FB7F89406 -:10046000E8812E2B28838FBFDF91CF9108950097CD -:1004700069F0FC0101900020E9F73197AF01481BBA -:10048000590BBC018FEE91E00C94AB0080E090E042 -:100490000895CF93DF930E943702EC0180E191E051 -:1004A0000E9437028C0F9D1FDF91CF9108950E940B -:1004B000F1041F920F920FB60F9211242F933F93C6 -:1004C0008F939F93AF93BF938091EB019091EC0139 -:1004D000A091ED01B091EE013091EA0123E0230FEC -:1004E0002D3720F40196A11DB11D05C026E8230F6C -:1004F0000296A11DB11D2093EA018093EB01909318 -:10050000EC01A093ED01B093EE018091E601909192 -:10051000E701A091E801B091E9010196A11DB11D8B -:100520008093E6019093E701A093E801B093E9017D -:10053000BF91AF919F918F913F912F910F900FBEDF -:100540000F901F9018951F920F920FB60F921124C3 -:100550002F933F934F935F936F937F938F939F93CB -:10056000AF93BF93EF93FF938FEE91E00E940E0144 -:10057000FF91EF91BF91AF919F918F917F916F917B -:100580005F914F913F912F910F900FBE0F901F9051 -:1005900018951F920F920FB60F9211242F938F93DD -:1005A0009F93EF93FF93E091FF01F0910002808110 -:1005B000E0910502F091060282FD12C090818091C7 -:1005C00008028F5F8F7320910902821751F0E0912A -:1005D0000802F0E0E151FE4F958F8093080201C0C0 -:1005E0008081FF91EF919F918F912F910F900FBE7E -:1005F0000F901F901895789484B5826084BD84B55F -:10060000816084BD85B5826085BD85B5816085BD0D -:1006100080916E00816080936E00109281008091C5 -:10062000810082608093810080918100816080934D -:100630008100809180008160809380008091B10072 -:1006400084608093B1008091B00081608093B0009D -:1006500080917A00846080937A0080917A00826031 -:1006600080937A0080917A00816080937A008091F3 -:100670007A00806880937A001092C100E091FF01B7 -:10068000F091000282E08083E091FB01F091FC0197 -:100690001082E091FD01F091FE0180E180831092D3 -:1006A0000702E0910302F091040286E08083E0916A -:1006B0000102F0910202808180618083E091010259 -:1006C000F0910202808188608083E0910102F091C4 -:1006D0000202808180688083E0910102F091020231 -:1006E00080818F7D808383E191E00E94370288E2E0 -:1006F00091E00E9449028FEE91E00E9476018FEE18 -:1007000091E00E94F800892B09F419C18FEE91E065 -:100710000E94D600C82F082E000C990B9093E5017B -:100720008093E40187FFFEC0807F99279093E301C7 -:100730008093E2018039910511F5CF702C2F30E0C4 -:10074000F901E451FF4F8491F901E852FF4FD49130 -:10075000F901EC53FF4FC491CC2309F4F3C081118C -:100760000E94A201EC2FF0E0EE0FFF1FE654FF4FB6 -:10077000A591B491EC91ED2309F4E4C0EFC0803A67 -:10078000910541F48EE291E00E9449028091E401DA -:1007900060E00AC0803B910559F48AE391E00E9431 -:1007A00049028091E40161E08F700E94CB01C7C0D3 -:1007B000803E910509F06EC0DC2FD770C3FF59C091 -:1007C0008FEE91E00E94D6008C0161E08D2F0E9497 -:1007D000FB010115110509F44AC00F3F110519F479 -:1007E00061E08D2FE2CFED2FF0E0E451FF4FE49177 -:1007F000E330F9F048F4E130B9F0E230A1F584B526 -:10080000806284BD08BD9BC0E730E9F0E83019F193 -:10081000E43049F5809180008062809380001093DD -:100820008B0000938A008BC084B5806884BD07BDAF -:1008300086C080918000806880938000109389003A -:10084000009388007CC08091B00080688093B000E5 -:100850000093B30074C08091B00080628093B000B8 -:100860000093B4006CC0003811050CF0B9CF60E003 -:10087000B8CFD064D0937C0080917A00806480935C -:100880007A0080917A0086FDFCCF8091780080917B -:10089000790055C080389105C9F48FEE91E00E942F -:1008A000D6008F7099278130910541F082309105F3 -:1008B00039F0892B09F043C060E003C062E001C059 -:1008C00061E08C2F8F700E94FB0139C0803F910541 -:1008D000B1F1E091E001F091E101E05AFE4F1082A8 -:1008E000EC2FEF710E2E000CFF0B3197EF31F1055D -:1008F00030F4EC5CFF4F80E691E00C94EB0480E672 -:1009000091E00E9437026091E4018FEE91E00E9435 -:100910002F018FEE91E00E9476011092E10110927A -:10092000E0010DC08091E0019091E101FC01E05AED -:10093000FE4FC08301969093E1018093E0010E94F5 -:100940009801DDCE87E491E00E9449026091E401C4 -:100950007091E5016F707727606A0BC083E591E0C5 -:100960000E9449026091E4017091E5016F70772760 -:10097000606B8FEE91E00E942F01E1CFEFEEF1E08E -:100980001382128288EE93E0A0E0B0E08483958326 -:10099000A683B78384E091E09183808385EC90E027 -:1009A0009587848784EC90E09787868780EC90E039 -:1009B000918B808B81EC90E0938B828B82EC90E02A -:1009C000958B848B86EC90E0978B868B118E128EA4 -:1009D000138E148E0895EE0FFF1F0590F491E02DF5 -:1009E000099481E090E0F8940C94F604F894FFCF19 -:1009F000000000002F01AB00F800D600EA007601ED -:100A00000D0A00496D7065656475696E6F205665E5 -:100A10007273696F6E3A2000302E302E300057729C -:100A20006974696E67204C4F570057726974696E1C -:100A3000672048494748004469676974616C204CE5 -:100A40004F57004469676974616C20484947480002 +:10046000E8812E2B28838FBFDF91CF9108953FB76E +:10047000F8948091330190913401A0913501B091AD +:10048000360126B5A89B05C02F3F19F00196A11D86 +:10049000B11D3FBFBA2FA92F982F8827820F911D1A +:1004A000A11DB11DBC01CD0142E0660F771F881F61 +:1004B000991F4A95D1F708958F929F92AF92BF925C +:1004C000CF92DF92EF92FF920E9437024B015C01C4 +:1004D00082E3C82ED12CE12CF12C0E943702DC01E2 +:1004E000CB0188199909AA09BB09883E9340A10547 +:1004F000B10558F021E0C21AD108E108F10888EEF0 +:10050000880E83E0981EA11CB11CC114D104E10423 +:10051000F10419F7FF90EF90DF90CF90BF90AF906C +:100520009F908F900895009769F0FC010190002042 +:10053000E9F73197AF01481B590BBC018DEB91E0F6 +:100540000C94AB0080E090E008950E942F051F926C +:100550000F920FB60F9211242F933F934F935F93F7 +:100560006F937F938F939F93AF93BF93EF93FF937B +:100570008DEB91E00E940E01FF91EF91BF91AF9141 +:100580009F918F917F916F915F914F913F912F91AB +:100590000F900FBE0F901F9018951F920F920FB6DD +:1005A0000F9211242F938F939F93EF93FF93E091DA +:1005B000CD01F091CE018081E091D301F091D40181 +:1005C00082FD12C090818091D6018F5F8F73209140 +:1005D000D701821751F0E091D601F0E0E354FE4FCD +:1005E000958F8093D60101C08081FF91EF919F91FB +:1005F0008F912F910F900FBE0F901F9018951F9203 +:100600000F920FB60F9211242F933F938F939F93C6 +:10061000AF93BF9380912F0190913001A091310150 +:10062000B091320130912E0123E0230F2D3720F4B9 +:100630000196A11DB11D05C026E8230F0296A11D3C +:10064000B11D20932E0180932F0190933001A09330 +:100650003101B09332018091330190913401A09126 +:100660003501B09136010196A11DB11D8093330172 +:1006700090933401A0933501B0933601BF91AF91AF +:100680009F918F913F912F910F900FBE0F901F90D0 +:100690001895789484B5826084BD84B5816084BDEA +:1006A00085B5826085BD85B5816085BD80916E0010 +:1006B000816080936E001092810080918100826041 +:1006C000809381008091810081608093810080917E +:1006D00080008160809380008091B100846080936D +:1006E000B1008091B00081608093B00080917A0069 +:1006F000846080937A0080917A00826080937A008F +:1007000080917A00816080937A0080917A0080687D +:1007100080937A001092C100E091CD01F091CE015A +:1007200082E08083E091C901F091CA011082E091DA +:10073000CB01F091CC0180E180831092D501E09152 +:10074000D101F091D20186E08083E091CF01F09158 +:10075000D001808180618083E091CF01F091D00150 +:10076000808188608083E091CF01F091D001808109 +:1007700080688083E091CF01F091D00180818F7DEE +:10078000808380E191E00E94930285E291E00E94E3 +:1007900093028BE291E00E9493028DEB91E00E9424 +:1007A00076018DEB91E00E94F800892B09F413C1CA +:1007B0008DEB91E00E94D600C82F082E000C990BFB +:1007C0009093BC018093BB0187FFF8C0807F99277D +:1007D0009093BA018093B9018039910519F51C2FC6 +:1007E0001F70212F30E0F901E451FF4F8491F9018E +:1007F000E852FF4FD491F901EC53FF4FC491CC2341 +:1008000009F4ECC081110E94A201EC2FF0E0EE0F80 +:10081000FF1FE654FF4FA591B491EC91ED2309F42D +:10082000DDC0E1C0803A910511F460E004C0803B76 +:10083000910541F461E08C2F8F700E94CB010E94E2 +:100840005C02C9C0803E910509F070C0DC2FD770F2 +:10085000C3FF5BC08DEB91E00E94D6008C0161E08C +:100860008D2F0E94FB010115110509F44CC00F3FAB +:10087000110529F461E08D2F0E94CB01ACC0ED2F52 +:10088000F0E0E451FF4FE491E330F9F048F4E13057 +:10089000B9F0E230A1F584B5806284BD08BD9BC08B +:1008A000E730E9F0E83019F1E43049F58091800053 +:1008B00080628093800010938B0000938A008BC02D +:1008C00084B5806884BD07BD86C080918000806843 +:1008D0008093800010938900009388007CC08091F1 +:1008E000B00080688093B0000093B30074C0809122 +:1008F000B00080628093B0000093B4006CC00038F8 +:1009000011050CF0B7CF60E0B6CFD064D0937C0077 +:1009100080917A00806480937A0080917A0086FDCD +:10092000FCCF809178008091790055C08038910586 +:10093000C9F48DEB91E00E94D6008F709927813029 +:10094000910541F08230910539F0892B09F043C0BF +:1009500060E003C062E001C061E08C2F8F700E94F4 +:10096000FB0139C0803F9105B1F1E091B701F091F1 +:10097000B801E95CFE4F1082EC2FEF710E2E000CD7 +:10098000FF0B3197EF31F10530F4EC5CFF4F87E35B +:1009900091E00C94290587E391E00E949302609115 +:1009A000BB018DEB91E00E942F018DEB91E00E9445 +:1009B00076011092B8011092B7010DC08091B70175 +:1009C0009091B801FC01E95CFE4FC08301969093C1 +:1009D000B8018093B7010E949801E3CE612F110FF7 +:1009E000770B606A04C0612F110F770B606B8DEB82 +:1009F00091E00E942F01EFCFEDEBF1E01382128224 +:100A000088EE93E0A0E0B0E084839583A683B7836B +:100A100084E091E09183808385EC90E095878487E2 +:100A200084EC90E09787868780EC90E0918B808BB8 +:100A300081EC90E0938B828B82EC90E0958B848BA1 +:100A400086EC90E0978B868B118E128E138E148E0F +:100A50000895EE0FFF1F0590F491E02D099481E0B9 +:0C0A600090E0F8940C943405F894FFCF5B +:100A6C00000000002F01AB00F800D600EA00760170 +:100A7C00496D7065656475696E6F20566572736932 +:0E0A8C006F6E3A2000302E302E30000D0A0022 :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 1b2d398..c655f2a 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -61,6 +61,7 @@ class Impeeduino { readByte = buf.readn('b'); if (readByte & 0x80) { // Interpret as Opcode + server.log(format("Opcode: 0x%02X", readByte)); } else { // Save ASCII data to function return buffer _funcBuf.seek(0, 'e'); @@ -72,10 +73,13 @@ class Impeeduino { if (_funcBuf.len() > 0) { server.log(format("%s", _funcBuf.tostring())); //server.log(_funcBuf.tostring()); + // TESTING ONLY + _funcBuf = blob(); } } function uartEvent() { + server.log("Uart event") _rxBuf.seek(0, 'e'); _rxBuf.writeblob(_serial.readblob()); imp.wakeup(0, parseRXBuffer.bindenv(this)); @@ -136,15 +140,28 @@ class Impeeduino { cb({ "value": _pinState[pin]}); }.bindenv(this)); } else { - local target = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin + local target_low = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin + local target_high = OP_DIGITAL_WRITE_1 | pin; local readByte = _serial.read(); - while ((readByte & target) != target) { + local timeout_count = 0; + while (readByte != target_low && readByte != target_high) { // Save other data to buffer - _rxBuf.seek(0, 'e'); - _rxBuf.writen(readByte, 'b'); + if (readByte != -1) { + _rxBuf.seek(0, 'e'); + _rxBuf.writen(readByte, 'b'); + } + timeout_count++; + if (timeout_count > 100) { + //server.log("Read Timeout, retrying") + timeout_count = 0; + _serial.write(OP_DIGITAL_READ | pin); + _serial.flush(); + } readByte = _serial.read(); } + server.log(format("0x%02X", readByte)); imp.wakeup(0, parseRXBuffer.bindenv(this)); + return readByte & MASK_DIGITAL_WRITE ? 1 : 0; } } @@ -169,11 +186,14 @@ class Impeeduino { } impeeduino <- Impeeduino(); + impeeduino.pinMode(8, DIGITAL_OUT); +impeeduino.pinMode(6, DIGITAL_IN); isOn <- false; -count <- 5; +count <- 7; + function loop() { server.log("Loop " + count) impeeduino.digitalWrite(8, isOn); From e815a115419c300ca124fc1788f3ec3933dae166 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 03:27:08 -0400 Subject: [PATCH 05/34] Add notes on communication format between Imp and Arduino. Change arbitrary data opcode to avoid 0xFF issues --- hardware/impeeduino/.gitignore | 1 + hardware/impeeduino/SerialComms.txt | 57 +++ .../arduino/impeeduino/impeeduino.ino | 331 +++++++++--------- hardware/impeeduino/impeeduino.class.nut | 8 +- 4 files changed, 230 insertions(+), 167 deletions(-) create mode 100644 hardware/impeeduino/.gitignore create mode 100644 hardware/impeeduino/SerialComms.txt diff --git a/hardware/impeeduino/.gitignore b/hardware/impeeduino/.gitignore new file mode 100644 index 0000000..b25c15b --- /dev/null +++ b/hardware/impeeduino/.gitignore @@ -0,0 +1 @@ +*~ diff --git a/hardware/impeeduino/SerialComms.txt b/hardware/impeeduino/SerialComms.txt new file mode 100644 index 0000000..50b20cc --- /dev/null +++ b/hardware/impeeduino/SerialComms.txt @@ -0,0 +1,57 @@ +Instruction format: 1[op (3b)][addr (4b)] + Any byte received that does not have MSB set to 1 is interpreted as ASCII data, + should be added to function call buffer. + +000 (0x80) Configure Pin + Must be followed by arb data with config type + 1111[configtype (4b)] + 0000 Input + 0001 Input PULLUP + 0010 Output + +001 (0x90) Digital Read + Arduino responds with digital write op corresponding to read value + +010 (0xA0) Digital Write 0 +011 (0xB0) Digital Write 1 + + + +100 (0xC0) Analog Op + W/~R + addr (3b) + pin 3 : 0 + pin 5 : 1 + pin 6 : 2 + pin 9 : 3 + pin 10: 4 + pin 11: 5 + + (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle + - Full instruction is 1100[W/~R][addr (3b), 1101[MSB (4b)], 1101[LSB (4b)] + + (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and + +101 (0xD0) Arb data/Reserved + +110 (0xE0) Call/Return + call 0 (11000000) reserved for "clear buffer" +111 (0xF0) Call/Return + 11111111 (0xFF) May not be used to avoid confusion + +========== +Function call process + +Valid functions are 1-30 (0x01 to 0x1E) +function 0 (0x00) is reserved as "clear buffer" +function 32 (0xFF) is not allowed to avoid 0xFF confusion with -1 + +1. Imp sends "call 0x00" to clear Arduino function buffer +2. Imp sends function argument as ASCII characters (0-127) +3. Arduino places received characters into buffer +4. Imp sends "call 0xXX" to initiate call of function #XX +5. Arduino calls functionXX() with the function buffer's contents as the argument +6. functionXX returns, optionally with a character array return value +7. Arduino sends "call 0x00" to clear Imp's return value buffer +8. Arduino sends return value as ASCII characters +9. Imp places received characters into buffer +10. Arduino sends "call 0xXX" to indicate function return +11. If a callback has been set, Imp calls it with the returned value as an argument. \ No newline at end of file diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 94a0952..6578baa 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,165 +1,168 @@ -#define VERSION "0.0.0" - -#define DELAY_WRITE 50 - -#define MASK_OP 0xF0 -#define OP_CONFIGURE 0x80 -#define OP_DIGITAL_READ 0x90 -#define OP_DIGITAL_WRITE_0 0xA0 -#define OP_DIGITAL_WRITE_1 0xB0 -#define OP_ANALOG 0xE0 -#define OP_ARB 0xF0 - -#define MASK_CONFIG 0x0F -#define CONFIG_INPUT 0x00 -#define CONFIG_INPUT_PULLUP 0x01 -#define CONFIG_OUTPUT 0x02 - -#define MASK_DIGITAL_ADDR 0x0F -#define MASK_ANALOG_RW 0x08 -#define MASK_ANALOG_ADDR 0x07 -#define MASK_CALL 0x1F - -unsigned int rxByte = 0; -unsigned int rxOp = 0; -char rxbuffer[128]; -int rxbufferindex = 0; - -char* function00(char* buf) { return buf; } -char* function01(char* buf) { return buf; } -char* function02(char* buf) { return buf; } -char* function03(char* buf) { return buf; } -char* function04(char* buf) { return buf; } -char* function05(char* buf) { return buf; } -char* function06(char* buf) { return buf; } -char* function07(char* buf) { return buf; } -char* function08(char* buf) { return buf; } -char* function09(char* buf) { return buf; } -char* function0A(char* buf) { return buf; } -char* function0B(char* buf) { return buf; } -char* function0C(char* buf) { return buf; } -char* function0D(char* buf) { return buf; } -char* function0E(char* buf) { return buf; } -char* function0F(char* buf) { return buf; } - -char* function10(char* buf) { return buf; } -char* function11(char* buf) { return buf; } -char* function12(char* buf) { return buf; } -char* function13(char* buf) { return buf; } -char* function14(char* buf) { return buf; } -char* function15(char* buf) { return buf; } -char* function16(char* buf) { return buf; } -char* function17(char* buf) { return buf; } -char* function18(char* buf) { return buf; } -char* function19(char* buf) { return buf; } -char* function1A(char* buf) { return buf; } -char* function1B(char* buf) { return buf; } -char* function1C(char* buf) { return buf; } -char* function1D(char* buf) { return buf; } -char* function1E(char* buf) { return buf; } -char* function1F(char* buf) { return buf; } - - -void setup() { - // put your setup code here, to run once: - Serial.begin(115200); - Serial.print("Impeeduino Version: "); - Serial.println(VERSION); - Serial.flush(); -} - -void loop() { - if (Serial.available()) { - // get the new byte: - - rxByte = (char)Serial.read(); - if (rxByte & 0x80) { - // Not ASCII text, attempt to decode opcode - rxOp = rxByte & MASK_OP; - if (rxOp == OP_DIGITAL_READ) { - if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { - //Serial.println("Digital HIGH"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); - } else { - //Serial.println("Digital LOW"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); - } - } else if (rxOp == OP_DIGITAL_WRITE_0) { - //Serial.println("Writing LOW"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); - delay(DELAY_WRITE); - } else if (rxOp == OP_DIGITAL_WRITE_1) { - //Serial.println("Writing HIGH"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); - delay(DELAY_WRITE); - } else if (rxOp == OP_ANALOG) { - if (rxByte & MASK_ANALOG_RW) { - analogWrite(rxByte & MASK_ANALOG_ADDR, Serial.read()); - } else { - analogRead(rxByte & MASK_ANALOG_ADDR); - // return 10 bit val, TBD - } - - } else if (rxOp == OP_CONFIGURE) { - switch (Serial.read() & MASK_CONFIG) { - case CONFIG_INPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); - break; - case CONFIG_INPUT_PULLUP: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); - break; - case CONFIG_OUTPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); - break; - } - } else if (rxOp == OP_ARB) { - - } else { - // Call Function Op: 10X - rxbuffer[rxbufferindex] = '\0'; - switch (rxByte & MASK_CALL) { - case 0x00: Serial.write(function00(rxbuffer)); break; - case 0x01: Serial.write(function01(rxbuffer)); break; - case 0x02: Serial.write(function02(rxbuffer)); break; - case 0x03: Serial.write(function03(rxbuffer)); break; - case 0x04: Serial.write(function04(rxbuffer)); break; - case 0x05: Serial.write(function05(rxbuffer)); break; - case 0x06: Serial.write(function06(rxbuffer)); break; - case 0x07: Serial.write(function07(rxbuffer)); break; - case 0x08: Serial.write(function08(rxbuffer)); break; - case 0x09: Serial.write(function09(rxbuffer)); break; - case 0x0A: Serial.write(function0A(rxbuffer)); break; - case 0x0B: Serial.write(function0B(rxbuffer)); break; - case 0x0C: Serial.write(function0C(rxbuffer)); break; - case 0x0D: Serial.write(function0D(rxbuffer)); break; - case 0x0E: Serial.write(function0E(rxbuffer)); break; - case 0x0F: Serial.write(function0F(rxbuffer)); break; - - case 0x10: Serial.write(function10(rxbuffer)); break; - case 0x11: Serial.write(function11(rxbuffer)); break; - case 0x12: Serial.write(function12(rxbuffer)); break; - case 0x13: Serial.write(function13(rxbuffer)); break; - case 0x14: Serial.write(function14(rxbuffer)); break; - case 0x15: Serial.write(function15(rxbuffer)); break; - case 0x16: Serial.write(function16(rxbuffer)); break; - case 0x17: Serial.write(function17(rxbuffer)); break; - case 0x18: Serial.write(function18(rxbuffer)); break; - case 0x19: Serial.write(function19(rxbuffer)); break; - case 0x1A: Serial.write(function1A(rxbuffer)); break; - case 0x1B: Serial.write(function1B(rxbuffer)); break; - case 0x1C: Serial.write(function1C(rxbuffer)); break; - case 0x1D: Serial.write(function1D(rxbuffer)); break; - case 0x1E: Serial.write(function1E(rxbuffer)); break; - case 0x1F: Serial.write(function1F(rxbuffer)); break; - } - Serial.write(rxByte); - Serial.flush(); - rxbufferindex = 0; - } - } else { - // Received ASCII text, insert into rxbuffer - rxbuffer[rxbufferindex] = char(rxByte); - rxbufferindex++; - } - } +#define VERSION "0.0.1" + +#define BAUD_RATE 115200 +#define DELAY_WRITE 50 + +#define MASK_OP 0xF0 +#define OP_CONFIGURE 0x80 +#define OP_DIGITAL_READ 0x90 +#define OP_DIGITAL_WRITE_0 0xA0 +#define OP_DIGITAL_WRITE_1 0xB0 +#define OP_ANALOG 0xC0 +#define OP_ARB 0xD0 +#define OP_CALL0 0xE0 +#define OP_CALL1 0xF0 + +#define MASK_CONFIG 0x0F +#define CONFIG_INPUT 0x00 +#define CONFIG_INPUT_PULLUP 0x01 +#define CONFIG_OUTPUT 0x02 +#define CONFIG_OUTPUT_PWM 0x03 + +#define MASK_DIGITAL_ADDR 0x0F +#define MASK_DIGITAL_WRITE 0x10 +#define MASK_ANALOG_W 0x08 +#define MASK_ANALOG_ADDR 0x07 +#define MASK_CALL 0x1F + +unsigned int rxByte = 0; +unsigned int rxOp = 0; +char rxbuffer[128]; +int rxbufferindex = 0; + +char* function00(char* buf) { return buf; } +char* function01(char* buf) { return buf; } +char* function02(char* buf) { return buf; } +char* function03(char* buf) { return buf; } +char* function04(char* buf) { return buf; } +char* function05(char* buf) { return buf; } +char* function06(char* buf) { return buf; } +char* function07(char* buf) { return buf; } +char* function08(char* buf) { return buf; } +char* function09(char* buf) { return buf; } +char* function0A(char* buf) { return buf; } +char* function0B(char* buf) { return buf; } +char* function0C(char* buf) { return buf; } +char* function0D(char* buf) { return buf; } +char* function0E(char* buf) { return buf; } +char* function0F(char* buf) { return buf; } + +char* function10(char* buf) { return buf; } +char* function11(char* buf) { return buf; } +char* function12(char* buf) { return buf; } +char* function13(char* buf) { return buf; } +char* function14(char* buf) { return buf; } +char* function15(char* buf) { return buf; } +char* function16(char* buf) { return buf; } +char* function17(char* buf) { return buf; } +char* function18(char* buf) { return buf; } +char* function19(char* buf) { return buf; } +char* function1A(char* buf) { return buf; } +char* function1B(char* buf) { return buf; } +char* function1C(char* buf) { return buf; } +char* function1D(char* buf) { return buf; } +char* function1E(char* buf) { return buf; } + + +void setup() { + // put your setup code here, to run once: + Serial.begin(BAUD_RATE); + Serial.print("Impeeduino Version: "); + Serial.println(VERSION); + Serial.flush(); +} + +void loop() { + if (Serial.available()) { + // get the new byte: + + rxByte = (char)Serial.read(); + if (rxByte & 0x80) { + // Not ASCII text, attempt to decode opcode + rxOp = rxByte & MASK_OP; + if (rxOp == OP_DIGITAL_READ) { + if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { + //Serial.println("Digital HIGH"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); + } else { + //Serial.println("Digital LOW"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); + } + } else if (rxOp == OP_DIGITAL_WRITE_0) { + //Serial.println("Writing LOW"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); + delay(DELAY_WRITE); + } else if (rxOp == OP_DIGITAL_WRITE_1) { + //Serial.println("Writing HIGH"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); + delay(DELAY_WRITE); + } else if (rxOp == OP_ANALOG) { + if (rxByte & MASK_ANALOG_W) { + analogWrite(rxByte & MASK_ANALOG_ADDR, Serial.read()); + } else { + analogRead(rxByte & MASK_ANALOG_ADDR); + // return 10 bit val, TBD + } + + } else if (rxOp == OP_CONFIGURE) { + switch (Serial.read() & MASK_CONFIG) { + case CONFIG_INPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); + break; + case CONFIG_INPUT_PULLUP: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); + break; + case CONFIG_OUTPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); + break; + } + } else if (rxOp == OP_ARB) { + + } else { + // Call Function Op: 10X + rxbuffer[rxbufferindex] = '\0'; + switch (rxByte & MASK_CALL) { + case 0x00: Serial.write(function00(rxbuffer)); break; + case 0x01: Serial.write(function01(rxbuffer)); break; + case 0x02: Serial.write(function02(rxbuffer)); break; + case 0x03: Serial.write(function03(rxbuffer)); break; + case 0x04: Serial.write(function04(rxbuffer)); break; + case 0x05: Serial.write(function05(rxbuffer)); break; + case 0x06: Serial.write(function06(rxbuffer)); break; + case 0x07: Serial.write(function07(rxbuffer)); break; + case 0x08: Serial.write(function08(rxbuffer)); break; + case 0x09: Serial.write(function09(rxbuffer)); break; + case 0x0A: Serial.write(function0A(rxbuffer)); break; + case 0x0B: Serial.write(function0B(rxbuffer)); break; + case 0x0C: Serial.write(function0C(rxbuffer)); break; + case 0x0D: Serial.write(function0D(rxbuffer)); break; + case 0x0E: Serial.write(function0E(rxbuffer)); break; + case 0x0F: Serial.write(function0F(rxbuffer)); break; + + case 0x10: Serial.write(function10(rxbuffer)); break; + case 0x11: Serial.write(function11(rxbuffer)); break; + case 0x12: Serial.write(function12(rxbuffer)); break; + case 0x13: Serial.write(function13(rxbuffer)); break; + case 0x14: Serial.write(function14(rxbuffer)); break; + case 0x15: Serial.write(function15(rxbuffer)); break; + case 0x16: Serial.write(function16(rxbuffer)); break; + case 0x17: Serial.write(function17(rxbuffer)); break; + case 0x18: Serial.write(function18(rxbuffer)); break; + case 0x19: Serial.write(function19(rxbuffer)); break; + case 0x1A: Serial.write(function1A(rxbuffer)); break; + case 0x1B: Serial.write(function1B(rxbuffer)); break; + case 0x1C: Serial.write(function1C(rxbuffer)); break; + case 0x1D: Serial.write(function1D(rxbuffer)); break; + case 0x1E: Serial.write(function1E(rxbuffer)); break; + } + Serial.write(rxByte); + Serial.flush(); + rxbufferindex = 0; + } + } else { + // Received ASCII text, insert into rxbuffer + rxbuffer[rxbufferindex] = char(rxByte); + rxbufferindex++; + } + } } diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index c655f2a..20d5505 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -1,6 +1,6 @@ class Impeeduino { - static version = [0, 0, 0] + static version = [0, 0, 1] static BAUD_RATE = 115200; @@ -9,8 +9,10 @@ class Impeeduino { static OP_DIGITAL_READ = 0x90; static OP_DIGITAL_WRITE_0 = 0xA0; static OP_DIGITAL_WRITE_1 = 0xB0; - static OP_ANALOG = 0xE0; - static OP_ARB = 0xF0; + static OP_ANALOG 0xC0; + static OP_ARB 0xD0; + static OP_CALL0 0xE0; + static OP_CALL1 0xF0; static MASK_CONFIG = 0x0F; static CONFIG_INPUT = 0x00; From f8a5b9c349eff19b3ebaee0e163090ec26254630 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 16:40:42 -0400 Subject: [PATCH 06/34] Edit analog ops descriptions, drew out corresponding arb data bytes --- hardware/impeeduino/SerialComms.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hardware/impeeduino/SerialComms.txt b/hardware/impeeduino/SerialComms.txt index 50b20cc..2ac00c8 100644 --- a/hardware/impeeduino/SerialComms.txt +++ b/hardware/impeeduino/SerialComms.txt @@ -26,9 +26,10 @@ Instruction format: 1[op (3b)][addr (4b)] pin 11: 5 (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle - - Full instruction is 1100[W/~R][addr (3b), 1101[MSB (4b)], 1101[LSB (4b)] + - Full instruction is 1100 1[addr (3b)], 1101[MSB (4b)], 1101[LSB (4b)] - (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and + (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes + - 1100 0[addr (3b)], 1101 00[ADC(9:8)], 1101 [ADC(7:4)], 1101 [ADC(3:0)] 101 (0xD0) Arb data/Reserved From 67e616365502d381e54eecdc4afb1c64dd19d4ed Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 21:52:12 -0400 Subject: [PATCH 07/34] Implement analogRead and analogWrite --- hardware/impeeduino/SerialComms.txt | 8 +++++--- .../arduino/impeeduino/impeeduino.ino | 18 +++++++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/hardware/impeeduino/SerialComms.txt b/hardware/impeeduino/SerialComms.txt index 2ac00c8..4132c1c 100644 --- a/hardware/impeeduino/SerialComms.txt +++ b/hardware/impeeduino/SerialComms.txt @@ -26,10 +26,12 @@ Instruction format: 1[op (3b)][addr (4b)] pin 11: 5 (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle - - Full instruction is 1100 1[addr (3b)], 1101[MSB (4b)], 1101[LSB (4b)] + - Full instruction is 1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)] - (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes - - 1100 0[addr (3b)], 1101 00[ADC(9:8)], 1101 [ADC(7:4)], 1101 [ADC(3:0)] + (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes. + - 1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)] + + Note imp is little-endian. 101 (0xD0) Arb data/Reserved diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 6578baa..fa552d2 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -98,10 +98,22 @@ void loop() { delay(DELAY_WRITE); } else if (rxOp == OP_ANALOG) { if (rxByte & MASK_ANALOG_W) { - analogWrite(rxByte & MASK_ANALOG_ADDR, Serial.read()); + int addr = rxByte & MASK_ANALOG_ADDR; + // Lowest order bits (3-0) + int value = Serial.read() & 0x0F; + // Higest order bits (7-4) + value = value | ((Serial.read() & 0x0F) << 4); + + analogWrite(addr, value); } else { - analogRead(rxByte & MASK_ANALOG_ADDR); - // return 10 bit val, TBD + Serial.write(rxByte); + int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); + // Lowest order bits (3-0) + Serial.write(OP_ARB | (analogvalue & 0x0F)); + // Middle bits (7-4) + Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); + // Highest order bits (9-8) + Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); } } else if (rxOp == OP_CONFIGURE) { From a3ccc29be258cb829770f49666ab3b43ad48c7d1 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 22:09:41 -0400 Subject: [PATCH 08/34] Fix analogWrite to properly wait for data bytes --- .../arduino/impeeduino/impeeduino.ino | 360 +++++++++--------- 1 file changed, 181 insertions(+), 179 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index fa552d2..522d999 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,180 +1,182 @@ -#define VERSION "0.0.1" - -#define BAUD_RATE 115200 -#define DELAY_WRITE 50 - -#define MASK_OP 0xF0 -#define OP_CONFIGURE 0x80 -#define OP_DIGITAL_READ 0x90 -#define OP_DIGITAL_WRITE_0 0xA0 -#define OP_DIGITAL_WRITE_1 0xB0 -#define OP_ANALOG 0xC0 -#define OP_ARB 0xD0 -#define OP_CALL0 0xE0 -#define OP_CALL1 0xF0 - -#define MASK_CONFIG 0x0F -#define CONFIG_INPUT 0x00 -#define CONFIG_INPUT_PULLUP 0x01 -#define CONFIG_OUTPUT 0x02 -#define CONFIG_OUTPUT_PWM 0x03 - -#define MASK_DIGITAL_ADDR 0x0F -#define MASK_DIGITAL_WRITE 0x10 -#define MASK_ANALOG_W 0x08 -#define MASK_ANALOG_ADDR 0x07 -#define MASK_CALL 0x1F - -unsigned int rxByte = 0; -unsigned int rxOp = 0; -char rxbuffer[128]; -int rxbufferindex = 0; - -char* function00(char* buf) { return buf; } -char* function01(char* buf) { return buf; } -char* function02(char* buf) { return buf; } -char* function03(char* buf) { return buf; } -char* function04(char* buf) { return buf; } -char* function05(char* buf) { return buf; } -char* function06(char* buf) { return buf; } -char* function07(char* buf) { return buf; } -char* function08(char* buf) { return buf; } -char* function09(char* buf) { return buf; } -char* function0A(char* buf) { return buf; } -char* function0B(char* buf) { return buf; } -char* function0C(char* buf) { return buf; } -char* function0D(char* buf) { return buf; } -char* function0E(char* buf) { return buf; } -char* function0F(char* buf) { return buf; } - -char* function10(char* buf) { return buf; } -char* function11(char* buf) { return buf; } -char* function12(char* buf) { return buf; } -char* function13(char* buf) { return buf; } -char* function14(char* buf) { return buf; } -char* function15(char* buf) { return buf; } -char* function16(char* buf) { return buf; } -char* function17(char* buf) { return buf; } -char* function18(char* buf) { return buf; } -char* function19(char* buf) { return buf; } -char* function1A(char* buf) { return buf; } -char* function1B(char* buf) { return buf; } -char* function1C(char* buf) { return buf; } -char* function1D(char* buf) { return buf; } -char* function1E(char* buf) { return buf; } - - -void setup() { - // put your setup code here, to run once: - Serial.begin(BAUD_RATE); - Serial.print("Impeeduino Version: "); - Serial.println(VERSION); - Serial.flush(); -} - -void loop() { - if (Serial.available()) { - // get the new byte: - - rxByte = (char)Serial.read(); - if (rxByte & 0x80) { - // Not ASCII text, attempt to decode opcode - rxOp = rxByte & MASK_OP; - if (rxOp == OP_DIGITAL_READ) { - if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { - //Serial.println("Digital HIGH"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); - } else { - //Serial.println("Digital LOW"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); - } - } else if (rxOp == OP_DIGITAL_WRITE_0) { - //Serial.println("Writing LOW"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); - delay(DELAY_WRITE); - } else if (rxOp == OP_DIGITAL_WRITE_1) { - //Serial.println("Writing HIGH"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); - delay(DELAY_WRITE); - } else if (rxOp == OP_ANALOG) { - if (rxByte & MASK_ANALOG_W) { - int addr = rxByte & MASK_ANALOG_ADDR; - // Lowest order bits (3-0) - int value = Serial.read() & 0x0F; - // Higest order bits (7-4) - value = value | ((Serial.read() & 0x0F) << 4); - - analogWrite(addr, value); - } else { - Serial.write(rxByte); - int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); - // Lowest order bits (3-0) - Serial.write(OP_ARB | (analogvalue & 0x0F)); - // Middle bits (7-4) - Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); - // Highest order bits (9-8) - Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); - } - - } else if (rxOp == OP_CONFIGURE) { - switch (Serial.read() & MASK_CONFIG) { - case CONFIG_INPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); - break; - case CONFIG_INPUT_PULLUP: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); - break; - case CONFIG_OUTPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); - break; - } - } else if (rxOp == OP_ARB) { - - } else { - // Call Function Op: 10X - rxbuffer[rxbufferindex] = '\0'; - switch (rxByte & MASK_CALL) { - case 0x00: Serial.write(function00(rxbuffer)); break; - case 0x01: Serial.write(function01(rxbuffer)); break; - case 0x02: Serial.write(function02(rxbuffer)); break; - case 0x03: Serial.write(function03(rxbuffer)); break; - case 0x04: Serial.write(function04(rxbuffer)); break; - case 0x05: Serial.write(function05(rxbuffer)); break; - case 0x06: Serial.write(function06(rxbuffer)); break; - case 0x07: Serial.write(function07(rxbuffer)); break; - case 0x08: Serial.write(function08(rxbuffer)); break; - case 0x09: Serial.write(function09(rxbuffer)); break; - case 0x0A: Serial.write(function0A(rxbuffer)); break; - case 0x0B: Serial.write(function0B(rxbuffer)); break; - case 0x0C: Serial.write(function0C(rxbuffer)); break; - case 0x0D: Serial.write(function0D(rxbuffer)); break; - case 0x0E: Serial.write(function0E(rxbuffer)); break; - case 0x0F: Serial.write(function0F(rxbuffer)); break; - - case 0x10: Serial.write(function10(rxbuffer)); break; - case 0x11: Serial.write(function11(rxbuffer)); break; - case 0x12: Serial.write(function12(rxbuffer)); break; - case 0x13: Serial.write(function13(rxbuffer)); break; - case 0x14: Serial.write(function14(rxbuffer)); break; - case 0x15: Serial.write(function15(rxbuffer)); break; - case 0x16: Serial.write(function16(rxbuffer)); break; - case 0x17: Serial.write(function17(rxbuffer)); break; - case 0x18: Serial.write(function18(rxbuffer)); break; - case 0x19: Serial.write(function19(rxbuffer)); break; - case 0x1A: Serial.write(function1A(rxbuffer)); break; - case 0x1B: Serial.write(function1B(rxbuffer)); break; - case 0x1C: Serial.write(function1C(rxbuffer)); break; - case 0x1D: Serial.write(function1D(rxbuffer)); break; - case 0x1E: Serial.write(function1E(rxbuffer)); break; - } - Serial.write(rxByte); - Serial.flush(); - rxbufferindex = 0; - } - } else { - // Received ASCII text, insert into rxbuffer - rxbuffer[rxbufferindex] = char(rxByte); - rxbufferindex++; - } - } +#define VERSION "0.0.1" + +#define BAUD_RATE 115200 +#define DELAY_WRITE 50 + +#define MASK_OP 0xF0 +#define OP_CONFIGURE 0x80 +#define OP_DIGITAL_READ 0x90 +#define OP_DIGITAL_WRITE_0 0xA0 +#define OP_DIGITAL_WRITE_1 0xB0 +#define OP_ANALOG 0xC0 +#define OP_ARB 0xD0 +#define OP_CALL0 0xE0 +#define OP_CALL1 0xF0 + +#define MASK_CONFIG 0x0F +#define CONFIG_INPUT 0x00 +#define CONFIG_INPUT_PULLUP 0x01 +#define CONFIG_OUTPUT 0x02 +#define CONFIG_OUTPUT_PWM 0x03 + +#define MASK_DIGITAL_ADDR 0x0F +#define MASK_DIGITAL_WRITE 0x10 +#define MASK_ANALOG_W 0x08 +#define MASK_ANALOG_ADDR 0x07 +#define MASK_CALL 0x1F + +unsigned int rxByte = 0; +unsigned int rxOp = 0; +char rxbuffer[128]; +int rxbufferindex = 0; + +char* function00(char* buf) { return buf; } +char* function01(char* buf) { return buf; } +char* function02(char* buf) { return buf; } +char* function03(char* buf) { return buf; } +char* function04(char* buf) { return buf; } +char* function05(char* buf) { return buf; } +char* function06(char* buf) { return buf; } +char* function07(char* buf) { return buf; } +char* function08(char* buf) { return buf; } +char* function09(char* buf) { return buf; } +char* function0A(char* buf) { return buf; } +char* function0B(char* buf) { return buf; } +char* function0C(char* buf) { return buf; } +char* function0D(char* buf) { return buf; } +char* function0E(char* buf) { return buf; } +char* function0F(char* buf) { return buf; } + +char* function10(char* buf) { return buf; } +char* function11(char* buf) { return buf; } +char* function12(char* buf) { return buf; } +char* function13(char* buf) { return buf; } +char* function14(char* buf) { return buf; } +char* function15(char* buf) { return buf; } +char* function16(char* buf) { return buf; } +char* function17(char* buf) { return buf; } +char* function18(char* buf) { return buf; } +char* function19(char* buf) { return buf; } +char* function1A(char* buf) { return buf; } +char* function1B(char* buf) { return buf; } +char* function1C(char* buf) { return buf; } +char* function1D(char* buf) { return buf; } +char* function1E(char* buf) { return buf; } + + +void setup() { + // put your setup code here, to run once: + Serial.begin(BAUD_RATE); + Serial.print("Impeeduino Version: "); + Serial.println(VERSION); + Serial.flush(); +} + +void loop() { + if (Serial.available()) { + // get the new byte: + + rxByte = (char)Serial.read(); + if (rxByte & 0x80) { + // Not ASCII text, attempt to decode opcode + rxOp = rxByte & MASK_OP; + if (rxOp == OP_DIGITAL_READ) { + if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { + //Serial.println("Digital HIGH"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); + } else { + //Serial.println("Digital LOW"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); + } + } else if (rxOp == OP_DIGITAL_WRITE_0) { + //Serial.println("Writing LOW"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); + delay(DELAY_WRITE); + } else if (rxOp == OP_DIGITAL_WRITE_1) { + //Serial.println("Writing HIGH"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); + delay(DELAY_WRITE); + } else if (rxOp == OP_ANALOG) { + if (rxByte & MASK_ANALOG_W) { + int addr = rxByte & MASK_ANALOG_ADDR; + // Wait for value bytes to arrive + while(Serial.available() < 2); + // Lowest order bits (3-0) + char value = Serial.read() & 0x0F; + // Higest order bits (7-4) + value = value | ((Serial.read() & 0x0F) << 4); + //Serial.write(value); + analogWrite(addr, value); + } else { + Serial.write(rxByte); + int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); + // Lowest order bits (3-0) + Serial.write(OP_ARB | (analogvalue & 0x0F)); + // Middle bits (7-4) + Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); + // Highest order bits (9-8) + Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); + } + + } else if (rxOp == OP_CONFIGURE) { + switch (Serial.read() & MASK_CONFIG) { + case CONFIG_INPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); + break; + case CONFIG_INPUT_PULLUP: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); + break; + case CONFIG_OUTPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); + break; + } + } else if (rxOp == OP_ARB) { + + } else { + // Call Function Op: 10X + rxbuffer[rxbufferindex] = '\0'; + switch (rxByte & MASK_CALL) { + case 0x00: Serial.write(function00(rxbuffer)); break; + case 0x01: Serial.write(function01(rxbuffer)); break; + case 0x02: Serial.write(function02(rxbuffer)); break; + case 0x03: Serial.write(function03(rxbuffer)); break; + case 0x04: Serial.write(function04(rxbuffer)); break; + case 0x05: Serial.write(function05(rxbuffer)); break; + case 0x06: Serial.write(function06(rxbuffer)); break; + case 0x07: Serial.write(function07(rxbuffer)); break; + case 0x08: Serial.write(function08(rxbuffer)); break; + case 0x09: Serial.write(function09(rxbuffer)); break; + case 0x0A: Serial.write(function0A(rxbuffer)); break; + case 0x0B: Serial.write(function0B(rxbuffer)); break; + case 0x0C: Serial.write(function0C(rxbuffer)); break; + case 0x0D: Serial.write(function0D(rxbuffer)); break; + case 0x0E: Serial.write(function0E(rxbuffer)); break; + case 0x0F: Serial.write(function0F(rxbuffer)); break; + + case 0x10: Serial.write(function10(rxbuffer)); break; + case 0x11: Serial.write(function11(rxbuffer)); break; + case 0x12: Serial.write(function12(rxbuffer)); break; + case 0x13: Serial.write(function13(rxbuffer)); break; + case 0x14: Serial.write(function14(rxbuffer)); break; + case 0x15: Serial.write(function15(rxbuffer)); break; + case 0x16: Serial.write(function16(rxbuffer)); break; + case 0x17: Serial.write(function17(rxbuffer)); break; + case 0x18: Serial.write(function18(rxbuffer)); break; + case 0x19: Serial.write(function19(rxbuffer)); break; + case 0x1A: Serial.write(function1A(rxbuffer)); break; + case 0x1B: Serial.write(function1B(rxbuffer)); break; + case 0x1C: Serial.write(function1C(rxbuffer)); break; + case 0x1D: Serial.write(function1D(rxbuffer)); break; + case 0x1E: Serial.write(function1E(rxbuffer)); break; + } + Serial.write(rxByte); + Serial.flush(); + rxbufferindex = 0; + } + } else { + // Received ASCII text, insert into rxbuffer + rxbuffer[rxbufferindex] = char(rxByte); + rxbufferindex++; + } + } } From aa75e0b8d584020cd19b70cbbccb477586565d65 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 22:20:52 -0400 Subject: [PATCH 09/34] Remap PWM pins to fit within address space --- hardware/impeeduino/arduino/impeeduino/impeeduino.ino | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 522d999..00f5556 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -25,6 +25,8 @@ #define MASK_ANALOG_ADDR 0x07 #define MASK_CALL 0x1F +const int PWM_PINMAP[6] = {3, 5, 6, 9, 10, 11}; + unsigned int rxByte = 0; unsigned int rxOp = 0; char rxbuffer[128]; @@ -106,7 +108,7 @@ void loop() { // Higest order bits (7-4) value = value | ((Serial.read() & 0x0F) << 4); //Serial.write(value); - analogWrite(addr, value); + analogWrite(PWM_PINMAP[addr], value); } else { Serial.write(rxByte); int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); From 4fa8770ef48366c97e4330166bffc6f25a4e8de0 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 23:17:21 -0400 Subject: [PATCH 10/34] Add web control example --- .../example/remotecontrol.agent.nut | 18 ++++++++++++++ .../example/remotecontrol.device.nut | 24 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 hardware/impeeduino/example/remotecontrol.agent.nut create mode 100644 hardware/impeeduino/example/remotecontrol.device.nut diff --git a/hardware/impeeduino/example/remotecontrol.agent.nut b/hardware/impeeduino/example/remotecontrol.agent.nut new file mode 100644 index 0000000..f450432 --- /dev/null +++ b/hardware/impeeduino/example/remotecontrol.agent.nut @@ -0,0 +1,18 @@ +function requestHandler(request, response) { + try { + if ("command" in request.query) { + local data = {}; + data.pin <- request.query.pin.tointeger(); + if ("val" in request.query) { + data.val <- request.query.val.tointeger(); + } + device.send(request.query.command, data); + } + response.send(200, "OK"); // "200: OK" is standard return message + } catch (ex) { + response.send(500, ("Agent Error: " + ex)); // Send 500 response if error occured + } +} + +// Register the callback function that will be triggered by incoming HTTP requests +http.onrequest(requestHandler); \ No newline at end of file diff --git a/hardware/impeeduino/example/remotecontrol.device.nut b/hardware/impeeduino/example/remotecontrol.device.nut new file mode 100644 index 0000000..69e7d6a --- /dev/null +++ b/hardware/impeeduino/example/remotecontrol.device.nut @@ -0,0 +1,24 @@ +activityLED <- hardware.pin2; +linkLED <- hardware.pin8; + +server.log("Starting... "); +impeeduino <- Impeeduino(); + +agent.on("config", function(data) { + server.log("Configuring pin " + data.pin); + impeeduino.pinMode(data.pin, data.val); +}); +agent.on("digitalWrite", function(data) { + server.log("Writing " + data.val + " to pin " + data.pin); + impeeduino.digitalWrite(data.pin, data.val); +}); +agent.on("analogWrite", function(data) { + server.log("PWM " + data.val + " to pin " + data.pin); + impeeduino.analogWrite(data.pin, data.val); +}); +agent.on("digitalRead", function(data) { + server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); +}); +agent.on("analogRead", function(data) { + server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); +}); \ No newline at end of file From 5820b129d01fd34b09361a90afcc4eb8ad086fb6 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 5 Nov 2016 23:17:44 -0400 Subject: [PATCH 11/34] Implement analogWrite in Imp code --- .../arduino/impeeduino/impeeduino.ino | 4 +- .../impeeduino/impeeduino.ino.standard.hex | 281 +++++++++--------- ...mpeeduino.ino.with_bootloader.standard.hex | 281 +++++++++--------- hardware/impeeduino/impeeduino.class.nut | 133 ++++++--- 4 files changed, 378 insertions(+), 321 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 00f5556..8046cb7 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,4 +1,4 @@ -#define VERSION "0.0.1" +#define VERSION "0.0.2" #define BAUD_RATE 115200 #define DELAY_WRITE 50 @@ -181,4 +181,4 @@ void loop() { rxbufferindex++; } } -} +} diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex index 9bdc7eb..4445fa5 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C94FF020C94A9000C94CD020C94A7020E +:100040000C9404030C94A9000C94D2020C94AC02FE :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A900CD04CD04CD04CD04BA -:10007000CD04CD04CD04CD04CD04CD04CD04CD04F8 -:10008000CD04CD04CD04CD04CD04CD04CD04CD04E8 -:10009000CD04CD04CD04CD04CD04CD04CD04CD04D8 -:1000A000CD04CD04CD0400000000240027002A0068 +:100060000C94A9000C94A9000A050A050A050A05C2 +:100070000A050A050A050A050A050A050A050A0508 +:100080000A050A050A050A050A050A050A050A05F8 +:100090000A050A050A050A050A050A050A050A05E8 +:1000A0000A050A050A0500000000240027002A00AE :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:10010000FC0411241FBECFEFD8E0DEBFCDBF11E04D -:10011000A0E0B1E0ECE6FAE002C005900D92AE324C -:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 +:10010000370511241FBECFEFD8E0DEBFCDBF11E011 +:10011000A0E0B1E0E2EEFAE002C005900D92AA3351 +:10012000B107D9F722E0AAE3B1E001C01D92A636DB :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E942905C038D107C9F70E9449030C94C1 -:1001500034050C940000CF92DF92EF92FF920F9340 +:100140000E946405C038D107C9F70E944E030C9481 +:100150006F050C940000CF92DF92EF92FF920F9305 :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958DEB91E00E94F80072 +:1002000091098F739927089589EC91E00E94F80075 :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -44,128 +44,137 @@ :1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B :1002C000EA89FB898081806207C0EE89FF896083AB :1002D000E889F98980818064808381E090E0DF9102 -:1002E000CF911F910F91FF90EF900895CF93DF93DF -:1002F000EC01888D8823C9F0EA89FB89808185FD1E -:1003000005C0A889B9898C9186FD0FC00FB607FC7E -:10031000F5CF808185FFF2CFA889B9898C9185FFBF -:10032000EDCFCE010E940E01E7CFDF91CF9108956E -:1003300080E090E0892B29F00E94040181110C9447 -:1003400000000895833081F028F4813099F08230E4 -:10035000A1F008958730A9F08830B9F08430D1F445 -:10036000809180008F7D03C0809180008F77809383 -:100370008000089584B58F7702C084B58F7D84BDD9 -:1003800008958091B0008F7703C08091B0008F7D79 -:100390008093B00008951F93CF93DF93282F30E010 -:1003A000F901E451FF4F8491F901E852FF4FD491D4 -:1003B000F901EC53FF4FC491CC23C9F0162F8111E2 -:1003C0000E94A201EC2FF0E0EE0FFF1FE055FF4F5F -:1003D000A591B4918FB7F894111105C09C91ED2FA0 -:1003E000E095E92302C0EC91ED2BEC938FBFDF91F8 -:1003F000CF911F910895CF93DF9390E0FC01E852D5 -:10040000FF4F2491FC01EC53FF4F8491882361F14D -:1004100090E0880F991FFC01EA55FF4FC591D491D8 -:10042000FC01E055FF4FA591B491611109C09FB740 -:10043000F8948881209582238883EC912E230BC029 -:10044000623061F49FB7F8943881822F80958323BE -:100450008883EC912E2B2C939FBF06C08FB7F89406 -:10046000E8812E2B28838FBFDF91CF9108953FB76E -:10047000F8948091330190913401A0913501B091AD -:10048000360126B5A89B05C02F3F19F00196A11D86 -:10049000B11D3FBFBA2FA92F982F8827820F911D1A -:1004A000A11DB11DBC01CD0142E0660F771F881F61 -:1004B000991F4A95D1F708958F929F92AF92BF925C -:1004C000CF92DF92EF92FF920E9437024B015C01C4 -:1004D00082E3C82ED12CE12CF12C0E943702DC01E2 -:1004E000CB0188199909AA09BB09883E9340A10547 -:1004F000B10558F021E0C21AD108E108F10888EEF0 -:10050000880E83E0981EA11CB11CC114D104E10423 -:10051000F10419F7FF90EF90DF90CF90BF90AF906C -:100520009F908F900895009769F0FC010190002042 -:10053000E9F73197AF01481B590BBC018DEB91E0F6 -:100540000C94AB0080E090E008950E942F051F926C -:100550000F920FB60F9211242F933F934F935F93F7 -:100560006F937F938F939F93AF93BF93EF93FF937B -:100570008DEB91E00E940E01FF91EF91BF91AF9141 -:100580009F918F917F916F915F914F913F912F91AB -:100590000F900FBE0F901F9018951F920F920FB6DD -:1005A0000F9211242F938F939F93EF93FF93E091DA -:1005B000CD01F091CE018081E091D301F091D40181 -:1005C00082FD12C090818091D6018F5F8F73209140 -:1005D000D701821751F0E091D601F0E0E354FE4FCD -:1005E000958F8093D60101C08081FF91EF919F91FB -:1005F0008F912F910F900FBE0F901F9018951F9203 -:100600000F920FB60F9211242F933F938F939F93C6 -:10061000AF93BF9380912F0190913001A091310150 -:10062000B091320130912E0123E0230F2D3720F4B9 -:100630000196A11DB11D05C026E8230F0296A11D3C -:10064000B11D20932E0180932F0190933001A09330 -:100650003101B09332018091330190913401A09126 -:100660003501B09136010196A11DB11D8093330172 -:1006700090933401A0933501B0933601BF91AF91AF -:100680009F918F913F912F910F900FBE0F901F90D0 -:100690001895789484B5826084BD84B5816084BDEA -:1006A00085B5826085BD85B5816085BD80916E0010 -:1006B000816080936E001092810080918100826041 -:1006C000809381008091810081608093810080917E -:1006D00080008160809380008091B100846080936D -:1006E000B1008091B00081608093B00080917A0069 -:1006F000846080937A0080917A00826080937A008F -:1007000080917A00816080937A0080917A0080687D -:1007100080937A001092C100E091CD01F091CE015A -:1007200082E08083E091C901F091CA011082E091DA -:10073000CB01F091CC0180E180831092D501E09152 -:10074000D101F091D20186E08083E091CF01F09158 -:10075000D001808180618083E091CF01F091D00150 -:10076000808188608083E091CF01F091D001808109 -:1007700080688083E091CF01F091D00180818F7DEE -:10078000808380E191E00E94930285E291E00E94E3 -:1007900093028BE291E00E9493028DEB91E00E9424 -:1007A00076018DEB91E00E94F800892B09F413C1CA -:1007B0008DEB91E00E94D600C82F082E000C990BFB -:1007C0009093BC018093BB0187FFF8C0807F99277D -:1007D0009093BA018093B9018039910519F51C2FC6 -:1007E0001F70212F30E0F901E451FF4F8491F9018E -:1007F000E852FF4FD491F901EC53FF4FC491CC2341 -:1008000009F4ECC081110E94A201EC2FF0E0EE0F80 -:10081000FF1FE654FF4FA591B491EC91ED2309F42D -:10082000DDC0E1C0803A910511F460E004C0803B76 -:10083000910541F461E08C2F8F700E94CB010E94E2 -:100840005C02C9C0803E910509F070C0DC2FD770F2 -:10085000C3FF5BC08DEB91E00E94D6008C0161E08C -:100860008D2F0E94FB010115110509F44CC00F3FAB -:10087000110529F461E08D2F0E94CB01ACC0ED2F52 -:10088000F0E0E451FF4FE491E330F9F048F4E13057 -:10089000B9F0E230A1F584B5806284BD08BD9BC08B -:1008A000E730E9F0E83019F1E43049F58091800053 -:1008B00080628093800010938B0000938A008BC02D -:1008C00084B5806884BD07BD86C080918000806843 -:1008D0008093800010938900009388007CC08091F1 -:1008E000B00080688093B0000093B30074C0809122 -:1008F000B00080628093B0000093B4006CC00038F8 -:1009000011050CF0B7CF60E0B6CFD064D0937C0077 -:1009100080917A00806480937A0080917A0086FDCD -:10092000FCCF809178008091790055C08038910586 -:10093000C9F48DEB91E00E94D6008F709927813029 -:10094000910541F08230910539F0892B09F043C0BF -:1009500060E003C062E001C061E08C2F8F700E94F4 -:10096000FB0139C0803F9105B1F1E091B701F091F1 -:10097000B801E95CFE4F1082EC2FEF710E2E000CD7 -:10098000FF0B3197EF31F10530F4EC5CFF4F87E35B -:1009900091E00C94290587E391E00E949302609115 -:1009A000BB018DEB91E00E942F018DEB91E00E9445 -:1009B00076011092B8011092B7010DC08091B70175 -:1009C0009091B801FC01E95CFE4FC08301969093C1 -:1009D000B8018093B7010E949801E3CE612F110FF7 -:1009E000770B606A04C0612F110F770B606B8DEB82 -:1009F00091E00E942F01EFCFEDEBF1E01382128224 -:100A000088EE93E0A0E0B0E084839583A683B7836B -:100A100084E091E09183808385EC90E095878487E2 -:100A200084EC90E09787868780EC90E0918B808BB8 -:100A300081EC90E0938B828B82EC90E0958B848BA1 -:100A400086EC90E0978B868B118E128E138E148E0F -:100A50000895EE0FFF1F0590F491E02D099481E0B9 -:0C0A600090E0F8940C943405F894FFCF5B -:100A6C00000000002F01AB00F800D600EA00760170 -:100A7C00496D7065656475696E6F20566572736932 -:0E0A8C006F6E3A2000302E302E30000D0A0022 +:1002E000CF911F910F91FF90EF900895682F89ECA7 +:1002F00091E00C942F01CF93DF93EC01888D88233C +:10030000C9F0EA89FB89808185FD05C0A889B98982 +:100310008C9186FD0FC00FB607FCF5CF808185FF5D +:10032000F2CFA889B9898C9185FFEDCFCE010E94CB +:100330000E01E7CFDF91CF91089580E090E0892B07 +:1003400029F00E94040181110C940000089583306B +:1003500081F028F4813099F08230A1F0089587303F +:10036000A9F08830B9F08430D1F4809180008F7D7D +:1003700003C0809180008F7780938000089584B5BA +:100380008F7702C084B58F7D84BD08958091B000C1 +:100390008F7703C08091B0008F7D8093B000089567 +:1003A0001F93CF93DF93282F30E0F901E451FF4FE3 +:1003B0008491F901E852FF4FD491F901EC53FF4FBA +:1003C000C491CC23C9F0162F81110E94A701EC2FF4 +:1003D000F0E0EE0FFF1FE055FF4FA591B4918FB7EE +:1003E000F894111105C09C91ED2FE095E92302C00E +:1003F000EC91ED2BEC938FBFDF91CF911F9108957E +:10040000CF93DF9390E0FC01E852FF4F2491FC0171 +:10041000EC53FF4F8491882361F190E0880F991F7E +:10042000FC01EA55FF4FC591D491FC01E055FF4F07 +:10043000A591B491611109C09FB7F8948881209566 +:1004400082238883EC912E230BC0623061F49FB726 +:10045000F8943881822F809583238883EC912E2B0A +:100460002C939FBF06C08FB7F894E8812E2B28836A +:100470008FBFDF91CF9108953FB7F89480913F01EE +:1004800090914001A0914101B091420126B5A89BF5 +:1004900005C02F3F19F00196A11DB11D3FBFBA2F16 +:1004A000A92F982F8827820F911DA11DB11DBC0176 +:1004B000CD0142E0660F771F881F991F4A95D1F73B +:1004C00008958F929F92AF92BF92CF92DF92EF9258 +:1004D000FF920E943C024B015C0182E3C82ED12CAA +:1004E000E12CF12C0E943C02DC01CB018819990916 +:1004F000AA09BB09883E9340A105B10558F021E047 +:10050000C21AD108E108F10888EE880E83E0981E2F +:10051000A11CB11CC114D104E104F10419F7FF902E +:10052000EF90DF90CF90BF90AF909F908F90089505 +:10053000009769F0FC0101900020E9F73197AF01C5 +:10054000481B590BBC0189EC91E00C94AB0080E096 +:1005500090E008950E946A051F920F920FB60F92C5 +:1005600011242F933F934F935F936F937F938F93B8 +:100570009F93AF93BF93EF93FF9389EC91E00E9419 +:100580000E01FF91EF91BF91AF919F918F917F915C +:100590006F915F914F913F912F910F900FBE0F90F0 +:1005A0001F9018951F920F920FB60F9211242F9340 +:1005B0008F939F93EF93FF93E091D901F091DA012C +:1005C0008081E091DF01F091E00182FD12C0908115 +:1005D0008091E2018F5F8F732091E301821751F0C8 +:1005E000E091E201F0E0E753FE4F958F8093E20146 +:1005F00001C08081FF91EF919F918F912F910F907A +:100600000FBE0F901F9018951F920F920FB60F926A +:1006100011242F933F938F939F93AF93BF93809118 +:100620003B0190913C01A0913D01B0913E01309180 +:100630003A0123E0230F2D3720F40196A11DB11DAF +:1006400005C026E8230F0296A11DB11D20933A0193 +:1006500080933B0190933C01A0933D01B0933E01F8 +:1006600080913F0190914001A0914101B0914201E0 +:100670000196A11DB11D80933F0190934001A0936D +:100680004101B0934201BF91AF919F918F913F91F2 +:100690002F910F900FBE0F901F901895789484B5EE +:1006A000826084BD84B5816084BD85B5826085BD6E +:1006B00085B5816085BD80916E00816080936E00FC +:1006C00010928100809181008260809381008091EE +:1006D000810081608093810080918000816080939F +:1006E00080008091B10084608093B1008091B0005F +:1006F00081608093B00080917A00846080937A005A +:1007000080917A00826080937A0080917A00816083 +:1007100080937A0080917A00806880937A001092AA +:10072000C100E091D901F091DA0182E08083E0918B +:10073000D501F091D6011082E091D701F091D80156 +:1007400080E180831092E101E091DD01F091DE0112 +:1007500086E08083E091DB01F091DC0180818061A3 +:100760008083E091DB01F091DC01808188608083EF +:10077000E091DB01F091DC01808180688083E09171 +:10078000DB01F091DC0180818F7D80838CE191E041 +:100790000E94980281E391E00E94980287E391E031 +:1007A0000E94980289EC91E00E947B0189EC91E023 +:1007B0000E94F800892B09F44BC189EC91E00E945A +:1007C000D600C82F082E000C990B9093C801809377 +:1007D000C70187FF30C19C01207F33273093C601BA +:1007E0002093C5012039310511F5CF702C2F30E051 +:1007F000F901E451FF4F8491F901E852FF4F149140 +:10080000F901EC53FF4FD491DD2309F424C1811188 +:100810000E94A701ED2FF0E0EE0FFF1FE654FF4FFF +:10082000A591B491EC91E12309F415C119C1203AC5 +:10083000310511F460E004C0203B310541F461E072 +:100840008C2F8F700E94D0010E94610201C1203C58 +:10085000310509F0ABC00C2F0770C3FF72C0002E2A +:10086000000C110B89EC91E00E94F8000297D4F380 +:1008700089EC91E00E94D600C82FCF7089EC91E0FE +:100880000E94D60024E0880F991F2A95E1F7C82B13 +:10089000000F111FF801E05FFE4F0081118161E040 +:1008A000802F0E940002CC2309F446C0F801FF27E4 +:1008B000E451FF4FE491E33011F148F4E130D1F01D +:1008C000E230D1F584B5806284BDC8BDC1C0E730D7 +:1008D00019F1E83049F1E43079F5809180008062C7 +:1008E000809380000C2E000CDD0BD0938B00C09306 +:1008F0008A00AEC084B5806884BDC7BDA9C08091A0 +:1009000080008068809380000C2E000CDD0BD0935B +:100910008900C09388009CC08091B000806880935B +:10092000B000C093B30094C08091B0008062809307 +:10093000B000C093B4008CC060E0802F0E94D00152 +:1009400087C00E947601006400937C0080917A0049 +:10095000806480937A0080917A0086FDFCCFC091FC +:10096000780080917900D0E0D82BBE016F70772796 +:10097000606D89EC91E00E942F01BE0184E07595C5 +:1009800067958A95E1F76F707727606D89EC91E044 +:100990000E942F016D2F772767FD7A956F7077275B +:1009A000606D89EC91E00E942F0152C02038310522 +:1009B000C9F489EC91E00E94D6008F7099278130AC +:1009C000910541F08230910539F0892B09F040C042 +:1009D00060E003C062E001C061E08C2F8F700E9474 +:1009E000000236C0203D310599F1E091C301F0913C +:1009F000C401ED5BFE4F1082EC2FEF710E2E000C48 +:100A0000FF0BEF31F10540F4EC5CFF4F83E491E024 +:100A10000C9464050E9498028091C7019091C801CE +:100A20000E94760189EC91E00E947B011092C40142 +:100A30001092C3010DC08091C3019091C401FC01CB +:100A4000ED5BFE4FC08301969093C4018093C30178 +:100A50000E949D01ABCE8C2FCC0F990B806A04C0F5 +:100A60008C2FCC0F990B806B0E947601F1CFE9ECB3 +:100A7000F1E01382128288EE93E0A0E0B0E084837C +:100A80009583A683B78384E091E09183808385EC8E +:100A900090E09587848784EC90E09787868780EC48 +:100AA00090E0918B808B81EC90E0938B828B82EC39 +:100AB00090E0958B848B86EC90E0978B868B118EE3 +:100AC000128E138E148E0895EE0FFF1F0590F49171 +:100AD000E02D099481E090E0F8940C946F05F8946F +:020AE000FFCF46 +:100AE200000000002F01AB00F800D600EA007B01F5 +:100AF20003000500060009000A000B00496D70653D +:100B0200656475696E6F2056657273696F6E3A20FF +:0A0B120000302E302E32000D0A00D4 :00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex index 592285a..05ba621 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C94FF020C94A9000C94CD020C94A7020E +:100040000C9404030C94A9000C94D2020C94AC02FE :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A900CD04CD04CD04CD04BA -:10007000CD04CD04CD04CD04CD04CD04CD04CD04F8 -:10008000CD04CD04CD04CD04CD04CD04CD04CD04E8 -:10009000CD04CD04CD04CD04CD04CD04CD04CD04D8 -:1000A000CD04CD04CD0400000000240027002A0068 +:100060000C94A9000C94A9000A050A050A050A05C2 +:100070000A050A050A050A050A050A050A050A0508 +:100080000A050A050A050A050A050A050A050A05F8 +:100090000A050A050A050A050A050A050A050A05E8 +:1000A0000A050A050A0500000000240027002A00AE :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:10010000FC0411241FBECFEFD8E0DEBFCDBF11E04D -:10011000A0E0B1E0ECE6FAE002C005900D92AE324C -:10012000B107D9F722E0AEE2B1E001C01D92AA35D5 +:10010000370511241FBECFEFD8E0DEBFCDBF11E011 +:10011000A0E0B1E0E2EEFAE002C005900D92AA3351 +:10012000B107D9F722E0AAE3B1E001C01D92A636DB :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E942905C038D107C9F70E9449030C94C1 -:1001500034050C940000CF92DF92EF92FF920F9340 +:100140000E946405C038D107C9F70E944E030C9481 +:100150006F050C940000CF92DF92EF92FF920F9305 :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958DEB91E00E94F80072 +:1002000091098F739927089589EC91E00E94F80075 :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -44,130 +44,139 @@ :1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B :1002C000EA89FB898081806207C0EE89FF896083AB :1002D000E889F98980818064808381E090E0DF9102 -:1002E000CF911F910F91FF90EF900895CF93DF93DF -:1002F000EC01888D8823C9F0EA89FB89808185FD1E -:1003000005C0A889B9898C9186FD0FC00FB607FC7E -:10031000F5CF808185FFF2CFA889B9898C9185FFBF -:10032000EDCFCE010E940E01E7CFDF91CF9108956E -:1003300080E090E0892B29F00E94040181110C9447 -:1003400000000895833081F028F4813099F08230E4 -:10035000A1F008958730A9F08830B9F08430D1F445 -:10036000809180008F7D03C0809180008F77809383 -:100370008000089584B58F7702C084B58F7D84BDD9 -:1003800008958091B0008F7703C08091B0008F7D79 -:100390008093B00008951F93CF93DF93282F30E010 -:1003A000F901E451FF4F8491F901E852FF4FD491D4 -:1003B000F901EC53FF4FC491CC23C9F0162F8111E2 -:1003C0000E94A201EC2FF0E0EE0FFF1FE055FF4F5F -:1003D000A591B4918FB7F894111105C09C91ED2FA0 -:1003E000E095E92302C0EC91ED2BEC938FBFDF91F8 -:1003F000CF911F910895CF93DF9390E0FC01E852D5 -:10040000FF4F2491FC01EC53FF4F8491882361F14D -:1004100090E0880F991FFC01EA55FF4FC591D491D8 -:10042000FC01E055FF4FA591B491611109C09FB740 -:10043000F8948881209582238883EC912E230BC029 -:10044000623061F49FB7F8943881822F80958323BE -:100450008883EC912E2B2C939FBF06C08FB7F89406 -:10046000E8812E2B28838FBFDF91CF9108953FB76E -:10047000F8948091330190913401A0913501B091AD -:10048000360126B5A89B05C02F3F19F00196A11D86 -:10049000B11D3FBFBA2FA92F982F8827820F911D1A -:1004A000A11DB11DBC01CD0142E0660F771F881F61 -:1004B000991F4A95D1F708958F929F92AF92BF925C -:1004C000CF92DF92EF92FF920E9437024B015C01C4 -:1004D00082E3C82ED12CE12CF12C0E943702DC01E2 -:1004E000CB0188199909AA09BB09883E9340A10547 -:1004F000B10558F021E0C21AD108E108F10888EEF0 -:10050000880E83E0981EA11CB11CC114D104E10423 -:10051000F10419F7FF90EF90DF90CF90BF90AF906C -:100520009F908F900895009769F0FC010190002042 -:10053000E9F73197AF01481B590BBC018DEB91E0F6 -:100540000C94AB0080E090E008950E942F051F926C -:100550000F920FB60F9211242F933F934F935F93F7 -:100560006F937F938F939F93AF93BF93EF93FF937B -:100570008DEB91E00E940E01FF91EF91BF91AF9141 -:100580009F918F917F916F915F914F913F912F91AB -:100590000F900FBE0F901F9018951F920F920FB6DD -:1005A0000F9211242F938F939F93EF93FF93E091DA -:1005B000CD01F091CE018081E091D301F091D40181 -:1005C00082FD12C090818091D6018F5F8F73209140 -:1005D000D701821751F0E091D601F0E0E354FE4FCD -:1005E000958F8093D60101C08081FF91EF919F91FB -:1005F0008F912F910F900FBE0F901F9018951F9203 -:100600000F920FB60F9211242F933F938F939F93C6 -:10061000AF93BF9380912F0190913001A091310150 -:10062000B091320130912E0123E0230F2D3720F4B9 -:100630000196A11DB11D05C026E8230F0296A11D3C -:10064000B11D20932E0180932F0190933001A09330 -:100650003101B09332018091330190913401A09126 -:100660003501B09136010196A11DB11D8093330172 -:1006700090933401A0933501B0933601BF91AF91AF -:100680009F918F913F912F910F900FBE0F901F90D0 -:100690001895789484B5826084BD84B5816084BDEA -:1006A00085B5826085BD85B5816085BD80916E0010 -:1006B000816080936E001092810080918100826041 -:1006C000809381008091810081608093810080917E -:1006D00080008160809380008091B100846080936D -:1006E000B1008091B00081608093B00080917A0069 -:1006F000846080937A0080917A00826080937A008F -:1007000080917A00816080937A0080917A0080687D -:1007100080937A001092C100E091CD01F091CE015A -:1007200082E08083E091C901F091CA011082E091DA -:10073000CB01F091CC0180E180831092D501E09152 -:10074000D101F091D20186E08083E091CF01F09158 -:10075000D001808180618083E091CF01F091D00150 -:10076000808188608083E091CF01F091D001808109 -:1007700080688083E091CF01F091D00180818F7DEE -:10078000808380E191E00E94930285E291E00E94E3 -:1007900093028BE291E00E9493028DEB91E00E9424 -:1007A00076018DEB91E00E94F800892B09F413C1CA -:1007B0008DEB91E00E94D600C82F082E000C990BFB -:1007C0009093BC018093BB0187FFF8C0807F99277D -:1007D0009093BA018093B9018039910519F51C2FC6 -:1007E0001F70212F30E0F901E451FF4F8491F9018E -:1007F000E852FF4FD491F901EC53FF4FC491CC2341 -:1008000009F4ECC081110E94A201EC2FF0E0EE0F80 -:10081000FF1FE654FF4FA591B491EC91ED2309F42D -:10082000DDC0E1C0803A910511F460E004C0803B76 -:10083000910541F461E08C2F8F700E94CB010E94E2 -:100840005C02C9C0803E910509F070C0DC2FD770F2 -:10085000C3FF5BC08DEB91E00E94D6008C0161E08C -:100860008D2F0E94FB010115110509F44CC00F3FAB -:10087000110529F461E08D2F0E94CB01ACC0ED2F52 -:10088000F0E0E451FF4FE491E330F9F048F4E13057 -:10089000B9F0E230A1F584B5806284BD08BD9BC08B -:1008A000E730E9F0E83019F1E43049F58091800053 -:1008B00080628093800010938B0000938A008BC02D -:1008C00084B5806884BD07BD86C080918000806843 -:1008D0008093800010938900009388007CC08091F1 -:1008E000B00080688093B0000093B30074C0809122 -:1008F000B00080628093B0000093B4006CC00038F8 -:1009000011050CF0B7CF60E0B6CFD064D0937C0077 -:1009100080917A00806480937A0080917A0086FDCD -:10092000FCCF809178008091790055C08038910586 -:10093000C9F48DEB91E00E94D6008F709927813029 -:10094000910541F08230910539F0892B09F043C0BF -:1009500060E003C062E001C061E08C2F8F700E94F4 -:10096000FB0139C0803F9105B1F1E091B701F091F1 -:10097000B801E95CFE4F1082EC2FEF710E2E000CD7 -:10098000FF0B3197EF31F10530F4EC5CFF4F87E35B -:1009900091E00C94290587E391E00E949302609115 -:1009A000BB018DEB91E00E942F018DEB91E00E9445 -:1009B00076011092B8011092B7010DC08091B70175 -:1009C0009091B801FC01E95CFE4FC08301969093C1 -:1009D000B8018093B7010E949801E3CE612F110FF7 -:1009E000770B606A04C0612F110F770B606B8DEB82 -:1009F00091E00E942F01EFCFEDEBF1E01382128224 -:100A000088EE93E0A0E0B0E084839583A683B7836B -:100A100084E091E09183808385EC90E095878487E2 -:100A200084EC90E09787868780EC90E0918B808BB8 -:100A300081EC90E0938B828B82EC90E0958B848BA1 -:100A400086EC90E0978B868B118E128E138E148E0F -:100A50000895EE0FFF1F0590F491E02D099481E0B9 -:0C0A600090E0F8940C943405F894FFCF5B -:100A6C00000000002F01AB00F800D600EA00760170 -:100A7C00496D7065656475696E6F20566572736932 -:0E0A8C006F6E3A2000302E302E30000D0A0022 +:1002E000CF911F910F91FF90EF900895682F89ECA7 +:1002F00091E00C942F01CF93DF93EC01888D88233C +:10030000C9F0EA89FB89808185FD05C0A889B98982 +:100310008C9186FD0FC00FB607FCF5CF808185FF5D +:10032000F2CFA889B9898C9185FFEDCFCE010E94CB +:100330000E01E7CFDF91CF91089580E090E0892B07 +:1003400029F00E94040181110C940000089583306B +:1003500081F028F4813099F08230A1F0089587303F +:10036000A9F08830B9F08430D1F4809180008F7D7D +:1003700003C0809180008F7780938000089584B5BA +:100380008F7702C084B58F7D84BD08958091B000C1 +:100390008F7703C08091B0008F7D8093B000089567 +:1003A0001F93CF93DF93282F30E0F901E451FF4FE3 +:1003B0008491F901E852FF4FD491F901EC53FF4FBA +:1003C000C491CC23C9F0162F81110E94A701EC2FF4 +:1003D000F0E0EE0FFF1FE055FF4FA591B4918FB7EE +:1003E000F894111105C09C91ED2FE095E92302C00E +:1003F000EC91ED2BEC938FBFDF91CF911F9108957E +:10040000CF93DF9390E0FC01E852FF4F2491FC0171 +:10041000EC53FF4F8491882361F190E0880F991F7E +:10042000FC01EA55FF4FC591D491FC01E055FF4F07 +:10043000A591B491611109C09FB7F8948881209566 +:1004400082238883EC912E230BC0623061F49FB726 +:10045000F8943881822F809583238883EC912E2B0A +:100460002C939FBF06C08FB7F894E8812E2B28836A +:100470008FBFDF91CF9108953FB7F89480913F01EE +:1004800090914001A0914101B091420126B5A89BF5 +:1004900005C02F3F19F00196A11DB11D3FBFBA2F16 +:1004A000A92F982F8827820F911DA11DB11DBC0176 +:1004B000CD0142E0660F771F881F991F4A95D1F73B +:1004C00008958F929F92AF92BF92CF92DF92EF9258 +:1004D000FF920E943C024B015C0182E3C82ED12CAA +:1004E000E12CF12C0E943C02DC01CB018819990916 +:1004F000AA09BB09883E9340A105B10558F021E047 +:10050000C21AD108E108F10888EE880E83E0981E2F +:10051000A11CB11CC114D104E104F10419F7FF902E +:10052000EF90DF90CF90BF90AF909F908F90089505 +:10053000009769F0FC0101900020E9F73197AF01C5 +:10054000481B590BBC0189EC91E00C94AB0080E096 +:1005500090E008950E946A051F920F920FB60F92C5 +:1005600011242F933F934F935F936F937F938F93B8 +:100570009F93AF93BF93EF93FF9389EC91E00E9419 +:100580000E01FF91EF91BF91AF919F918F917F915C +:100590006F915F914F913F912F910F900FBE0F90F0 +:1005A0001F9018951F920F920FB60F9211242F9340 +:1005B0008F939F93EF93FF93E091D901F091DA012C +:1005C0008081E091DF01F091E00182FD12C0908115 +:1005D0008091E2018F5F8F732091E301821751F0C8 +:1005E000E091E201F0E0E753FE4F958F8093E20146 +:1005F00001C08081FF91EF919F918F912F910F907A +:100600000FBE0F901F9018951F920F920FB60F926A +:1006100011242F933F938F939F93AF93BF93809118 +:100620003B0190913C01A0913D01B0913E01309180 +:100630003A0123E0230F2D3720F40196A11DB11DAF +:1006400005C026E8230F0296A11DB11D20933A0193 +:1006500080933B0190933C01A0933D01B0933E01F8 +:1006600080913F0190914001A0914101B0914201E0 +:100670000196A11DB11D80933F0190934001A0936D +:100680004101B0934201BF91AF919F918F913F91F2 +:100690002F910F900FBE0F901F901895789484B5EE +:1006A000826084BD84B5816084BD85B5826085BD6E +:1006B00085B5816085BD80916E00816080936E00FC +:1006C00010928100809181008260809381008091EE +:1006D000810081608093810080918000816080939F +:1006E00080008091B10084608093B1008091B0005F +:1006F00081608093B00080917A00846080937A005A +:1007000080917A00826080937A0080917A00816083 +:1007100080937A0080917A00806880937A001092AA +:10072000C100E091D901F091DA0182E08083E0918B +:10073000D501F091D6011082E091D701F091D80156 +:1007400080E180831092E101E091DD01F091DE0112 +:1007500086E08083E091DB01F091DC0180818061A3 +:100760008083E091DB01F091DC01808188608083EF +:10077000E091DB01F091DC01808180688083E09171 +:10078000DB01F091DC0180818F7D80838CE191E041 +:100790000E94980281E391E00E94980287E391E031 +:1007A0000E94980289EC91E00E947B0189EC91E023 +:1007B0000E94F800892B09F44BC189EC91E00E945A +:1007C000D600C82F082E000C990B9093C801809377 +:1007D000C70187FF30C19C01207F33273093C601BA +:1007E0002093C5012039310511F5CF702C2F30E051 +:1007F000F901E451FF4F8491F901E852FF4F149140 +:10080000F901EC53FF4FD491DD2309F424C1811188 +:100810000E94A701ED2FF0E0EE0FFF1FE654FF4FFF +:10082000A591B491EC91E12309F415C119C1203AC5 +:10083000310511F460E004C0203B310541F461E072 +:100840008C2F8F700E94D0010E94610201C1203C58 +:10085000310509F0ABC00C2F0770C3FF72C0002E2A +:10086000000C110B89EC91E00E94F8000297D4F380 +:1008700089EC91E00E94D600C82FCF7089EC91E0FE +:100880000E94D60024E0880F991F2A95E1F7C82B13 +:10089000000F111FF801E05FFE4F0081118161E040 +:1008A000802F0E940002CC2309F446C0F801FF27E4 +:1008B000E451FF4FE491E33011F148F4E130D1F01D +:1008C000E230D1F584B5806284BDC8BDC1C0E730D7 +:1008D00019F1E83049F1E43079F5809180008062C7 +:1008E000809380000C2E000CDD0BD0938B00C09306 +:1008F0008A00AEC084B5806884BDC7BDA9C08091A0 +:1009000080008068809380000C2E000CDD0BD0935B +:100910008900C09388009CC08091B000806880935B +:10092000B000C093B30094C08091B0008062809307 +:10093000B000C093B4008CC060E0802F0E94D00152 +:1009400087C00E947601006400937C0080917A0049 +:10095000806480937A0080917A0086FDFCCFC091FC +:10096000780080917900D0E0D82BBE016F70772796 +:10097000606D89EC91E00E942F01BE0184E07595C5 +:1009800067958A95E1F76F707727606D89EC91E044 +:100990000E942F016D2F772767FD7A956F7077275B +:1009A000606D89EC91E00E942F0152C02038310522 +:1009B000C9F489EC91E00E94D6008F7099278130AC +:1009C000910541F08230910539F0892B09F040C042 +:1009D00060E003C062E001C061E08C2F8F700E9474 +:1009E000000236C0203D310599F1E091C301F0913C +:1009F000C401ED5BFE4F1082EC2FEF710E2E000C48 +:100A0000FF0BEF31F10540F4EC5CFF4F83E491E024 +:100A10000C9464050E9498028091C7019091C801CE +:100A20000E94760189EC91E00E947B011092C40142 +:100A30001092C3010DC08091C3019091C401FC01CB +:100A4000ED5BFE4FC08301969093C4018093C30178 +:100A50000E949D01ABCE8C2FCC0F990B806A04C0F5 +:100A60008C2FCC0F990B806B0E947601F1CFE9ECB3 +:100A7000F1E01382128288EE93E0A0E0B0E084837C +:100A80009583A683B78384E091E09183808385EC8E +:100A900090E09587848784EC90E09787868780EC48 +:100AA00090E0918B808B81EC90E0938B828B82EC39 +:100AB00090E0958B848B86EC90E0978B868B118EE3 +:100AC000128E138E148E0895EE0FFF1F0590F49171 +:100AD000E02D099481E090E0F8940C946F05F8946F +:020AE000FFCF46 +:100AE200000000002F01AB00F800D600EA007B01F5 +:100AF20003000500060009000A000B00496D70653D +:100B0200656475696E6F2056657273696F6E3A20FF +:0A0B120000302E302E32000D0A00D4 :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 20d5505..f1b3458 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -1,18 +1,21 @@ class Impeeduino { - static version = [0, 0, 1] + static version = [0, 0, 2] static BAUD_RATE = 115200; + // PWM enabled pins. -1: No PWM, otherwise + static PWM_PINMAP = [-1, -1, -1, 0, -1, 1, 2, -1, -1, 3, 4, 5, -1, -1]; + static MASK_OP = 0xF0; static OP_CONFIGURE = 0x80; static OP_DIGITAL_READ = 0x90; static OP_DIGITAL_WRITE_0 = 0xA0; static OP_DIGITAL_WRITE_1 = 0xB0; - static OP_ANALOG 0xC0; - static OP_ARB 0xD0; - static OP_CALL0 0xE0; - static OP_CALL1 0xF0; + static OP_ANALOG = 0xC0; + static OP_ARB = 0xD0; + static OP_CALL0 = 0xE0; + static OP_CALL1 = 0xF0; static MASK_CONFIG = 0x0F; static CONFIG_INPUT = 0x00; @@ -30,7 +33,6 @@ class Impeeduino { _funcBuf = null; // Buffer for function return values _serial = null; // UART bus to communicate with AVR _reset = null; // AVR reset pin - _pinsPWM = null; // PWM enabled pins constructor(serial = hardware.uart57, reset = hardware.pin1) { _serial = serial; @@ -39,15 +41,6 @@ class Impeeduino { _reset = reset; _reset.configure(DIGITAL_OUT); - // Define PWM enabled pins - _pinsPWM = {}; - _pinsPWM[3] <- 0; - _pinsPWM[5] <- 1; - _pinsPWM[6] <- 2; - _pinsPWM[9] <- 3; - _pinsPWM[10] <- 4; - _pinsPWM[11] <- 5; - _funcBuf = blob(); _rxBuf = blob(); @@ -96,6 +89,7 @@ class Impeeduino { // Configures the specified GPIO pin to behave either as an input or an output. function pinMode(pin, mode) { + assert (pin != 0 && pin != 1); // Do not reconfigure UART bus pins _serial.write(OP_CONFIGURE | pin); server.log("Configuring " + pin); switch (mode) { @@ -110,7 +104,7 @@ class Impeeduino { _serial.write(OP_ARB | CONFIG_OUTPUT); break; case PWM_OUT: - assert (pin in _pinsPWM); + assert (PWM_PINMAP[pin] != -1); _serial.write(OP_ARB | CONFIG_OUTPUT_PWM); break; default: @@ -123,7 +117,6 @@ class Impeeduino { // Writes a value to a digital pin function digitalWrite(pin, value) { assert (typeof value == "integer" || typeof value == "bool"); - server.log("Writing " + value + " to " + pin); if (value) { _serial.write(OP_DIGITAL_WRITE_1 | pin); } else { @@ -132,6 +125,21 @@ class Impeeduino { _serial.flush(); } + // Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). + function analogWrite(pin, value) { + assert (typeof value == "integer"); + assert (value <= 255); + assert (value >= 0); + assert (PWM_PINMAP[pin] != -1); + + _serial.write(OP_ANALOG | MASK_ANALOG_W | PWM_PINMAP[pin]); + // Lowest order bits (3-0) + _serial.write(OP_ARB | (value & 0x0000000F)); + // Higest order bits (7-4) + _serial.write(OP_ARB | ((value & 0x000000F0) >> 4)); + _serial.flush(); + } + // Reads the value from a specified digital pin function digitalRead(pin, cb = null) { _serial.write(OP_DIGITAL_READ | pin); @@ -172,38 +180,69 @@ class Impeeduino { function analogRead(pin) { _serial.write(OP_ANALOG | _pinsPWM[pin]); _serial.flush(); - - } - - // Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). - function analogWrite(pin, value) { - assert (typeof value == "integer"); - assert (value <= 255); - assert (value >= 0); - assert (pin in _pinsPWM); - - _serial.write(OP_ANALOG | MASK_ANALOG_W | _pinsPWM[pin]); - _serial.flush(); + if (cb) { + imp.wakeup(DIGITAL_READ_TIME, function() { + cb({ "value": _pinState[pin]}); + }.bindenv(this)); + } else { + local target_low = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin + local target_high = OP_DIGITAL_WRITE_1 | pin; + local readByte = _serial.read(); + local timeout_count = 0; + while (readByte != target_low && readByte != target_high) { + // Save other data to buffer + if (readByte != -1) { + _rxBuf.seek(0, 'e'); + _rxBuf.writen(readByte, 'b'); + } + timeout_count++; + if (timeout_count > 100) { + //server.log("Read Timeout, retrying") + timeout_count = 0; + _serial.write(OP_DIGITAL_READ | pin); + _serial.flush(); + } + readByte = _serial.read(); + } + server.log(format("0x%02X", readByte)); + imp.wakeup(0, parseRXBuffer.bindenv(this)); + + return readByte & MASK_DIGITAL_WRITE ? 1 : 0; + } } } -impeeduino <- Impeeduino(); - -impeeduino.pinMode(8, DIGITAL_OUT); -impeeduino.pinMode(6, DIGITAL_IN); - -isOn <- false; +activityLED <- hardware.pin2; +linkLED <- hardware.pin8; -count <- 7; +server.log("Starting... "); +impeeduino <- Impeeduino(); -function loop() { - server.log("Loop " + count) - impeeduino.digitalWrite(8, isOn); - server.log("Read value: " + impeeduino.digitalRead(6)) - isOn = !isOn; - if (count > 0) { - count--; - imp.wakeup(1, loop); - } -} -loop(); \ No newline at end of file +agent.on("config", function(data) { + activityLED.write(1); + server.log("Configuring pin " + data.pin); + impeeduino.pinMode(data.pin, data.val); + activityLED.write(0); +}); +agent.on("digitalWrite", function(data) { + activityLED.write(1); + server.log("Writing " + data.val + " to pin " + data.pin); + impeeduino.digitalWrite(data.pin, data.val); + activityLED.write(0); +}); +agent.on("analogWrite", function(data) { + activityLED.write(1); + server.log("PWM " + data.val + " to pin " + data.pin); + impeeduino.analogWrite(data.pin, data.val); + activityLED.write(0); +}); +agent.on("digitalRead", function(data) { + activityLED.write(1); + server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + activityLED.write(0); +}); +agent.on("analogRead", function(data) { + activityLED.write(1); + server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + activityLED.write(0); +}); \ No newline at end of file From 243280c4412b91219654ebdba86300fefb8c135b Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:38:06 -0400 Subject: [PATCH 12/34] Implement callbacks, digitalRead working, rest not so much --- hardware/impeeduino/impeeduino.class.nut | 162 +++++++++++++++++++---- 1 file changed, 137 insertions(+), 25 deletions(-) diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index f1b3458..8c08a72 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -14,8 +14,7 @@ class Impeeduino { static OP_DIGITAL_WRITE_1 = 0xB0; static OP_ANALOG = 0xC0; static OP_ARB = 0xD0; - static OP_CALL0 = 0xE0; - static OP_CALL1 = 0xF0; + static OP_CALL = 0xE0; static MASK_CONFIG = 0x0F; static CONFIG_INPUT = 0x00; @@ -29,11 +28,16 @@ class Impeeduino { static MASK_ANALOG_ADDR = 0x07; static MASK_CALL = 0x1F; - _rxBuf = null; // Buffer for incoming data - _funcBuf = null; // Buffer for function return values _serial = null; // UART bus to communicate with AVR _reset = null; // AVR reset pin + _rxBuf = null; // Buffer for incoming data + _funcBuf = null; // Buffer for function return values + + _functioncb = null; // Table of function return callbacks + _digitalReadcb = null; // Table of digital read return callbacks + _analogReadcb = null; // Table of analog read return callbacks + constructor(serial = hardware.uart57, reset = hardware.pin1) { _serial = serial; _serial.configure(BAUD_RATE, 8, PARITY_NONE, 1, NO_CTSRTS, uartEvent.bindenv(this)); @@ -44,6 +48,10 @@ class Impeeduino { _funcBuf = blob(); _rxBuf = blob(); + _functioncb = {}; + _digitalReadcb = {}; + _analogReadcb = {}; + this.reset(); } @@ -52,11 +60,53 @@ class Impeeduino { _rxBuf = blob(); buf.seek(0, 'b'); local readByte = 0; + while (!buf.eos()) { readByte = buf.readn('b'); if (readByte & 0x80) { // Interpret as Opcode server.log(format("Opcode: 0x%02X", readByte)); + switch (readByte & MASK_OP) { + case OP_DIGITAL_WRITE_0: + local addr = readByte & MASK_DIGITAL_ADDR; + if (addr in _digitalReadcb) { + imp.wakeup(0, function() { + (delete _digitalReadcb[addr])(0); + }.bindenv(this)); + } + break; + case OP_DIGITAL_WRITE_1: + local addr = readByte & MASK_DIGITAL_ADDR; + if (addr in _digitalReadcb) { + imp.wakeup(0, function() { + (delete _digitalReadcb[addr])(1); + }.bindenv(this)); + } + break; + case OP_ANALOG: + local addr = readByte & MASK_ANALOG_ADDR; + local value = blob(2); + value[0] = (buf.readn('b') & 0x0F) | ((buf.readn('b') & 0x0F) << 4); + value[1] = buf.readn('b') & 0x0F; + if (addr in _analogReadcb) { + imp.wakeup(0, function() { + (delete _analogReadcb[addr])(value); + }.bindenv(this)); + } + break; + case OP_CALL: + local addr = readByte & MASK_CALL; + local buf = _rxBuf; + _rxBuf = blob(); + buf.seek(0, 'b'); + if (addr in _functioncb) { + imp.wakeup(0, function() { + (delete _functioncb[addr])(buf); + }.bindenv(this)); + } + break; + } + } else { // Save ASCII data to function return buffer _funcBuf.seek(0, 'e'); @@ -89,6 +139,7 @@ class Impeeduino { // Configures the specified GPIO pin to behave either as an input or an output. function pinMode(pin, mode) { + assert (typeof pin == "integer"); assert (pin != 0 && pin != 1); // Do not reconfigure UART bus pins _serial.write(OP_CONFIGURE | pin); server.log("Configuring " + pin); @@ -116,6 +167,7 @@ class Impeeduino { // Writes a value to a digital pin function digitalWrite(pin, value) { + assert (typeof pin == "integer"); assert (typeof value == "integer" || typeof value == "bool"); if (value) { _serial.write(OP_DIGITAL_WRITE_1 | pin); @@ -127,10 +179,11 @@ class Impeeduino { // Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). function analogWrite(pin, value) { + assert (typeof pin == "integer"); assert (typeof value == "integer"); assert (value <= 255); assert (value >= 0); - assert (PWM_PINMAP[pin] != -1); + if (PWM_PINMAP[pin] == -1) throw "Pin " + pin + " does not have PWM capability"; _serial.write(OP_ANALOG | MASK_ANALOG_W | PWM_PINMAP[pin]); // Lowest order bits (3-0) @@ -142,13 +195,12 @@ class Impeeduino { // Reads the value from a specified digital pin function digitalRead(pin, cb = null) { + assert (typeof pin == "integer"); _serial.write(OP_DIGITAL_READ | pin); _serial.flush(); if (cb) { - imp.wakeup(DIGITAL_READ_TIME, function() { - cb({ "value": _pinState[pin]}); - }.bindenv(this)); + _digitalReadcb[pin] <- cb; } else { local target_low = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin local target_high = OP_DIGITAL_WRITE_1 | pin; @@ -161,7 +213,7 @@ class Impeeduino { _rxBuf.writen(readByte, 'b'); } timeout_count++; - if (timeout_count > 100) { + if (timeout_count > 200) { //server.log("Read Timeout, retrying") timeout_count = 0; _serial.write(OP_DIGITAL_READ | pin); @@ -177,39 +229,93 @@ class Impeeduino { } // Reads the value from the specified analog pin. The Arduino board contains a 6 channel , 10-bit analog to digital converter. - function analogRead(pin) { - _serial.write(OP_ANALOG | _pinsPWM[pin]); + function analogRead(pin, cb = null) { + assert (typeof pin == "integer"); + if (pin < 0 || pin > 5) throw "Invalid analog input number: " + pin; + _serial.write(OP_ANALOG | pin); _serial.flush(); + imp.sleep(0.000015); if (cb) { - imp.wakeup(DIGITAL_READ_TIME, function() { - cb({ "value": _pinState[pin]}); - }.bindenv(this)); + _analogReadcb[pin] <- cb; } else { - local target_low = OP_DIGITAL_WRITE_0 | pin; // Search for ops with a digital write pattern and addr = pin - local target_high = OP_DIGITAL_WRITE_1 | pin; - local readByte = _serial.read(); + local target = OP_ANALOG | pin; + local readByte = 0; local timeout_count = 0; - while (readByte != target_low && readByte != target_high) { + local value = blob(2); + // Wait for Arduino to send back result + do { + readByte = _serial.read(); // Save other data to buffer if (readByte != -1) { _rxBuf.seek(0, 'e'); _rxBuf.writen(readByte, 'b'); } timeout_count++; - if (timeout_count > 100) { + if (timeout_count > 500) { //server.log("Read Timeout, retrying") timeout_count = 0; - _serial.write(OP_DIGITAL_READ | pin); + _serial.write(OP_ANALOG | pin); _serial.flush(); + } + } while (readByte != target) + + // Wait for 1st word (bits 3:0) + do { + readByte = _serial.read(); + // Save other data to buffer + if (readByte != -1) { + _rxBuf.seek(0, 'e'); + _rxBuf.writen(readByte, 'b'); } + } while ((readByte & MASK_OP) != OP_ARB) + value[0] = readByte & 0x0F; + + // Wait for 2nd word (bits 7:4) + do { readByte = _serial.read(); - } - server.log(format("0x%02X", readByte)); + // Save other data to buffer + if (readByte != -1) { + _rxBuf.seek(0, 'e'); + _rxBuf.writen(readByte, 'b'); + } + } while ((readByte & MASK_OP) != OP_ARB) + value[0] = value[0] | ((readByte & 0x0F) << 4); + + // Wait for 3rd word (bits 9:8) + do { + readByte = _serial.read(); + // Save other data to buffer + if (readByte != -1) { + _rxBuf.seek(0, 'e'); + _rxBuf.writen(readByte, 'b'); + } + } while ((readByte & MASK_OP) != OP_ARB) + value[1] = readByte & 0x0F; + + //server.log(format("0x%04X", value.readn('w'))); value.seek(0, 'b'); imp.wakeup(0, parseRXBuffer.bindenv(this)); - return readByte & MASK_DIGITAL_WRITE ? 1 : 0; + return value.readn('w'); } } + function functionCall(id, arg = "", cb = null) { + assert (typeof id == "integer"); + if (typeof arg != "string") throw "Function call argument must be type string"; + if (id < 1 || id > 30) throw "Invalid function id: " + id; + + // Clear Arduino function buffer + _serial.write(OP_CALL); + _serial.flush(); + // Send function argument + _serial.write(arg); + // Initiate function call + _serial.write(OP_CALL | id); + // Register callback + if (cb != null) { + _functioncb[id] <- cb; + } + _serial.flush(); + } } activityLED <- hardware.pin2; @@ -238,11 +344,17 @@ agent.on("analogWrite", function(data) { }); agent.on("digitalRead", function(data) { activityLED.write(1); - server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + //server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + impeeduino.digitalRead(data.pin, function(value) { + server.log("Pin " + data.pin + " = " + value); + }); activityLED.write(0); }); agent.on("analogRead", function(data) { activityLED.write(1); - server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + //server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + impeeduino.analogRead(data.pin, function(value) { + server.log("Pin A" + data.pin + " = " + value); + }); activityLED.write(0); }); \ No newline at end of file From a26655e65a98dc7ed1078fbeb579387e2f071c6f Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:41:00 -0400 Subject: [PATCH 13/34] Fix analogRead callback's parameter type --- hardware/impeeduino/impeeduino.class.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 8c08a72..671ad21 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -90,7 +90,7 @@ class Impeeduino { value[1] = buf.readn('b') & 0x0F; if (addr in _analogReadcb) { imp.wakeup(0, function() { - (delete _analogReadcb[addr])(value); + (delete _analogReadcb[addr])(value.readn('w')); }.bindenv(this)); } break; From 75ee4337c98e1f1e52ecf53a09e4fe8cd9349d6c Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:49:37 -0400 Subject: [PATCH 14/34] Working function calls! --- .../arduino/impeeduino/impeeduino.ino | 2 +- .../example/remotecontrol.agent.nut | 11 +++++-- .../example/remotecontrol.device.nut | 29 +++++++++++++++++-- hardware/impeeduino/impeeduino.class.nut | 15 ++++++---- 4 files changed, 46 insertions(+), 11 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 8046cb7..e99c674 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -135,7 +135,7 @@ void loop() { } else if (rxOp == OP_ARB) { } else { - // Call Function Op: 10X + // Call Function Op: 111X rxbuffer[rxbufferindex] = '\0'; switch (rxByte & MASK_CALL) { case 0x00: Serial.write(function00(rxbuffer)); break; diff --git a/hardware/impeeduino/example/remotecontrol.agent.nut b/hardware/impeeduino/example/remotecontrol.agent.nut index f450432..6b7effc 100644 --- a/hardware/impeeduino/example/remotecontrol.agent.nut +++ b/hardware/impeeduino/example/remotecontrol.agent.nut @@ -2,9 +2,14 @@ function requestHandler(request, response) { try { if ("command" in request.query) { local data = {}; - data.pin <- request.query.pin.tointeger(); - if ("val" in request.query) { - data.val <- request.query.val.tointeger(); + if (request.query.command == "call") { + data.id <- request.query.id.tointeger(); + data.arg <- request.query.arg; + } else { + data.pin <- request.query.pin.tointeger(); + if ("val" in request.query) { + data.val <- request.query.val.tointeger(); + } } device.send(request.query.command, data); } diff --git a/hardware/impeeduino/example/remotecontrol.device.nut b/hardware/impeeduino/example/remotecontrol.device.nut index 69e7d6a..045a247 100644 --- a/hardware/impeeduino/example/remotecontrol.device.nut +++ b/hardware/impeeduino/example/remotecontrol.device.nut @@ -1,3 +1,4 @@ + activityLED <- hardware.pin2; linkLED <- hardware.pin8; @@ -5,20 +6,44 @@ server.log("Starting... "); impeeduino <- Impeeduino(); agent.on("config", function(data) { + activityLED.write(1); server.log("Configuring pin " + data.pin); impeeduino.pinMode(data.pin, data.val); + activityLED.write(0); }); agent.on("digitalWrite", function(data) { + activityLED.write(1); server.log("Writing " + data.val + " to pin " + data.pin); impeeduino.digitalWrite(data.pin, data.val); + activityLED.write(0); }); agent.on("analogWrite", function(data) { + activityLED.write(1); server.log("PWM " + data.val + " to pin " + data.pin); impeeduino.analogWrite(data.pin, data.val); + activityLED.write(0); }); agent.on("digitalRead", function(data) { - server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + activityLED.write(1); + //server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + impeeduino.digitalRead(data.pin, function(value) { + server.log("Pin " + data.pin + " = " + value); + }); + activityLED.write(0); }); agent.on("analogRead", function(data) { - server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + activityLED.write(1); + //server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + impeeduino.analogRead(data.pin, function(value) { + server.log("Pin A" + data.pin + " = " + value); + }); + activityLED.write(0); +}); +agent.on("call", function(data) { + activityLED.write(1); + server.log("Calling function " + data.id); + impeeduino.functionCall(data.id, data.arg, function(value) { + server.log("Function " + data.id + " returned with value: " + value); + }); + activityLED.write(0); }); \ No newline at end of file diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 671ad21..fafff22 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -96,8 +96,8 @@ class Impeeduino { break; case OP_CALL: local addr = readByte & MASK_CALL; - local buf = _rxBuf; - _rxBuf = blob(); + local buf = _funcBuf; + _funcBuf = blob(); buf.seek(0, 'b'); if (addr in _functioncb) { imp.wakeup(0, function() { @@ -117,9 +117,6 @@ class Impeeduino { } if (_funcBuf.len() > 0) { server.log(format("%s", _funcBuf.tostring())); - //server.log(_funcBuf.tostring()); - // TESTING ONLY - _funcBuf = blob(); } } @@ -357,4 +354,12 @@ agent.on("analogRead", function(data) { server.log("Pin A" + data.pin + " = " + value); }); activityLED.write(0); +}); +agent.on("call", function(data) { + activityLED.write(1); + server.log("Calling function " + data.id); + impeeduino.functionCall(data.id, data.arg, function(value) { + server.log("Function " + data.id + " returned with value: " + value); + }); + activityLED.write(0); }); \ No newline at end of file From 686fa91386f0a048d0b0e8688e85ad84b7d3842e Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:58:57 -0400 Subject: [PATCH 15/34] Update remote control demo to include async calls --- .../example/remotecontrol.agent.nut | 5 ++++ .../example/remotecontrol.device.nut | 24 ++++++++++++------- hardware/impeeduino/impeeduino.class.nut | 23 +++++++++++------- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/hardware/impeeduino/example/remotecontrol.agent.nut b/hardware/impeeduino/example/remotecontrol.agent.nut index 6b7effc..f2b0f01 100644 --- a/hardware/impeeduino/example/remotecontrol.agent.nut +++ b/hardware/impeeduino/example/remotecontrol.agent.nut @@ -2,6 +2,11 @@ function requestHandler(request, response) { try { if ("command" in request.query) { local data = {}; + if ("async" in request.query && request.query.async == "true") { + data.async <- true; + } else { + data.async <- false; + } if (request.query.command == "call") { data.id <- request.query.id.tointeger(); data.arg <- request.query.arg; diff --git a/hardware/impeeduino/example/remotecontrol.device.nut b/hardware/impeeduino/example/remotecontrol.device.nut index 045a247..90b45f8 100644 --- a/hardware/impeeduino/example/remotecontrol.device.nut +++ b/hardware/impeeduino/example/remotecontrol.device.nut @@ -1,4 +1,3 @@ - activityLED <- hardware.pin2; linkLED <- hardware.pin8; @@ -25,18 +24,25 @@ agent.on("analogWrite", function(data) { }); agent.on("digitalRead", function(data) { activityLED.write(1); - //server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); - impeeduino.digitalRead(data.pin, function(value) { - server.log("Pin " + data.pin + " = " + value); - }); + if (data.async) { + impeeduino.digitalRead(data.pin, function(value) { + server.log("Async: Pin " + data.pin + " = " + value); + }); + } else { + server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + } + activityLED.write(0); }); agent.on("analogRead", function(data) { activityLED.write(1); - //server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); - impeeduino.analogRead(data.pin, function(value) { - server.log("Pin A" + data.pin + " = " + value); - }); + if (data.async) { + impeeduino.analogRead(data.pin, function(value) { + server.log("Async: Pin A" + data.pin + " = " + value); + }); + } else { + server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + } activityLED.write(0); }); agent.on("call", function(data) { diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index fafff22..d645792 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -341,18 +341,25 @@ agent.on("analogWrite", function(data) { }); agent.on("digitalRead", function(data) { activityLED.write(1); - //server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); - impeeduino.digitalRead(data.pin, function(value) { - server.log("Pin " + data.pin + " = " + value); - }); + if (data.async) { + impeeduino.digitalRead(data.pin, function(value) { + server.log("Async: Pin " + data.pin + " = " + value); + }); + } else { + server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); + } + activityLED.write(0); }); agent.on("analogRead", function(data) { activityLED.write(1); - //server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); - impeeduino.analogRead(data.pin, function(value) { - server.log("Pin A" + data.pin + " = " + value); - }); + if (data.async) { + impeeduino.analogRead(data.pin, function(value) { + server.log("Async: Pin A" + data.pin + " = " + value); + }); + } else { + server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); + } activityLED.write(0); }); agent.on("call", function(data) { From 0af5ac4ebdbdbaf4e8d22943623e1cc89fd42de8 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:00:51 -0500 Subject: [PATCH 16/34] Separate library and programmer documentation --- hardware/impeeduino/README.md | 92 +++++++++++++++--------- hardware/impeeduino/SerialComms.txt | 60 ---------------- hardware/impeeduino/programmer/README.md | 32 +++++++++ 3 files changed, 92 insertions(+), 92 deletions(-) delete mode 100644 hardware/impeeduino/SerialComms.txt create mode 100644 hardware/impeeduino/programmer/README.md diff --git a/hardware/impeeduino/README.md b/hardware/impeeduino/README.md index 5574a94..4132c1c 100644 --- a/hardware/impeeduino/README.md +++ b/hardware/impeeduino/README.md @@ -1,32 +1,60 @@ -Impeedunio Programmer -===================== - -This firmware will allow you to program the ATmega328 built into the Impduino. -It parses Intel HEX files delivered via HTTP POST (form) and implements the STK500v1 serial protocol to talk to the connected ATmega328. - -You will need to install the "[optiboot](https://code.google.com/p/optiboot/)" bootloader using an ICSP cable. At the time of writing, the latest version was [v5.0a](https://code.google.com/p/optiboot/downloads/detail?name=optiboot-v5.0a.zip). -To do this you will need an ISP or use [another Ardiuno as the ISP](http://arduino.cc/en/Tutorial/ArduinoISP) and the ArduinoISP sketch. - -You might need to adjust the signature of the ATmega328P in the avrdude configuration to make avrdude think its an ATmega328P. This is on line 8486 on my installation. -/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf - - From: signature = 0x1e 0x95 0x0f; - To: signature = 0x1e 0x95 0x14; - -Once the ATMega is programmed you can continue to talk to it over the serial port. - -Note, if you are using the [SparkFun Imp Shield](https://www.sparkfun.com/products/11401) then you may need to reverse the -logic of the RESET pin. Where you see RESET.write(1), change it to RESET.write(0) and vice versa. - - -Contributors -============ - -- Aron - -Usage -===== - -This is not a library class. It represents an entire application for programming the Arduino via an Imp with a HEX file. -You can adapt it to your needs, such as combining the programming functionality with application level communication. - +Instruction format: 1[op (3b)][addr (4b)] + Any byte received that does not have MSB set to 1 is interpreted as ASCII data, + should be added to function call buffer. + +000 (0x80) Configure Pin + Must be followed by arb data with config type + 1111[configtype (4b)] + 0000 Input + 0001 Input PULLUP + 0010 Output + +001 (0x90) Digital Read + Arduino responds with digital write op corresponding to read value + +010 (0xA0) Digital Write 0 +011 (0xB0) Digital Write 1 + + + +100 (0xC0) Analog Op + W/~R + addr (3b) + pin 3 : 0 + pin 5 : 1 + pin 6 : 2 + pin 9 : 3 + pin 10: 4 + pin 11: 5 + + (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle + - Full instruction is 1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)] + + (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes. + - 1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)] + + Note imp is little-endian. + +101 (0xD0) Arb data/Reserved + +110 (0xE0) Call/Return + call 0 (11000000) reserved for "clear buffer" +111 (0xF0) Call/Return + 11111111 (0xFF) May not be used to avoid confusion + +========== +Function call process + +Valid functions are 1-30 (0x01 to 0x1E) +function 0 (0x00) is reserved as "clear buffer" +function 32 (0xFF) is not allowed to avoid 0xFF confusion with -1 + +1. Imp sends "call 0x00" to clear Arduino function buffer +2. Imp sends function argument as ASCII characters (0-127) +3. Arduino places received characters into buffer +4. Imp sends "call 0xXX" to initiate call of function #XX +5. Arduino calls functionXX() with the function buffer's contents as the argument +6. functionXX returns, optionally with a character array return value +7. Arduino sends "call 0x00" to clear Imp's return value buffer +8. Arduino sends return value as ASCII characters +9. Imp places received characters into buffer +10. Arduino sends "call 0xXX" to indicate function return +11. If a callback has been set, Imp calls it with the returned value as an argument. \ No newline at end of file diff --git a/hardware/impeeduino/SerialComms.txt b/hardware/impeeduino/SerialComms.txt deleted file mode 100644 index 4132c1c..0000000 --- a/hardware/impeeduino/SerialComms.txt +++ /dev/null @@ -1,60 +0,0 @@ -Instruction format: 1[op (3b)][addr (4b)] - Any byte received that does not have MSB set to 1 is interpreted as ASCII data, - should be added to function call buffer. - -000 (0x80) Configure Pin - Must be followed by arb data with config type - 1111[configtype (4b)] - 0000 Input - 0001 Input PULLUP - 0010 Output - -001 (0x90) Digital Read - Arduino responds with digital write op corresponding to read value - -010 (0xA0) Digital Write 0 -011 (0xB0) Digital Write 1 - - - -100 (0xC0) Analog Op + W/~R + addr (3b) - pin 3 : 0 - pin 5 : 1 - pin 6 : 2 - pin 9 : 3 - pin 10: 4 - pin 11: 5 - - (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle - - Full instruction is 1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)] - - (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes. - - 1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)] - - Note imp is little-endian. - -101 (0xD0) Arb data/Reserved - -110 (0xE0) Call/Return - call 0 (11000000) reserved for "clear buffer" -111 (0xF0) Call/Return - 11111111 (0xFF) May not be used to avoid confusion - -========== -Function call process - -Valid functions are 1-30 (0x01 to 0x1E) -function 0 (0x00) is reserved as "clear buffer" -function 32 (0xFF) is not allowed to avoid 0xFF confusion with -1 - -1. Imp sends "call 0x00" to clear Arduino function buffer -2. Imp sends function argument as ASCII characters (0-127) -3. Arduino places received characters into buffer -4. Imp sends "call 0xXX" to initiate call of function #XX -5. Arduino calls functionXX() with the function buffer's contents as the argument -6. functionXX returns, optionally with a character array return value -7. Arduino sends "call 0x00" to clear Imp's return value buffer -8. Arduino sends return value as ASCII characters -9. Imp places received characters into buffer -10. Arduino sends "call 0xXX" to indicate function return -11. If a callback has been set, Imp calls it with the returned value as an argument. \ No newline at end of file diff --git a/hardware/impeeduino/programmer/README.md b/hardware/impeeduino/programmer/README.md new file mode 100644 index 0000000..5574a94 --- /dev/null +++ b/hardware/impeeduino/programmer/README.md @@ -0,0 +1,32 @@ +Impeedunio Programmer +===================== + +This firmware will allow you to program the ATmega328 built into the Impduino. +It parses Intel HEX files delivered via HTTP POST (form) and implements the STK500v1 serial protocol to talk to the connected ATmega328. + +You will need to install the "[optiboot](https://code.google.com/p/optiboot/)" bootloader using an ICSP cable. At the time of writing, the latest version was [v5.0a](https://code.google.com/p/optiboot/downloads/detail?name=optiboot-v5.0a.zip). +To do this you will need an ISP or use [another Ardiuno as the ISP](http://arduino.cc/en/Tutorial/ArduinoISP) and the ArduinoISP sketch. + +You might need to adjust the signature of the ATmega328P in the avrdude configuration to make avrdude think its an ATmega328P. This is on line 8486 on my installation. +/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/etc/avrdude.conf + + From: signature = 0x1e 0x95 0x0f; + To: signature = 0x1e 0x95 0x14; + +Once the ATMega is programmed you can continue to talk to it over the serial port. + +Note, if you are using the [SparkFun Imp Shield](https://www.sparkfun.com/products/11401) then you may need to reverse the +logic of the RESET pin. Where you see RESET.write(1), change it to RESET.write(0) and vice versa. + + +Contributors +============ + +- Aron + +Usage +===== + +This is not a library class. It represents an entire application for programming the Arduino via an Imp with a HEX file. +You can adapt it to your needs, such as combining the programming functionality with application level communication. + From e6c4ee5480f9d2c0596d4b3be807bfd7d98d2b52 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:35:23 -0500 Subject: [PATCH 17/34] Lay out structure of library README --- hardware/impeeduino/README.md | 159 +++++++++++------- .../impeeduino/arduino/impeeduino/README.md | 60 +++++++ 2 files changed, 159 insertions(+), 60 deletions(-) create mode 100644 hardware/impeeduino/arduino/impeeduino/README.md diff --git a/hardware/impeeduino/README.md b/hardware/impeeduino/README.md index 4132c1c..f77b18e 100644 --- a/hardware/impeeduino/README.md +++ b/hardware/impeeduino/README.md @@ -1,60 +1,99 @@ -Instruction format: 1[op (3b)][addr (4b)] - Any byte received that does not have MSB set to 1 is interpreted as ASCII data, - should be added to function call buffer. - -000 (0x80) Configure Pin - Must be followed by arb data with config type - 1111[configtype (4b)] - 0000 Input - 0001 Input PULLUP - 0010 Output - -001 (0x90) Digital Read - Arduino responds with digital write op corresponding to read value - -010 (0xA0) Digital Write 0 -011 (0xB0) Digital Write 1 - - - -100 (0xC0) Analog Op + W/~R + addr (3b) - pin 3 : 0 - pin 5 : 1 - pin 6 : 2 - pin 9 : 3 - pin 10: 4 - pin 11: 5 - - (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle - - Full instruction is 1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)] - - (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes. - - 1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)] - - Note imp is little-endian. - -101 (0xD0) Arb data/Reserved - -110 (0xE0) Call/Return - call 0 (11000000) reserved for "clear buffer" -111 (0xF0) Call/Return - 11111111 (0xFF) May not be used to avoid confusion - -========== -Function call process - -Valid functions are 1-30 (0x01 to 0x1E) -function 0 (0x00) is reserved as "clear buffer" -function 32 (0xFF) is not allowed to avoid 0xFF confusion with -1 - -1. Imp sends "call 0x00" to clear Arduino function buffer -2. Imp sends function argument as ASCII characters (0-127) -3. Arduino places received characters into buffer -4. Imp sends "call 0xXX" to initiate call of function #XX -5. Arduino calls functionXX() with the function buffer's contents as the argument -6. functionXX returns, optionally with a character array return value -7. Arduino sends "call 0x00" to clear Imp's return value buffer -8. Arduino sends return value as ASCII characters -9. Imp places received characters into buffer -10. Arduino sends "call 0xXX" to indicate function return -11. If a callback has been set, Imp calls it with the returned value as an argument. \ No newline at end of file +# Impeeduino 0.0.? + +This Impeeduino is a mashup of an imp001 and an Arduino. This library provides a simple way to instruct the Arduino side of the Impeeduino to perform basic tasks over UART. + + + +## Class Usage + +### Constructor: Impeeduino(*[serial, reset]*) + +The constructor takes two arguments to instantiate the class: a non-configured UART bus and a GPIO pin connected to the Arduino's reset line. These default to the configuration used on the Impeeduino rev2, using `uart57` for serial communications and `pin1` for the reset line. + +```squirrel +impeeduino <- Impeeduino(); + +// Equivalent, but more verbose instantiation: +impeeduino <- Impeeduino(hardware.uart57, hardware.pin1); +``` + +## Class Methods + +### reset() + +Resets the ATMega processor. + +```squirrel +impeeduino.reset(); +``` + +### pinMode(*pin, mode*) + +Configures the specified GPIO pin to behave either as an input or an output. + +```squirrel +// Example here +``` + +### digitalWrite(*pin, value*) + +Writes a value to a digital pin + +```squirrel +// Example here +``` + +### analogWrite(*pin, value*) + +Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). + +```squirrel +// Example here +``` + +### digitalRead(*pin[, callback]*) + +Reads the value from a specified digital pin + +#### Asynchronous Example + +```squirrel +// Code here +``` + +#### Synchronous Example + +```squirrel +// Code here +``` + +### analogRead(*pin[, callback]*) + +Reads the value from a specified analog pin + +#### Asynchronous Example + +```squirrel +// Code here +``` + +#### Synchronous Example + +```squirrel +// Code here +``` +### functionCall(*id[, argument, callback]*) + +Performs a function call on the Arduino. + +```squirrel +// Example here +``` + +## Licence + + \ No newline at end of file diff --git a/hardware/impeeduino/arduino/impeeduino/README.md b/hardware/impeeduino/arduino/impeeduino/README.md new file mode 100644 index 0000000..4132c1c --- /dev/null +++ b/hardware/impeeduino/arduino/impeeduino/README.md @@ -0,0 +1,60 @@ +Instruction format: 1[op (3b)][addr (4b)] + Any byte received that does not have MSB set to 1 is interpreted as ASCII data, + should be added to function call buffer. + +000 (0x80) Configure Pin + Must be followed by arb data with config type + 1111[configtype (4b)] + 0000 Input + 0001 Input PULLUP + 0010 Output + +001 (0x90) Digital Read + Arduino responds with digital write op corresponding to read value + +010 (0xA0) Digital Write 0 +011 (0xB0) Digital Write 1 + + + +100 (0xC0) Analog Op + W/~R + addr (3b) + pin 3 : 0 + pin 5 : 1 + pin 6 : 2 + pin 9 : 3 + pin 10: 4 + pin 11: 5 + + (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle + - Full instruction is 1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)] + + (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes. + - 1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)] + + Note imp is little-endian. + +101 (0xD0) Arb data/Reserved + +110 (0xE0) Call/Return + call 0 (11000000) reserved for "clear buffer" +111 (0xF0) Call/Return + 11111111 (0xFF) May not be used to avoid confusion + +========== +Function call process + +Valid functions are 1-30 (0x01 to 0x1E) +function 0 (0x00) is reserved as "clear buffer" +function 32 (0xFF) is not allowed to avoid 0xFF confusion with -1 + +1. Imp sends "call 0x00" to clear Arduino function buffer +2. Imp sends function argument as ASCII characters (0-127) +3. Arduino places received characters into buffer +4. Imp sends "call 0xXX" to initiate call of function #XX +5. Arduino calls functionXX() with the function buffer's contents as the argument +6. functionXX returns, optionally with a character array return value +7. Arduino sends "call 0x00" to clear Imp's return value buffer +8. Arduino sends return value as ASCII characters +9. Imp places received characters into buffer +10. Arduino sends "call 0xXX" to indicate function return +11. If a callback has been set, Imp calls it with the returned value as an argument. \ No newline at end of file From 3df62f0ec5c29a87d725373a423a8e88562313e5 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 01:35:47 -0500 Subject: [PATCH 18/34] Refactor library for style --- hardware/impeeduino/impeeduino.class.nut | 166 ++++++++++++----------- 1 file changed, 90 insertions(+), 76 deletions(-) diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index d645792..83a7047 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -28,6 +28,8 @@ class Impeeduino { static MASK_ANALOG_ADDR = 0x07; static MASK_CALL = 0x1F; + // -------------------- PRIVATE PROPERTIES -------------------- // + _serial = null; // UART bus to communicate with AVR _reset = null; // AVR reset pin @@ -38,9 +40,16 @@ class Impeeduino { _digitalReadcb = null; // Table of digital read return callbacks _analogReadcb = null; // Table of analog read return callbacks + // -------------------- CONSTRUCTOR -------------------- // + /* + * The constructor takes two arguments to instantiate the class: a + * non-configured UART bus and a GPIO pin connected to the Arduino's reset + * line. These default to the configuration used on the Impeeduino rev2, + * using `uart57` for serial communications and `pin1` for the reset line. + */ constructor(serial = hardware.uart57, reset = hardware.pin1) { _serial = serial; - _serial.configure(BAUD_RATE, 8, PARITY_NONE, 1, NO_CTSRTS, uartEvent.bindenv(this)); + _serial.configure(BAUD_RATE, 8, PARITY_NONE, 1, NO_CTSRTS, _uartEvent.bindenv(this)); _reset = reset; _reset.configure(DIGITAL_OUT); @@ -55,78 +64,8 @@ class Impeeduino { this.reset(); } - function parseRXBuffer() { - local buf = _rxBuf; - _rxBuf = blob(); - buf.seek(0, 'b'); - local readByte = 0; - - while (!buf.eos()) { - readByte = buf.readn('b'); - if (readByte & 0x80) { - // Interpret as Opcode - server.log(format("Opcode: 0x%02X", readByte)); - switch (readByte & MASK_OP) { - case OP_DIGITAL_WRITE_0: - local addr = readByte & MASK_DIGITAL_ADDR; - if (addr in _digitalReadcb) { - imp.wakeup(0, function() { - (delete _digitalReadcb[addr])(0); - }.bindenv(this)); - } - break; - case OP_DIGITAL_WRITE_1: - local addr = readByte & MASK_DIGITAL_ADDR; - if (addr in _digitalReadcb) { - imp.wakeup(0, function() { - (delete _digitalReadcb[addr])(1); - }.bindenv(this)); - } - break; - case OP_ANALOG: - local addr = readByte & MASK_ANALOG_ADDR; - local value = blob(2); - value[0] = (buf.readn('b') & 0x0F) | ((buf.readn('b') & 0x0F) << 4); - value[1] = buf.readn('b') & 0x0F; - if (addr in _analogReadcb) { - imp.wakeup(0, function() { - (delete _analogReadcb[addr])(value.readn('w')); - }.bindenv(this)); - } - break; - case OP_CALL: - local addr = readByte & MASK_CALL; - local buf = _funcBuf; - _funcBuf = blob(); - buf.seek(0, 'b'); - if (addr in _functioncb) { - imp.wakeup(0, function() { - (delete _functioncb[addr])(buf); - }.bindenv(this)); - } - break; - } - - } else { - // Save ASCII data to function return buffer - _funcBuf.seek(0, 'e'); - if (readByte == 0) - readByte = ' '; - _funcBuf.writen(readByte, 'b'); - } - } - if (_funcBuf.len() > 0) { - server.log(format("%s", _funcBuf.tostring())); - } - } - - function uartEvent() { - server.log("Uart event") - _rxBuf.seek(0, 'e'); - _rxBuf.writeblob(_serial.readblob()); - imp.wakeup(0, parseRXBuffer.bindenv(this)); - } - + // -------------------- PUBLIC METHODS -------------------- // + /* Resets the ATMega processor. */ function reset() { server.log("Resetting Duino...") _reset.write(1); @@ -134,7 +73,7 @@ class Impeeduino { _reset.write(0); } - // Configures the specified GPIO pin to behave either as an input or an output. + /* Configures the specified GPIO pin to behave either as an input or an output. */ function pinMode(pin, mode) { assert (typeof pin == "integer"); assert (pin != 0 && pin != 1); // Do not reconfigure UART bus pins @@ -219,7 +158,7 @@ class Impeeduino { readByte = _serial.read(); } server.log(format("0x%02X", readByte)); - imp.wakeup(0, parseRXBuffer.bindenv(this)); + imp.wakeup(0, _parseRXBuffer.bindenv(this)); return readByte & MASK_DIGITAL_WRITE ? 1 : 0; } @@ -290,11 +229,12 @@ class Impeeduino { value[1] = readByte & 0x0F; //server.log(format("0x%04X", value.readn('w'))); value.seek(0, 'b'); - imp.wakeup(0, parseRXBuffer.bindenv(this)); + imp.wakeup(0, _parseRXBuffer.bindenv(this)); return value.readn('w'); } } + /* Calls function */ function functionCall(id, arg = "", cb = null) { assert (typeof id == "integer"); if (typeof arg != "string") throw "Function call argument must be type string"; @@ -313,6 +253,80 @@ class Impeeduino { } _serial.flush(); } + + // -------------------- PRIVATE METHODS -------------------- // + + function _parseRXBuffer() { + local buf = _rxBuf; + _rxBuf = blob(); + buf.seek(0, 'b'); + local readByte = 0; + + while (!buf.eos()) { + readByte = buf.readn('b'); + if (readByte & 0x80) { + // Interpret as Opcode + server.log(format("Opcode: 0x%02X", readByte)); + switch (readByte & MASK_OP) { + case OP_DIGITAL_WRITE_0: + local addr = readByte & MASK_DIGITAL_ADDR; + if (addr in _digitalReadcb) { + imp.wakeup(0, function() { + (delete _digitalReadcb[addr])(0); + }.bindenv(this)); + } + break; + case OP_DIGITAL_WRITE_1: + local addr = readByte & MASK_DIGITAL_ADDR; + if (addr in _digitalReadcb) { + imp.wakeup(0, function() { + (delete _digitalReadcb[addr])(1); + }.bindenv(this)); + } + break; + case OP_ANALOG: + local addr = readByte & MASK_ANALOG_ADDR; + local value = blob(2); + value[0] = (buf.readn('b') & 0x0F) | ((buf.readn('b') & 0x0F) << 4); + value[1] = buf.readn('b') & 0x0F; + if (addr in _analogReadcb) { + imp.wakeup(0, function() { + (delete _analogReadcb[addr])(value.readn('w')); + }.bindenv(this)); + } + break; + case OP_CALL: + local addr = readByte & MASK_CALL; + local buf = _funcBuf; + _funcBuf = blob(); + buf.seek(0, 'b'); + if (addr in _functioncb) { + imp.wakeup(0, function() { + (delete _functioncb[addr])(buf); + }.bindenv(this)); + } + break; + } + + } else { + // Save ASCII data to function return buffer + _funcBuf.seek(0, 'e'); + if (readByte == 0) + readByte = ' '; + _funcBuf.writen(readByte, 'b'); + } + } + if (_funcBuf.len() > 0) { + server.log(format("%s", _funcBuf.tostring())); + } + } + + function _uartEvent() { + server.log("Uart event") + _rxBuf.seek(0, 'e'); + _rxBuf.writeblob(_serial.readblob()); + imp.wakeup(0, _parseRXBuffer.bindenv(this)); + } } activityLED <- hardware.pin2; From 2060d76dadb23e98b1f032dc1cb724c6ee8a1423 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 12:42:44 -0500 Subject: [PATCH 19/34] Update README, Add support for float analogWrite values --- hardware/impeeduino/README.md | 92 ++++++++++++++++--- .../example/remotecontrol.agent.nut | 5 + hardware/impeeduino/impeeduino.class.nut | 17 ++-- 3 files changed, 93 insertions(+), 21 deletions(-) diff --git a/hardware/impeeduino/README.md b/hardware/impeeduino/README.md index f77b18e..5456f2e 100644 --- a/hardware/impeeduino/README.md +++ b/hardware/impeeduino/README.md @@ -23,7 +23,7 @@ impeeduino <- Impeeduino(hardware.uart57, hardware.pin1); ### reset() -Resets the ATMega processor. +Resets the ATMega processor by bouncing the reset pin. Note that reseting will block the imp for about 0.2 seconds. ```squirrel impeeduino.reset(); @@ -31,65 +31,127 @@ impeeduino.reset(); ### pinMode(*pin, mode*) -Configures the specified GPIO pin to behave either as an input or an output. +Configures the specified GPIO pin to the specified mode. Possible configurations are input, input with pullup, output, and PWM output. The relevant constants are summarized below. Note that not all ATMega pins are capable of being used for PWM output. + +| Mode Constant | Configuration | +| ------------- | ------------- | +| DIGITAL_IN | Input (High Impedance) | +| DIGITAL_IN_PULLUP | Input with pullup | +| DIGITAL_OUT | Digital output | +| PWM_OUT | PWM output | + ```squirrel -// Example here +// Configure pin 2 as digital input +impeeduino.pinMode(2, DIGITAL_IN); + +// Configure pin 3 as digital input with pullup +impeeduino.pinMode(3, DIGITAL_IN_PULLUP); + +// Configure pin 4 as digital output +impeeduino.pinMode(4, DIGITAL_OUT); + +// Configure pin 5 as PWM output +impeeduino.pinMode(5, PWM_OUT); ``` ### digitalWrite(*pin, value*) -Writes a value to a digital pin +Writes a value to the specified digital pin. Value can be either a boolean or an integer value. For boolean values, true corresponding to high and false to low. For integers, non-zero values correspond to high and zero corresponds to false. ```squirrel -// Example here +// Set pin 4 to HIGH +digitalWrite(4, 1); + +// Set pin 4 to LOW +digitalWrite(4, 0); + +// Toggle pin 4 every 2 seconds +isOn <- true; + +function blink() { + digitalWrite(4, isOn); + isOn = !isOn; + imp.wakeup(2, blink); +} + +blink(); ``` ### analogWrite(*pin, value*) -Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). +Writes an analog value (PWM wave) to a pin. *value* is an integer value representing the duty cycle and ranges between 0 (off) and 255 (always on). For compatibility with imp code, value may also be a floating point duty ratio from 0.0 to 1.0. This is then rounded to the nearest available value. ```squirrel -// Example here +// Configure pin 5 as pwm output +impeeduino.pinMode(5, PWM_OUT); + +// Set pin 5 to 50% duty cycle +impeeduino.analogWrite(5, 0.5); + +// Set pin 5 to 0% duty cycle (always off) +impeeduino.analogWrite(5, 0); + +// Set pin 5 to 100% duty cycle (always on) +impeeduino.analogWrite(5, 255); ``` ### digitalRead(*pin[, callback]*) -Reads the value from a specified digital pin +Reads the logical value of the specified digital pin and returns it as an integer. A value of 0 corresponds to digital low, a value of 1 corresponds to digital high. + +If a callback parameter is provided, the reading executes asynchronously and the resulting integer value will be passed to the supplied function as the only parameter. If no callback is provided, the method blocks until the reading has been taken. #### Asynchronous Example ```squirrel -// Code here +// Read pin 2 asynchronously and log the returned value +impeeduino.digitalRead(2, function(value) { + server.log("Async digital read: Pin 2 has value " + value); +}); ``` #### Synchronous Example ```squirrel -// Code here +// Read pin 2 and log the returned value +server.log("Digital read: Pin 2 has value " + impeeduino.digitalRead(2)); ``` ### analogRead(*pin[, callback]*) -Reads the value from a specified analog pin +Reads the value of the specified analog pin and returns it as an integer. The Arduino has a 10-bit ADC, so returned values will range from 0 to 1023. + +If a callback parameter is provided, the reading executes asynchronously and the resulting integer value will be passed to the supplied function as the only parameter. If no callback is provided, the method blocks until the reading has been taken. #### Asynchronous Example ```squirrel -// Code here +// Read analog pin 0 asynchronously and log the returned value +impeeduino.analogRead(0, function(value) { + server.log("Async analog read: Pin A0 has value " + value); +}); ``` #### Synchronous Example ```squirrel -// Code here +// Read analog pin 0 and log the returned value +server.log("Analog read: Pin A0 has value " + impeeduino.analogRead(0)); ``` ### functionCall(*id[, argument, callback]*) -Performs a function call on the Arduino. +Performs a function call on the Arduino. This is intended as a way to trigger additional functionality on the Arduino. There are 30 user-modifiable custom functions available in the Arduino code, with id numbers 1-30. + +Each function may take an ASCII string argument and optionally pass back an ASCII string return value. Because the underlying serial communication scheme uses the most significant bit to indicate commands, only standard ASCII characters (value 0-127) may be sent. + +Arduino function calls are asynchronous. The returned string will be passed to as the sole parameter to the optional callback as a binary blob. ```squirrel -// Example here +server.log("Calling function 1"); +impeeduino.functionCall(1, "This is the argument", function(value) { + server.log("Function 1 returned with value: " + value); +}); ``` ## Licence diff --git a/hardware/impeeduino/example/remotecontrol.agent.nut b/hardware/impeeduino/example/remotecontrol.agent.nut index f2b0f01..1e6b550 100644 --- a/hardware/impeeduino/example/remotecontrol.agent.nut +++ b/hardware/impeeduino/example/remotecontrol.agent.nut @@ -10,6 +10,11 @@ function requestHandler(request, response) { if (request.query.command == "call") { data.id <- request.query.id.tointeger(); data.arg <- request.query.arg; + } else if (request.query.command == "analogWrite") { + data.pin <- request.query.pin.tointeger(); + data.val <- request.query.val.tofloat(); + if (data.val > 1.0) + data.val = data.val.tointeger(); } else { data.pin <- request.query.pin.tointeger(); if ("val" in request.query) { diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 83a7047..a4e9258 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -116,16 +116,22 @@ class Impeeduino { // Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). function analogWrite(pin, value) { assert (typeof pin == "integer"); - assert (typeof value == "integer"); - assert (value <= 255); - assert (value >= 0); if (PWM_PINMAP[pin] == -1) throw "Pin " + pin + " does not have PWM capability"; + local writeVal = 0; + if (typeof value == "integer") { + if (value < 0 || value > 255) throw "Integer analogWrite values must be between 0 and 255"; + writeVal = value; + } else if (typeof value == "float") { + if (value < 0.0 || value > 1.0) throw "Float analogWrite values must be between 0.0 and 1.0"; + writeVal = (value * 255).tointeger(); + } + _serial.write(OP_ANALOG | MASK_ANALOG_W | PWM_PINMAP[pin]); // Lowest order bits (3-0) - _serial.write(OP_ARB | (value & 0x0000000F)); + _serial.write(OP_ARB | (writeVal & 0x0000000F)); // Higest order bits (7-4) - _serial.write(OP_ARB | ((value & 0x000000F0) >> 4)); + _serial.write(OP_ARB | ((writeVal & 0x000000F0) >> 4)); _serial.flush(); } @@ -362,7 +368,6 @@ agent.on("digitalRead", function(data) { } else { server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); } - activityLED.write(0); }); agent.on("analogRead", function(data) { From 5aeda0fd8cd0a2f114e4cb5caee0a63d6074c19b Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 12:57:16 -0500 Subject: [PATCH 20/34] Add MIT License --- hardware/impeeduino/LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 hardware/impeeduino/LICENSE diff --git a/hardware/impeeduino/LICENSE b/hardware/impeeduino/LICENSE new file mode 100644 index 0000000..e49d082 --- /dev/null +++ b/hardware/impeeduino/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Electric Imp + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. From 84b21fbf5f360faf2f90215c357fe3ea705858a0 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 12:57:29 -0500 Subject: [PATCH 21/34] Update introduction, add License --- hardware/impeeduino/README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hardware/impeeduino/README.md b/hardware/impeeduino/README.md index 5456f2e..308a0ec 100644 --- a/hardware/impeeduino/README.md +++ b/hardware/impeeduino/README.md @@ -1,9 +1,13 @@ # Impeeduino 0.0.? -This Impeeduino is a mashup of an imp001 and an Arduino. This library provides a simple way to instruct the Arduino side of the Impeeduino to perform basic tasks over UART. +The Impeeduino is a combination of an imp001 and an Arduino. This library provides a simple way to instruct the Arduino side of the Impeeduino to perform basic tasks over UART. + +The Impeeduino squirrel library contained in `impeeduino.class.nut` pairs with the [impeeduino Arduino project](./arduino/impeeduino). More details on the underlying UART communication scheme and instructions on taking advantage of the user-modifiable function call system can be found in the corresponding [Readme file](./arduino/impeeduino/README.md). + +To upload Arduino code onto the Impeeduino's ATmega328, an [Impeeduino Programmer model](./programmer) is provided. This model includes agent and device code for programming the Arduino via an Imp with a HEX file generated from the Arduino IDE. ## Class Usage @@ -156,6 +160,4 @@ impeeduino.functionCall(1, "This is the argument", function(value) { ## Licence - \ No newline at end of file +The Impeeduino library is provided under the [MIT License](./LICENSE). \ No newline at end of file From 743044194419c8be1b401c42a19db0c1b0d8e016 Mon Sep 17 00:00:00 2001 From: Sunny He Date: Sun, 6 Nov 2016 13:12:22 -0500 Subject: [PATCH 22/34] Update README.md --- hardware/impeeduino/programmer/README.md | 32 ++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/hardware/impeeduino/programmer/README.md b/hardware/impeeduino/programmer/README.md index 5574a94..3d8cb0b 100644 --- a/hardware/impeeduino/programmer/README.md +++ b/hardware/impeeduino/programmer/README.md @@ -1,9 +1,23 @@ -Impeedunio Programmer -===================== +# Impeedunio Programmer -This firmware will allow you to program the ATmega328 built into the Impduino. +This firmware will allow you to program the ATmega328 built into the Impeeduino. It parses Intel HEX files delivered via HTTP POST (form) and implements the STK500v1 serial protocol to talk to the connected ATmega328. + +## Usage + +This is not a library class. It represents an entire application for programming the Arduino via an Imp with a HEX file. +### Hardware Setup +1. Insert an imp001 into the SD card slot on the left side of the board. +2. Then power the board via either the 7-12V DC jack or the USB connector. The green LED should light up to indicate power is connected. +3. [Blink up](https://electricimp.com/docs/gettingstarted/blinkup/) the imp001 to your account and assign it to a new model. +4. Copy the squirrel code in [impeeduino_programmer.agent.nut](./impeeduino_programmer.agent.nut) to the agent section and the code in [impeeduino_programmer.device.nut](./impeeduino_programmer.device.nut) to the device section. +5. Hit "Build and Run," and verify that the agent and device restart in the log console. +6. Visit the agent URL in a browser and follow the instructions to upload a `.HEX` file generated from the Arduino IDE. + +## Burning a Bootloader +The ATmega328 processors built into the Impeeduinos does not come with the bootloader preinstalled. In order to upload code over the serial port, it is necessary to install a compatible bootloader. This is a one-time operation that only has to be performed on new Impeeduino boards. + You will need to install the "[optiboot](https://code.google.com/p/optiboot/)" bootloader using an ICSP cable. At the time of writing, the latest version was [v5.0a](https://code.google.com/p/optiboot/downloads/detail?name=optiboot-v5.0a.zip). To do this you will need an ISP or use [another Ardiuno as the ISP](http://arduino.cc/en/Tutorial/ArduinoISP) and the ArduinoISP sketch. @@ -18,15 +32,7 @@ Once the ATMega is programmed you can continue to talk to it over the serial por Note, if you are using the [SparkFun Imp Shield](https://www.sparkfun.com/products/11401) then you may need to reverse the logic of the RESET pin. Where you see RESET.write(1), change it to RESET.write(0) and vice versa. - -Contributors -============ +## Contributors - Aron - -Usage -===== - -This is not a library class. It represents an entire application for programming the Arduino via an Imp with a HEX file. -You can adapt it to your needs, such as combining the programming functionality with application level communication. - +- Sunny (Update documentation) From 68c6ebd2b78e03d5b4a936b0a974f7a9069a5757 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 13:13:16 -0500 Subject: [PATCH 23/34] Rename programmer source files --- .../{impeeduino.agent.nut => impeeduino_programmer.agent.nut} | 0 .../{impeeduino.device.nut => impeeduino_programmer.device.nut} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename hardware/impeeduino/programmer/{impeeduino.agent.nut => impeeduino_programmer.agent.nut} (100%) rename hardware/impeeduino/programmer/{impeeduino.device.nut => impeeduino_programmer.device.nut} (100%) diff --git a/hardware/impeeduino/programmer/impeeduino.agent.nut b/hardware/impeeduino/programmer/impeeduino_programmer.agent.nut similarity index 100% rename from hardware/impeeduino/programmer/impeeduino.agent.nut rename to hardware/impeeduino/programmer/impeeduino_programmer.agent.nut diff --git a/hardware/impeeduino/programmer/impeeduino.device.nut b/hardware/impeeduino/programmer/impeeduino_programmer.device.nut similarity index 100% rename from hardware/impeeduino/programmer/impeeduino.device.nut rename to hardware/impeeduino/programmer/impeeduino_programmer.device.nut From 0989cf1908b8d25d2e5fa2a98d9861b99d523c18 Mon Sep 17 00:00:00 2001 From: Sunny He Date: Sun, 6 Nov 2016 13:14:19 -0500 Subject: [PATCH 24/34] Update README.md --- hardware/impeeduino/programmer/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hardware/impeeduino/programmer/README.md b/hardware/impeeduino/programmer/README.md index 3d8cb0b..70b166a 100644 --- a/hardware/impeeduino/programmer/README.md +++ b/hardware/impeeduino/programmer/README.md @@ -36,3 +36,7 @@ logic of the RESET pin. Where you see RESET.write(1), change it to RESET.write(0 - Aron - Sunny (Update documentation) + +## License + +The Impeeduino programmer is provided under the [MIT License](../LICENSE). From f7a0c714898ac667cd6d7d210ec2e98678e66ce1 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 21:26:48 -0500 Subject: [PATCH 25/34] Start on function call demo --- .../arduino/impeeduino/impeeduino.ino | 70 ++-- .../impeeduino/impeeduino.ino.standard.hex | 375 +++++++++++------- ...mpeeduino.ino.with_bootloader.standard.hex | 375 +++++++++++------- 3 files changed, 496 insertions(+), 324 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index e99c674..d3df7fa 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,4 +1,4 @@ -#define VERSION "0.0.2" +#define VERSION "0.0.3" #define BAUD_RATE 115200 #define DELAY_WRITE 50 @@ -32,45 +32,47 @@ unsigned int rxOp = 0; char rxbuffer[128]; int rxbufferindex = 0; -char* function00(char* buf) { return buf; } -char* function01(char* buf) { return buf; } -char* function02(char* buf) { return buf; } -char* function03(char* buf) { return buf; } -char* function04(char* buf) { return buf; } -char* function05(char* buf) { return buf; } -char* function06(char* buf) { return buf; } -char* function07(char* buf) { return buf; } -char* function08(char* buf) { return buf; } -char* function09(char* buf) { return buf; } -char* function0A(char* buf) { return buf; } -char* function0B(char* buf) { return buf; } -char* function0C(char* buf) { return buf; } -char* function0D(char* buf) { return buf; } -char* function0E(char* buf) { return buf; } -char* function0F(char* buf) { return buf; } +// ========== USER-DEFINED FUNCTIONS ========== // +const char* function01(char* buf) { + return String(millis()).c_str(); +} +const char* function02(char* buf) { return buf; } +const char* function03(char* buf) { return buf; } +const char* function04(char* buf) { return buf; } +const char* function05(char* buf) { return buf; } +const char* function06(char* buf) { return buf; } +const char* function07(char* buf) { return buf; } +const char* function08(char* buf) { return buf; } +const char* function09(char* buf) { return buf; } +const char* function0A(char* buf) { return buf; } +const char* function0B(char* buf) { return buf; } +const char* function0C(char* buf) { return buf; } +const char* function0D(char* buf) { return buf; } +const char* function0E(char* buf) { return buf; } +const char* function0F(char* buf) { return buf; } -char* function10(char* buf) { return buf; } -char* function11(char* buf) { return buf; } -char* function12(char* buf) { return buf; } -char* function13(char* buf) { return buf; } -char* function14(char* buf) { return buf; } -char* function15(char* buf) { return buf; } -char* function16(char* buf) { return buf; } -char* function17(char* buf) { return buf; } -char* function18(char* buf) { return buf; } -char* function19(char* buf) { return buf; } -char* function1A(char* buf) { return buf; } -char* function1B(char* buf) { return buf; } -char* function1C(char* buf) { return buf; } -char* function1D(char* buf) { return buf; } -char* function1E(char* buf) { return buf; } +const char* function10(char* buf) { return buf; } +const char* function11(char* buf) { return buf; } +const char* function12(char* buf) { return buf; } +const char* function13(char* buf) { return buf; } +const char* function14(char* buf) { return buf; } +const char* function15(char* buf) { return buf; } +const char* function16(char* buf) { return buf; } +const char* function17(char* buf) { return buf; } +const char* function18(char* buf) { return buf; } +const char* function19(char* buf) { return buf; } +const char* function1A(char* buf) { return buf; } +const char* function1B(char* buf) { return buf; } +const char* function1C(char* buf) { return buf; } +const char* function1D(char* buf) { return buf; } +const char* function1E(char* buf) { return buf; } void setup() { - // put your setup code here, to run once: Serial.begin(BAUD_RATE); Serial.print("Impeeduino Version: "); Serial.println(VERSION); + Serial.write(OP_CALL0); Serial.flush(); } @@ -138,7 +140,7 @@ void loop() { // Call Function Op: 111X rxbuffer[rxbufferindex] = '\0'; switch (rxByte & MASK_CALL) { - case 0x00: Serial.write(function00(rxbuffer)); break; + case 0x00: Serial.write(rxbuffer); break; case 0x01: Serial.write(function01(rxbuffer)); break; case 0x02: Serial.write(function02(rxbuffer)); break; case 0x03: Serial.write(function03(rxbuffer)); break; diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex index 4445fa5..2743e7d 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C9404030C94A9000C94D2020C94AC02FE +:100040000C9409030C94A9000C94D7020C94B102EF :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9000A050A050A050A05C2 -:100070000A050A050A050A050A050A050A050A0508 -:100080000A050A050A050A050A050A050A050A05F8 -:100090000A050A050A050A050A050A050A050A05E8 -:1000A0000A050A050A0500000000240027002A00AE +:100060000C94A9000C94A900400519054005400511 +:100070004005400540054005400540054005400558 +:100080004005400540054005400540054005400548 +:100090004005400540054005400540054005400538 +:1000A00040054005400500000000240027002A000C :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:10010000370511241FBECFEFD8E0DEBFCDBF11E011 -:10011000A0E0B1E0E2EEFAE002C005900D92AA3351 -:10012000B107D9F722E0AAE3B1E001C01D92A636DB +:100100006F0511241FBECFEFD8E0DEBFCDBF11E0D9 +:10011000A0E0B1E0E2E3F0E102C005900D92A0346E +:10012000B107D9F722E0A0E4B1E001C01D92A037E9 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E946405C038D107C9F70E944E030C9481 -:100150006F050C940000CF92DF92EF92FF920F9305 +:100140000E949C05C038D107C9F70E9453030C9444 +:1001500017080C940000CF92DF92EF92FF920F935A :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F739927089589EC91E00E94F80075 +:1002000091098F73992708958FEC91E00E94F8006F :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -44,137 +44,222 @@ :1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B :1002C000EA89FB898081806207C0EE89FF896083AB :1002D000E889F98980818064808381E090E0DF9102 -:1002E000CF911F910F91FF90EF900895682F89ECA7 -:1002F00091E00C942F01CF93DF93EC01888D88233C -:10030000C9F0EA89FB89808185FD05C0A889B98982 -:100310008C9186FD0FC00FB607FCF5CF808185FF5D -:10032000F2CFA889B9898C9185FFEDCFCE010E94CB -:100330000E01E7CFDF91CF91089580E090E0892B07 -:1003400029F00E94040181110C940000089583306B -:1003500081F028F4813099F08230A1F0089587303F -:10036000A9F08830B9F08430D1F4809180008F7D7D -:1003700003C0809180008F7780938000089584B5BA -:100380008F7702C084B58F7D84BD08958091B000C1 -:100390008F7703C08091B0008F7D8093B000089567 -:1003A0001F93CF93DF93282F30E0F901E451FF4FE3 -:1003B0008491F901E852FF4FD491F901EC53FF4FBA -:1003C000C491CC23C9F0162F81110E94A701EC2FF4 -:1003D000F0E0EE0FFF1FE055FF4FA591B4918FB7EE -:1003E000F894111105C09C91ED2FE095E92302C00E -:1003F000EC91ED2BEC938FBFDF91CF911F9108957E -:10040000CF93DF9390E0FC01E852FF4F2491FC0171 -:10041000EC53FF4F8491882361F190E0880F991F7E -:10042000FC01EA55FF4FC591D491FC01E055FF4F07 -:10043000A591B491611109C09FB7F8948881209566 -:1004400082238883EC912E230BC0623061F49FB726 -:10045000F8943881822F809583238883EC912E2B0A -:100460002C939FBF06C08FB7F894E8812E2B28836A -:100470008FBFDF91CF9108953FB7F89480913F01EE -:1004800090914001A0914101B091420126B5A89BF5 -:1004900005C02F3F19F00196A11DB11D3FBFBA2F16 -:1004A000A92F982F8827820F911DA11DB11DBC0176 -:1004B000CD0142E0660F771F881F991F4A95D1F73B -:1004C00008958F929F92AF92BF92CF92DF92EF9258 -:1004D000FF920E943C024B015C0182E3C82ED12CAA -:1004E000E12CF12C0E943C02DC01CB018819990916 -:1004F000AA09BB09883E9340A105B10558F021E047 -:10050000C21AD108E108F10888EE880E83E0981E2F -:10051000A11CB11CC114D104E104F10419F7FF902E -:10052000EF90DF90CF90BF90AF909F908F90089505 -:10053000009769F0FC0101900020E9F73197AF01C5 -:10054000481B590BBC0189EC91E00C94AB0080E096 -:1005500090E008950E946A051F920F920FB60F92C5 -:1005600011242F933F934F935F936F937F938F93B8 -:100570009F93AF93BF93EF93FF9389EC91E00E9419 -:100580000E01FF91EF91BF91AF919F918F917F915C -:100590006F915F914F913F912F910F900FBE0F90F0 -:1005A0001F9018951F920F920FB60F9211242F9340 -:1005B0008F939F93EF93FF93E091D901F091DA012C -:1005C0008081E091DF01F091E00182FD12C0908115 -:1005D0008091E2018F5F8F732091E301821751F0C8 -:1005E000E091E201F0E0E753FE4F958F8093E20146 -:1005F00001C08081FF91EF919F918F912F910F907A -:100600000FBE0F901F9018951F920F920FB60F926A -:1006100011242F933F938F939F93AF93BF93809118 -:100620003B0190913C01A0913D01B0913E01309180 -:100630003A0123E0230F2D3720F40196A11DB11DAF -:1006400005C026E8230F0296A11DB11D20933A0193 -:1006500080933B0190933C01A0933D01B0933E01F8 -:1006600080913F0190914001A0914101B0914201E0 -:100670000196A11DB11D80933F0190934001A0936D -:100680004101B0934201BF91AF919F918F913F91F2 -:100690002F910F900FBE0F901F901895789484B5EE -:1006A000826084BD84B5816084BD85B5826085BD6E -:1006B00085B5816085BD80916E00816080936E00FC -:1006C00010928100809181008260809381008091EE -:1006D000810081608093810080918000816080939F -:1006E00080008091B10084608093B1008091B0005F -:1006F00081608093B00080917A00846080937A005A -:1007000080917A00826080937A0080917A00816083 -:1007100080937A0080917A00806880937A001092AA -:10072000C100E091D901F091DA0182E08083E0918B -:10073000D501F091D6011082E091D701F091D80156 -:1007400080E180831092E101E091DD01F091DE0112 -:1007500086E08083E091DB01F091DC0180818061A3 -:100760008083E091DB01F091DC01808188608083EF -:10077000E091DB01F091DC01808180688083E09171 -:10078000DB01F091DC0180818F7D80838CE191E041 -:100790000E94980281E391E00E94980287E391E031 -:1007A0000E94980289EC91E00E947B0189EC91E023 -:1007B0000E94F800892B09F44BC189EC91E00E945A -:1007C000D600C82F082E000C990B9093C801809377 -:1007D000C70187FF30C19C01207F33273093C601BA -:1007E0002093C5012039310511F5CF702C2F30E051 -:1007F000F901E451FF4F8491F901E852FF4F149140 -:10080000F901EC53FF4FD491DD2309F424C1811188 -:100810000E94A701ED2FF0E0EE0FFF1FE654FF4FFF -:10082000A591B491EC91E12309F415C119C1203AC5 -:10083000310511F460E004C0203B310541F461E072 -:100840008C2F8F700E94D0010E94610201C1203C58 -:10085000310509F0ABC00C2F0770C3FF72C0002E2A -:10086000000C110B89EC91E00E94F8000297D4F380 -:1008700089EC91E00E94D600C82FCF7089EC91E0FE -:100880000E94D60024E0880F991F2A95E1F7C82B13 -:10089000000F111FF801E05FFE4F0081118161E040 -:1008A000802F0E940002CC2309F446C0F801FF27E4 -:1008B000E451FF4FE491E33011F148F4E130D1F01D -:1008C000E230D1F584B5806284BDC8BDC1C0E730D7 -:1008D00019F1E83049F1E43079F5809180008062C7 -:1008E000809380000C2E000CDD0BD0938B00C09306 -:1008F0008A00AEC084B5806884BDC7BDA9C08091A0 -:1009000080008068809380000C2E000CDD0BD0935B -:100910008900C09388009CC08091B000806880935B -:10092000B000C093B30094C08091B0008062809307 -:10093000B000C093B4008CC060E0802F0E94D00152 -:1009400087C00E947601006400937C0080917A0049 -:10095000806480937A0080917A0086FDFCCFC091FC -:10096000780080917900D0E0D82BBE016F70772796 -:10097000606D89EC91E00E942F01BE0184E07595C5 -:1009800067958A95E1F76F707727606D89EC91E044 -:100990000E942F016D2F772767FD7A956F7077275B -:1009A000606D89EC91E00E942F0152C02038310522 -:1009B000C9F489EC91E00E94D6008F7099278130AC -:1009C000910541F08230910539F0892B09F040C042 -:1009D00060E003C062E001C061E08C2F8F700E9474 -:1009E000000236C0203D310599F1E091C301F0913C -:1009F000C401ED5BFE4F1082EC2FEF710E2E000C48 -:100A0000FF0BEF31F10540F4EC5CFF4F83E491E024 -:100A10000C9464050E9498028091C7019091C801CE -:100A20000E94760189EC91E00E947B011092C40142 -:100A30001092C3010DC08091C3019091C401FC01CB -:100A4000ED5BFE4FC08301969093C4018093C30178 -:100A50000E949D01ABCE8C2FCC0F990B806A04C0F5 -:100A60008C2FCC0F990B806B0E947601F1CFE9ECB3 -:100A7000F1E01382128288EE93E0A0E0B0E084837C -:100A80009583A683B78384E091E09183808385EC8E -:100A900090E09587848784EC90E09787868780EC48 -:100AA00090E0918B808B81EC90E0938B828B82EC39 -:100AB00090E0958B848B86EC90E0978B868B118EE3 -:100AC000128E138E148E0895EE0FFF1F0590F49171 -:100AD000E02D099481E090E0F8940C946F05F8946F -:020AE000FFCF46 -:100AE200000000002F01AB00F800D600EA007B01F5 -:100AF20003000500060009000A000B00496D70653D -:100B0200656475696E6F2056657273696F6E3A20FF -:0A0B120000302E302E32000D0A00D4 +:1002E000CF911F910F91FF90EF900895682F8FECA1 +:1002F00091E00C942F01682F8FEC91E00C942F016A +:10030000CF93DF93EC01888D8823C9F0EA89FB89BC +:10031000808185FD05C0A889B9898C9186FD0FC0B3 +:100320000FB607FCF5CF808185FFF2CFA889B98988 +:100330008C9185FFEDCFCE010E940E01E7CFDF91BA +:10034000CF91089580E090E0892B29F00E9404016C +:1003500081110C9400000895833081F028F48130DD +:1003600099F08230A1F008958730A9F08830B9F073 +:100370008430D1F4809180008F7D03C08091800013 +:100380008F7780938000089584B58F7702C084B5FD +:100390008F7D84BD08958091B0008F7703C08091D8 +:1003A000B0008F7D8093B00008951F93CF93DF93AB +:1003B000282F30E0F901E451FF4F8491F901E85210 +:1003C000FF4FD491F901EC53FF4FC491CC23C9F0F6 +:1003D000162F81110E94AC01EC2FF0E0EE0FFF1FF1 +:1003E000E055FF4FA591B4918FB7F894111105C056 +:1003F0009C91ED2FE095E92302C0EC91ED2BEC935D +:100400008FBFDF91CF911F910895CF93DF9390E03D +:10041000FC01E852FF4F2491FC01EC53FF4F849103 +:10042000882361F190E0880F991FFC01EA55FF4F86 +:10043000C591D491FC01E055FF4FA591B491611194 +:1004400009C09FB7F8948881209582238883EC9116 +:100450002E230BC0623061F49FB7F8943881822F4D +:10046000809583238883EC912E2B2C939FBF06C00D +:100470008FB7F894E8812E2B28838FBFDF91CF911F +:1004800008953FB7F8948091410190914201A09165 +:100490004301B091440126B5A89B05C02F3F19F038 +:1004A0000196A11DB11D3FBFBA2FA92F982F8827F4 +:1004B000820F911DA11DB11DBC01CD0142E0660F4F +:1004C000771F881F991F4A95D1F708958F929F92A1 +:1004D000AF92BF92CF92DF92EF92FF920E944102C1 +:1004E0004B015C0182E3C82ED12CE12CF12C0E943F +:1004F0004102DC01CB0188199909AA09BB09883E90 +:100500009340A105B10558F021E0C21AD108E108D5 +:10051000F10888EE880E83E0981EA11CB11CC1145E +:10052000D104E104F10419F7FF90EF90DF90CF9030 +:10053000BF90AF909F908F900895009769F0FC0155 +:1005400001900020E9F73197AF01481B590BBC011E +:100550008FEC91E00C94AB0080E090E008950E9455 +:1005600099071F920F920FB60F9211242F933F936A +:100570004F935F936F937F938F939F93AF93BF93AB +:10058000EF93FF938FEC91E00E940E01FF91EF91AA +:10059000BF91AF919F918F917F916F915F914F919B +:1005A0003F912F910F900FBE0F901F9018951F92A3 +:1005B0000F920FB60F9211242F938F939F93EF9367 +:1005C000FF93E091DF01F091E0018081E091E5018E +:1005D000F091E60182FD12C090818091E8018F5F69 +:1005E0008F732091E901821751F0E091E801F0E06A +:1005F000E153FE4F958F8093E80101C08081FF9108 +:10060000EF919F918F912F910F900FBE0F901F90A0 +:1006100018951F920F920FB60F9211242F933F93AC +:100620008F939F93AF93BF93809145019091460123 +:10063000A0914701B09148013091400123E0230F80 +:100640002D3720F40196A11DB11D05C026E8230F0A +:100650000296A11DB11D2093400180934501909306 +:100660004601A0934701B0934801809141019091C8 +:100670004201A0914301B09144010196A11DB11D19 +:100680008093410190934201A0934301B0934401B0 +:10069000BF91AF919F918F913F912F910F900FBE7E +:1006A0000F901F901895CF93DF93CDB7DEB7A1972A +:1006B0000FB6F894DEBF0FBECDBF789484B58260CC +:1006C00084BD84B5816084BD85B5826085BD85B5F6 +:1006D000816085BD80916E00816080936E00109274 +:1006E00081008091810082608093810080918100EF +:1006F0008160809381008091800081608093800080 +:100700008091B10084608093B1008091B0008160DD +:100710008093B00080917A00846080937A00809109 +:100720007A00826080937A0080917A008160809361 +:100730007A0080917A00806880937A001092C100DC +:10074000E091DF01F091E00182E08083E091DB0144 +:10075000F091DC011082E091DD01F091DE0180E199 +:1007600080831092E701E091E301F091E40186E0DB +:100770008083E091E101F091E201808180618083DA +:10078000E091E101F091E201808188608083E09155 +:10079000E101F091E201808180688083E091E101D4 +:1007A000F091E20180818F7D808382E291E00E945E +:1007B0009D0287E391E00E949D028DE391E00E94FB +:1007C0009D0280EE90E00E947B018FEC91E00E9400 +:1007D0008001CE0101967C018FEC91E00E94F8002F +:1007E000892B09F46DC18FEC91E00E94D600182F7F +:1007F000082E000C990B9093CE018093CD0187FFBA +:1008000052C19C01207F33273093CC012093CB0130 +:100810002039310511F51F70212F30E0F901E45125 +:10082000FF4F8491F901E852FF4FD490F901EC5346 +:10083000FF4F0491002309F446C181110E94AC01CD +:10084000E02FF0E0EE0FFF1FE654FF4FA591B491AB +:10085000EC91ED2109F437C13BC1203A310511F487 +:1008600060E004C0203B310541F461E0812F8F70CE +:100870000E94D5010E94660223C1203C310509F087 +:10088000A5C0012F077013FF72C0002E000C110BC2 +:100890008FEC91E00E94F8000297D4F38FEC91E086 +:1008A0000E94D6008F70D82E8FEC91E00E94D60067 +:1008B00044E0880F991F4A95E1F7D82A000F111FCD +:1008C000F801EA5EFE4F0081118161E0802F0E94F5 +:1008D0000502DD2009F446C0F801FF27E451FF4F6F +:1008E000E491E33011F148F4E130D1F0E230D1F598 +:1008F00084B5806284BDD8BCE3C0E73019F1E8302C +:1009000049F1E43079F58091800080628093800025 +:100910008D2DDD0C990B90938B0080938A00D0C0B5 +:1009200084B5806884BDD7BCCBC0809180008068CE +:10093000809380008D2DDD0C990B9093890080931E +:100940008800BEC08091B00080688093B000D092D3 +:10095000B300B6C08091B00080628093B000D092A6 +:10096000B400AEC060E0802F0E94D501A9C00E94F3 +:100970007601006400937C0080917A00806480930B +:100980007A0080917A0086FDFCCF009178008091FA +:10099000790010E0182BC8018F709927806D0E9494 +:1009A0007B01C80124E0959587952A95E1F78F7022 +:1009B0009927806D0E947B01812F992787FD9A9549 +:1009C0008F709927806D0E947B017AC02038310595 +:1009D000C9F48FEC91E00E94D6008F709927813086 +:1009E000910541F08230910539F0892B09F068C0FA +:1009F00060E003C062E001C061E0812F8F700E945F +:100A000005025EC0203D310509F45AC0E091C901DC +:100A1000F091CA01E75BFE4F1082E12FEF710E2EBD +:100A2000000CFF0BEF31F10578F5EC5CFF4F0C94F7 +:100A30009C052FB7F8946091450170914601809113 +:100A40004701909148012FBF2AE0A7010E94AE07FD +:100A5000F70101900020E9F7BF016E197F0980E0DE +:100A600090E00E94CF068C01009729F0FC011082D3 +:100A7000B7010E94A707C8010E943706C80102C03B +:100A800089E491E00E949D028091CD019091CE0178 +:100A90000E9476018FEC91E00E9480011092CA01C1 +:100AA0001092C9010DC08091C9019091CA01FC0149 +:100AB000E75BFE4F108301969093CA018093C901B2 +:100AC0000E94A20189CE812F110F990B806A04C068 +:100AD000812F110F990B806B0E947601F1CFEFEC03 +:100AE000F1E01382128288EE93E0A0E0B0E084830C +:100AF0009583A683B7838AE091E09183808385EC18 +:100B000090E09587848784EC90E09787868780ECD7 +:100B100090E0918B808B81EC90E0938B828B82ECC8 +:100B200090E0958B848B86EC90E0978B868B118E72 +:100B3000128E138E148E0895EE0FFF1F0590F49100 +:100B4000E02D0994CF93DF938230910510F482E079 +:100B500090E0E0916E02F0916F0220E030E0C0E0A2 +:100B6000D0E0309711F14081518148175907C0F00A +:100B70004817590761F482819381209719F09B836C +:100B80008A832BC090936F0280936E0226C021153A +:100B9000310519F04217530718F49A01BE01DF011D +:100BA000EF010280F381E02DDCCF2115310509F141 +:100BB000281B390B2430310590F412968D919C91AD +:100BC00013976115710521F0FB019383828304C0A3 +:100BD00090936F0280936E02FD01329644C0FD0136 +:100BE000E20FF31F81939193225031092D933C938F +:100BF0003AC020916C0230916D02232B41F4209178 +:100C000002013091030130936D0220936C02209118 +:100C10000001309101012115310541F42DB73EB796 +:100C20004091040150910501241B350BE0916C02A9 +:100C3000F0916D02E217F307A0F42E1B3F0B28176B +:100C4000390778F0AC014E5F5F4F2417350748F045 +:100C50004E0F5F1F50936D0240936C0281939193EE +:100C600002C0E0E0F0E0CF01DF91CF9108950F9353 +:100C70001F93CF93DF93009709F48CC0FC01329748 +:100C80001382128200916E0210916F0201151105FC +:100C900081F420813181820F931F20916C02309169 +:100CA0006D022817390779F5F0936D02E0936C0215 +:100CB00071C0D80140E050E0AE17BF0750F4129663 +:100CC0002D913C911397AD012115310509F1D90101 +:100CD000F3CF9D01DA013383228360817181860F16 +:100CE000971F8217930769F4EC0128813981260F39 +:100CF000371F2E5F3F4F318320838A819B819383EF +:100D00008283452B29F4F0936F02E0936E0242C078 +:100D10001396FC93EE931297ED01499159919E0120 +:100D2000240F351FE217F30771F480819181840F3E +:100D3000951F029611969C938E93828193811396B0 +:100D40009C938E931297E0E0F0E0D80112968D917B +:100D50009C911397009719F0F8018C01F6CF8D91B3 +:100D60009C9198012E5F3F4F820F931F20916C0240 +:100D700030916D022817390769F4309729F41092E1 +:100D80006F0210926E0202C01382128210936D02E3 +:100D900000936C02DF91CF911F910F910895A0E015 +:100DA000B0E0E5EDF6E00C94E407EC01009721F4E7 +:100DB000CB010E94A205B8C0FC01E60FF71F9C0101 +:100DC00022503109E217F30708F4ACC0D9010D91A4 +:100DD0001C91119706171707B0F00530110508F49C +:100DE0009FC0C80104978617970708F499C002505E +:100DF0001109061B170B019311936D937C93CF017F +:100E00000E9437068DC05B01A01AB10A4C01800E0A +:100E1000911EA0916E02B0916F0240E050E0E12C73 +:100E2000F12C109709F44AC0A815B905D1F56D90B9 +:100E30007C901197630182E0C80ED11CCA14DB04B8 +:100E400080F1A3014A195B096A0182E0C80ED11C36 +:100E50001296BC9012971396AC91B5E0CB16D104C4 +:100E600040F0B282A38351834083D9016D937C9378 +:100E70000AC00E5F1F4FC301800F911FF9019183BC +:100E80008083EB2DFA2FE114F10431F0D701139692 +:100E9000FC93EE93129744C0F0936F02E0936E02BE +:100EA0003FC08D919C9111974817590708F4AC01E8 +:100EB0007D0112960D90BC91A02DB3CF80916C0254 +:100EC00090916D0288159905E1F446175707C8F40B +:100ED0008091000190910101009741F48DB79EB778 +:100EE0004091040150910501841B950BE817F90707 +:100EF000C8F4F0936D02E0936C02F9017183608392 +:100F00000FC0CB010E94A2057C01009759F0A801F7 +:100F1000BE010E949E07CE010E943706C70104C091 +:100F2000CE0102C080E090E0CDB7DEB7EEE00C94D9 +:100F3000000881E090E0F8940C941708FB01DC01B4 +:100F400002C001900D9241505040D8F70895FB0126 +:100F5000DC0101900D920020E1F70895BB27FA0112 +:100F6000A62F6217710581059105330B30FB66F0E2 +:100F7000AA27660F771F881F991FAA1FA21710F0B4 +:100F8000A21B63953850A9F7A05DAA3308F0A95DAC +:100F9000A19336F7B111B1931082CA010C94D00716 +:100FA000DC01FC01672F71917723E1F7329704C0D0 +:100FB0007C916D9370836291AE17BF07C8F308955B +:100FC0002F923F924F925F926F927F928F929F9259 +:100FD000AF92BF92CF92DF92EF92FF920F931F9347 +:100FE000CF93DF93CDB7DEB7CA1BDB0B0FB6F894F8 +:100FF000DEBF0FBECDBF09942A88398848885F8438 +:101000006E847D848C849B84AA84B984C884DF80A8 +:10101000EE80FD800C811B81AA81B981CE0FD11D8C +:101020000FB6F894DEBF0FBECDBFED010895F89462 +:02103000FFCFF0 +:10103200000070028000000000002F01AB00F800E9 +:10104200D600EA00800103000500060009000A003C +:101052000B00496D7065656475696E6F2056657227 +:1010620073696F6E3A2000302E302E33000D0A0065 :00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex index 05ba621..f5ef9d9 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C9404030C94A9000C94D2020C94AC02FE +:100040000C9409030C94A9000C94D7020C94B102EF :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9000A050A050A050A05C2 -:100070000A050A050A050A050A050A050A050A0508 -:100080000A050A050A050A050A050A050A050A05F8 -:100090000A050A050A050A050A050A050A050A05E8 -:1000A0000A050A050A0500000000240027002A00AE +:100060000C94A9000C94A900400519054005400511 +:100070004005400540054005400540054005400558 +:100080004005400540054005400540054005400548 +:100090004005400540054005400540054005400538 +:1000A00040054005400500000000240027002A000C :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:10010000370511241FBECFEFD8E0DEBFCDBF11E011 -:10011000A0E0B1E0E2EEFAE002C005900D92AA3351 -:10012000B107D9F722E0AAE3B1E001C01D92A636DB +:100100006F0511241FBECFEFD8E0DEBFCDBF11E0D9 +:10011000A0E0B1E0E2E3F0E102C005900D92A0346E +:10012000B107D9F722E0A0E4B1E001C01D92A037E9 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E946405C038D107C9F70E944E030C9481 -:100150006F050C940000CF92DF92EF92FF920F9305 +:100140000E949C05C038D107C9F70E9453030C9444 +:1001500017080C940000CF92DF92EF92FF920F935A :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F739927089589EC91E00E94F80075 +:1002000091098F73992708958FEC91E00E94F8006F :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -44,139 +44,224 @@ :1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B :1002C000EA89FB898081806207C0EE89FF896083AB :1002D000E889F98980818064808381E090E0DF9102 -:1002E000CF911F910F91FF90EF900895682F89ECA7 -:1002F00091E00C942F01CF93DF93EC01888D88233C -:10030000C9F0EA89FB89808185FD05C0A889B98982 -:100310008C9186FD0FC00FB607FCF5CF808185FF5D -:10032000F2CFA889B9898C9185FFEDCFCE010E94CB -:100330000E01E7CFDF91CF91089580E090E0892B07 -:1003400029F00E94040181110C940000089583306B -:1003500081F028F4813099F08230A1F0089587303F -:10036000A9F08830B9F08430D1F4809180008F7D7D -:1003700003C0809180008F7780938000089584B5BA -:100380008F7702C084B58F7D84BD08958091B000C1 -:100390008F7703C08091B0008F7D8093B000089567 -:1003A0001F93CF93DF93282F30E0F901E451FF4FE3 -:1003B0008491F901E852FF4FD491F901EC53FF4FBA -:1003C000C491CC23C9F0162F81110E94A701EC2FF4 -:1003D000F0E0EE0FFF1FE055FF4FA591B4918FB7EE -:1003E000F894111105C09C91ED2FE095E92302C00E -:1003F000EC91ED2BEC938FBFDF91CF911F9108957E -:10040000CF93DF9390E0FC01E852FF4F2491FC0171 -:10041000EC53FF4F8491882361F190E0880F991F7E -:10042000FC01EA55FF4FC591D491FC01E055FF4F07 -:10043000A591B491611109C09FB7F8948881209566 -:1004400082238883EC912E230BC0623061F49FB726 -:10045000F8943881822F809583238883EC912E2B0A -:100460002C939FBF06C08FB7F894E8812E2B28836A -:100470008FBFDF91CF9108953FB7F89480913F01EE -:1004800090914001A0914101B091420126B5A89BF5 -:1004900005C02F3F19F00196A11DB11D3FBFBA2F16 -:1004A000A92F982F8827820F911DA11DB11DBC0176 -:1004B000CD0142E0660F771F881F991F4A95D1F73B -:1004C00008958F929F92AF92BF92CF92DF92EF9258 -:1004D000FF920E943C024B015C0182E3C82ED12CAA -:1004E000E12CF12C0E943C02DC01CB018819990916 -:1004F000AA09BB09883E9340A105B10558F021E047 -:10050000C21AD108E108F10888EE880E83E0981E2F -:10051000A11CB11CC114D104E104F10419F7FF902E -:10052000EF90DF90CF90BF90AF909F908F90089505 -:10053000009769F0FC0101900020E9F73197AF01C5 -:10054000481B590BBC0189EC91E00C94AB0080E096 -:1005500090E008950E946A051F920F920FB60F92C5 -:1005600011242F933F934F935F936F937F938F93B8 -:100570009F93AF93BF93EF93FF9389EC91E00E9419 -:100580000E01FF91EF91BF91AF919F918F917F915C -:100590006F915F914F913F912F910F900FBE0F90F0 -:1005A0001F9018951F920F920FB60F9211242F9340 -:1005B0008F939F93EF93FF93E091D901F091DA012C -:1005C0008081E091DF01F091E00182FD12C0908115 -:1005D0008091E2018F5F8F732091E301821751F0C8 -:1005E000E091E201F0E0E753FE4F958F8093E20146 -:1005F00001C08081FF91EF919F918F912F910F907A -:100600000FBE0F901F9018951F920F920FB60F926A -:1006100011242F933F938F939F93AF93BF93809118 -:100620003B0190913C01A0913D01B0913E01309180 -:100630003A0123E0230F2D3720F40196A11DB11DAF -:1006400005C026E8230F0296A11DB11D20933A0193 -:1006500080933B0190933C01A0933D01B0933E01F8 -:1006600080913F0190914001A0914101B0914201E0 -:100670000196A11DB11D80933F0190934001A0936D -:100680004101B0934201BF91AF919F918F913F91F2 -:100690002F910F900FBE0F901F901895789484B5EE -:1006A000826084BD84B5816084BD85B5826085BD6E -:1006B00085B5816085BD80916E00816080936E00FC -:1006C00010928100809181008260809381008091EE -:1006D000810081608093810080918000816080939F -:1006E00080008091B10084608093B1008091B0005F -:1006F00081608093B00080917A00846080937A005A -:1007000080917A00826080937A0080917A00816083 -:1007100080937A0080917A00806880937A001092AA -:10072000C100E091D901F091DA0182E08083E0918B -:10073000D501F091D6011082E091D701F091D80156 -:1007400080E180831092E101E091DD01F091DE0112 -:1007500086E08083E091DB01F091DC0180818061A3 -:100760008083E091DB01F091DC01808188608083EF -:10077000E091DB01F091DC01808180688083E09171 -:10078000DB01F091DC0180818F7D80838CE191E041 -:100790000E94980281E391E00E94980287E391E031 -:1007A0000E94980289EC91E00E947B0189EC91E023 -:1007B0000E94F800892B09F44BC189EC91E00E945A -:1007C000D600C82F082E000C990B9093C801809377 -:1007D000C70187FF30C19C01207F33273093C601BA -:1007E0002093C5012039310511F5CF702C2F30E051 -:1007F000F901E451FF4F8491F901E852FF4F149140 -:10080000F901EC53FF4FD491DD2309F424C1811188 -:100810000E94A701ED2FF0E0EE0FFF1FE654FF4FFF -:10082000A591B491EC91E12309F415C119C1203AC5 -:10083000310511F460E004C0203B310541F461E072 -:100840008C2F8F700E94D0010E94610201C1203C58 -:10085000310509F0ABC00C2F0770C3FF72C0002E2A -:10086000000C110B89EC91E00E94F8000297D4F380 -:1008700089EC91E00E94D600C82FCF7089EC91E0FE -:100880000E94D60024E0880F991F2A95E1F7C82B13 -:10089000000F111FF801E05FFE4F0081118161E040 -:1008A000802F0E940002CC2309F446C0F801FF27E4 -:1008B000E451FF4FE491E33011F148F4E130D1F01D -:1008C000E230D1F584B5806284BDC8BDC1C0E730D7 -:1008D00019F1E83049F1E43079F5809180008062C7 -:1008E000809380000C2E000CDD0BD0938B00C09306 -:1008F0008A00AEC084B5806884BDC7BDA9C08091A0 -:1009000080008068809380000C2E000CDD0BD0935B -:100910008900C09388009CC08091B000806880935B -:10092000B000C093B30094C08091B0008062809307 -:10093000B000C093B4008CC060E0802F0E94D00152 -:1009400087C00E947601006400937C0080917A0049 -:10095000806480937A0080917A0086FDFCCFC091FC -:10096000780080917900D0E0D82BBE016F70772796 -:10097000606D89EC91E00E942F01BE0184E07595C5 -:1009800067958A95E1F76F707727606D89EC91E044 -:100990000E942F016D2F772767FD7A956F7077275B -:1009A000606D89EC91E00E942F0152C02038310522 -:1009B000C9F489EC91E00E94D6008F7099278130AC -:1009C000910541F08230910539F0892B09F040C042 -:1009D00060E003C062E001C061E08C2F8F700E9474 -:1009E000000236C0203D310599F1E091C301F0913C -:1009F000C401ED5BFE4F1082EC2FEF710E2E000C48 -:100A0000FF0BEF31F10540F4EC5CFF4F83E491E024 -:100A10000C9464050E9498028091C7019091C801CE -:100A20000E94760189EC91E00E947B011092C40142 -:100A30001092C3010DC08091C3019091C401FC01CB -:100A4000ED5BFE4FC08301969093C4018093C30178 -:100A50000E949D01ABCE8C2FCC0F990B806A04C0F5 -:100A60008C2FCC0F990B806B0E947601F1CFE9ECB3 -:100A7000F1E01382128288EE93E0A0E0B0E084837C -:100A80009583A683B78384E091E09183808385EC8E -:100A900090E09587848784EC90E09787868780EC48 -:100AA00090E0918B808B81EC90E0938B828B82EC39 -:100AB00090E0958B848B86EC90E0978B868B118EE3 -:100AC000128E138E148E0895EE0FFF1F0590F49171 -:100AD000E02D099481E090E0F8940C946F05F8946F -:020AE000FFCF46 -:100AE200000000002F01AB00F800D600EA007B01F5 -:100AF20003000500060009000A000B00496D70653D -:100B0200656475696E6F2056657273696F6E3A20FF -:0A0B120000302E302E32000D0A00D4 +:1002E000CF911F910F91FF90EF900895682F8FECA1 +:1002F00091E00C942F01682F8FEC91E00C942F016A +:10030000CF93DF93EC01888D8823C9F0EA89FB89BC +:10031000808185FD05C0A889B9898C9186FD0FC0B3 +:100320000FB607FCF5CF808185FFF2CFA889B98988 +:100330008C9185FFEDCFCE010E940E01E7CFDF91BA +:10034000CF91089580E090E0892B29F00E9404016C +:1003500081110C9400000895833081F028F48130DD +:1003600099F08230A1F008958730A9F08830B9F073 +:100370008430D1F4809180008F7D03C08091800013 +:100380008F7780938000089584B58F7702C084B5FD +:100390008F7D84BD08958091B0008F7703C08091D8 +:1003A000B0008F7D8093B00008951F93CF93DF93AB +:1003B000282F30E0F901E451FF4F8491F901E85210 +:1003C000FF4FD491F901EC53FF4FC491CC23C9F0F6 +:1003D000162F81110E94AC01EC2FF0E0EE0FFF1FF1 +:1003E000E055FF4FA591B4918FB7F894111105C056 +:1003F0009C91ED2FE095E92302C0EC91ED2BEC935D +:100400008FBFDF91CF911F910895CF93DF9390E03D +:10041000FC01E852FF4F2491FC01EC53FF4F849103 +:10042000882361F190E0880F991FFC01EA55FF4F86 +:10043000C591D491FC01E055FF4FA591B491611194 +:1004400009C09FB7F8948881209582238883EC9116 +:100450002E230BC0623061F49FB7F8943881822F4D +:10046000809583238883EC912E2B2C939FBF06C00D +:100470008FB7F894E8812E2B28838FBFDF91CF911F +:1004800008953FB7F8948091410190914201A09165 +:100490004301B091440126B5A89B05C02F3F19F038 +:1004A0000196A11DB11D3FBFBA2FA92F982F8827F4 +:1004B000820F911DA11DB11DBC01CD0142E0660F4F +:1004C000771F881F991F4A95D1F708958F929F92A1 +:1004D000AF92BF92CF92DF92EF92FF920E944102C1 +:1004E0004B015C0182E3C82ED12CE12CF12C0E943F +:1004F0004102DC01CB0188199909AA09BB09883E90 +:100500009340A105B10558F021E0C21AD108E108D5 +:10051000F10888EE880E83E0981EA11CB11CC1145E +:10052000D104E104F10419F7FF90EF90DF90CF9030 +:10053000BF90AF909F908F900895009769F0FC0155 +:1005400001900020E9F73197AF01481B590BBC011E +:100550008FEC91E00C94AB0080E090E008950E9455 +:1005600099071F920F920FB60F9211242F933F936A +:100570004F935F936F937F938F939F93AF93BF93AB +:10058000EF93FF938FEC91E00E940E01FF91EF91AA +:10059000BF91AF919F918F917F916F915F914F919B +:1005A0003F912F910F900FBE0F901F9018951F92A3 +:1005B0000F920FB60F9211242F938F939F93EF9367 +:1005C000FF93E091DF01F091E0018081E091E5018E +:1005D000F091E60182FD12C090818091E8018F5F69 +:1005E0008F732091E901821751F0E091E801F0E06A +:1005F000E153FE4F958F8093E80101C08081FF9108 +:10060000EF919F918F912F910F900FBE0F901F90A0 +:1006100018951F920F920FB60F9211242F933F93AC +:100620008F939F93AF93BF93809145019091460123 +:10063000A0914701B09148013091400123E0230F80 +:100640002D3720F40196A11DB11D05C026E8230F0A +:100650000296A11DB11D2093400180934501909306 +:100660004601A0934701B0934801809141019091C8 +:100670004201A0914301B09144010196A11DB11D19 +:100680008093410190934201A0934301B0934401B0 +:10069000BF91AF919F918F913F912F910F900FBE7E +:1006A0000F901F901895CF93DF93CDB7DEB7A1972A +:1006B0000FB6F894DEBF0FBECDBF789484B58260CC +:1006C00084BD84B5816084BD85B5826085BD85B5F6 +:1006D000816085BD80916E00816080936E00109274 +:1006E00081008091810082608093810080918100EF +:1006F0008160809381008091800081608093800080 +:100700008091B10084608093B1008091B0008160DD +:100710008093B00080917A00846080937A00809109 +:100720007A00826080937A0080917A008160809361 +:100730007A0080917A00806880937A001092C100DC +:10074000E091DF01F091E00182E08083E091DB0144 +:10075000F091DC011082E091DD01F091DE0180E199 +:1007600080831092E701E091E301F091E40186E0DB +:100770008083E091E101F091E201808180618083DA +:10078000E091E101F091E201808188608083E09155 +:10079000E101F091E201808180688083E091E101D4 +:1007A000F091E20180818F7D808382E291E00E945E +:1007B0009D0287E391E00E949D028DE391E00E94FB +:1007C0009D0280EE90E00E947B018FEC91E00E9400 +:1007D0008001CE0101967C018FEC91E00E94F8002F +:1007E000892B09F46DC18FEC91E00E94D600182F7F +:1007F000082E000C990B9093CE018093CD0187FFBA +:1008000052C19C01207F33273093CC012093CB0130 +:100810002039310511F51F70212F30E0F901E45125 +:10082000FF4F8491F901E852FF4FD490F901EC5346 +:10083000FF4F0491002309F446C181110E94AC01CD +:10084000E02FF0E0EE0FFF1FE654FF4FA591B491AB +:10085000EC91ED2109F437C13BC1203A310511F487 +:1008600060E004C0203B310541F461E0812F8F70CE +:100870000E94D5010E94660223C1203C310509F087 +:10088000A5C0012F077013FF72C0002E000C110BC2 +:100890008FEC91E00E94F8000297D4F38FEC91E086 +:1008A0000E94D6008F70D82E8FEC91E00E94D60067 +:1008B00044E0880F991F4A95E1F7D82A000F111FCD +:1008C000F801EA5EFE4F0081118161E0802F0E94F5 +:1008D0000502DD2009F446C0F801FF27E451FF4F6F +:1008E000E491E33011F148F4E130D1F0E230D1F598 +:1008F00084B5806284BDD8BCE3C0E73019F1E8302C +:1009000049F1E43079F58091800080628093800025 +:100910008D2DDD0C990B90938B0080938A00D0C0B5 +:1009200084B5806884BDD7BCCBC0809180008068CE +:10093000809380008D2DDD0C990B9093890080931E +:100940008800BEC08091B00080688093B000D092D3 +:10095000B300B6C08091B00080628093B000D092A6 +:10096000B400AEC060E0802F0E94D501A9C00E94F3 +:100970007601006400937C0080917A00806480930B +:100980007A0080917A0086FDFCCF009178008091FA +:10099000790010E0182BC8018F709927806D0E9494 +:1009A0007B01C80124E0959587952A95E1F78F7022 +:1009B0009927806D0E947B01812F992787FD9A9549 +:1009C0008F709927806D0E947B017AC02038310595 +:1009D000C9F48FEC91E00E94D6008F709927813086 +:1009E000910541F08230910539F0892B09F068C0FA +:1009F00060E003C062E001C061E0812F8F700E945F +:100A000005025EC0203D310509F45AC0E091C901DC +:100A1000F091CA01E75BFE4F1082E12FEF710E2EBD +:100A2000000CFF0BEF31F10578F5EC5CFF4F0C94F7 +:100A30009C052FB7F8946091450170914601809113 +:100A40004701909148012FBF2AE0A7010E94AE07FD +:100A5000F70101900020E9F7BF016E197F0980E0DE +:100A600090E00E94CF068C01009729F0FC011082D3 +:100A7000B7010E94A707C8010E943706C80102C03B +:100A800089E491E00E949D028091CD019091CE0178 +:100A90000E9476018FEC91E00E9480011092CA01C1 +:100AA0001092C9010DC08091C9019091CA01FC0149 +:100AB000E75BFE4F108301969093CA018093C901B2 +:100AC0000E94A20189CE812F110F990B806A04C068 +:100AD000812F110F990B806B0E947601F1CFEFEC03 +:100AE000F1E01382128288EE93E0A0E0B0E084830C +:100AF0009583A683B7838AE091E09183808385EC18 +:100B000090E09587848784EC90E09787868780ECD7 +:100B100090E0918B808B81EC90E0938B828B82ECC8 +:100B200090E0958B848B86EC90E0978B868B118E72 +:100B3000128E138E148E0895EE0FFF1F0590F49100 +:100B4000E02D0994CF93DF938230910510F482E079 +:100B500090E0E0916E02F0916F0220E030E0C0E0A2 +:100B6000D0E0309711F14081518148175907C0F00A +:100B70004817590761F482819381209719F09B836C +:100B80008A832BC090936F0280936E0226C021153A +:100B9000310519F04217530718F49A01BE01DF011D +:100BA000EF010280F381E02DDCCF2115310509F141 +:100BB000281B390B2430310590F412968D919C91AD +:100BC00013976115710521F0FB019383828304C0A3 +:100BD00090936F0280936E02FD01329644C0FD0136 +:100BE000E20FF31F81939193225031092D933C938F +:100BF0003AC020916C0230916D02232B41F4209178 +:100C000002013091030130936D0220936C02209118 +:100C10000001309101012115310541F42DB73EB796 +:100C20004091040150910501241B350BE0916C02A9 +:100C3000F0916D02E217F307A0F42E1B3F0B28176B +:100C4000390778F0AC014E5F5F4F2417350748F045 +:100C50004E0F5F1F50936D0240936C0281939193EE +:100C600002C0E0E0F0E0CF01DF91CF9108950F9353 +:100C70001F93CF93DF93009709F48CC0FC01329748 +:100C80001382128200916E0210916F0201151105FC +:100C900081F420813181820F931F20916C02309169 +:100CA0006D022817390779F5F0936D02E0936C0215 +:100CB00071C0D80140E050E0AE17BF0750F4129663 +:100CC0002D913C911397AD012115310509F1D90101 +:100CD000F3CF9D01DA013383228360817181860F16 +:100CE000971F8217930769F4EC0128813981260F39 +:100CF000371F2E5F3F4F318320838A819B819383EF +:100D00008283452B29F4F0936F02E0936E0242C078 +:100D10001396FC93EE931297ED01499159919E0120 +:100D2000240F351FE217F30771F480819181840F3E +:100D3000951F029611969C938E93828193811396B0 +:100D40009C938E931297E0E0F0E0D80112968D917B +:100D50009C911397009719F0F8018C01F6CF8D91B3 +:100D60009C9198012E5F3F4F820F931F20916C0240 +:100D700030916D022817390769F4309729F41092E1 +:100D80006F0210926E0202C01382128210936D02E3 +:100D900000936C02DF91CF911F910F910895A0E015 +:100DA000B0E0E5EDF6E00C94E407EC01009721F4E7 +:100DB000CB010E94A205B8C0FC01E60FF71F9C0101 +:100DC00022503109E217F30708F4ACC0D9010D91A4 +:100DD0001C91119706171707B0F00530110508F49C +:100DE0009FC0C80104978617970708F499C002505E +:100DF0001109061B170B019311936D937C93CF017F +:100E00000E9437068DC05B01A01AB10A4C01800E0A +:100E1000911EA0916E02B0916F0240E050E0E12C73 +:100E2000F12C109709F44AC0A815B905D1F56D90B9 +:100E30007C901197630182E0C80ED11CCA14DB04B8 +:100E400080F1A3014A195B096A0182E0C80ED11C36 +:100E50001296BC9012971396AC91B5E0CB16D104C4 +:100E600040F0B282A38351834083D9016D937C9378 +:100E70000AC00E5F1F4FC301800F911FF9019183BC +:100E80008083EB2DFA2FE114F10431F0D701139692 +:100E9000FC93EE93129744C0F0936F02E0936E02BE +:100EA0003FC08D919C9111974817590708F4AC01E8 +:100EB0007D0112960D90BC91A02DB3CF80916C0254 +:100EC00090916D0288159905E1F446175707C8F40B +:100ED0008091000190910101009741F48DB79EB778 +:100EE0004091040150910501841B950BE817F90707 +:100EF000C8F4F0936D02E0936C02F9017183608392 +:100F00000FC0CB010E94A2057C01009759F0A801F7 +:100F1000BE010E949E07CE010E943706C70104C091 +:100F2000CE0102C080E090E0CDB7DEB7EEE00C94D9 +:100F3000000881E090E0F8940C941708FB01DC01B4 +:100F400002C001900D9241505040D8F70895FB0126 +:100F5000DC0101900D920020E1F70895BB27FA0112 +:100F6000A62F6217710581059105330B30FB66F0E2 +:100F7000AA27660F771F881F991FAA1FA21710F0B4 +:100F8000A21B63953850A9F7A05DAA3308F0A95DAC +:100F9000A19336F7B111B1931082CA010C94D00716 +:100FA000DC01FC01672F71917723E1F7329704C0D0 +:100FB0007C916D9370836291AE17BF07C8F308955B +:100FC0002F923F924F925F926F927F928F929F9259 +:100FD000AF92BF92CF92DF92EF92FF920F931F9347 +:100FE000CF93DF93CDB7DEB7CA1BDB0B0FB6F894F8 +:100FF000DEBF0FBECDBF09942A88398848885F8438 +:101000006E847D848C849B84AA84B984C884DF80A8 +:10101000EE80FD800C811B81AA81B981CE0FD11D8C +:101020000FB6F894DEBF0FBECDBFED010895F89462 +:02103000FFCFF0 +:10103200000070028000000000002F01AB00F800E9 +:10104200D600EA00800103000500060009000A003C +:101052000B00496D7065656475696E6F2056657227 +:1010620073696F6E3A2000302E302E33000D0A0065 :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C From 276b4404158133dfff1b6cb8108150bdc8ac6177 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 22:07:59 -0500 Subject: [PATCH 26/34] Add version check --- .../arduino/impeeduino/impeeduino.ino | 68 ++--- .../impeeduino/impeeduino.ino.standard.hex | 278 +++++++----------- ...mpeeduino.ino.with_bootloader.standard.hex | 278 +++++++----------- hardware/impeeduino/impeeduino.class.nut | 12 +- 4 files changed, 250 insertions(+), 386 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index d3df7fa..159e969 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -29,44 +29,45 @@ const int PWM_PINMAP[6] = {3, 5, 6, 9, 10, 11}; unsigned int rxByte = 0; unsigned int rxOp = 0; -char rxbuffer[128]; +char rxbuffer[1024]; int rxbufferindex = 0; // ========== USER-DEFINED FUNCTIONS ========== // -const char* function01(char* buf) { - return String(millis()).c_str(); +char* function01(char* buf) { + // Send back data from the Arduino + Serial.print(millis()); + return ""; } -const char* function02(char* buf) { return buf; } -const char* function03(char* buf) { return buf; } -const char* function04(char* buf) { return buf; } -const char* function05(char* buf) { return buf; } -const char* function06(char* buf) { return buf; } -const char* function07(char* buf) { return buf; } -const char* function08(char* buf) { return buf; } -const char* function09(char* buf) { return buf; } -const char* function0A(char* buf) { return buf; } -const char* function0B(char* buf) { return buf; } -const char* function0C(char* buf) { return buf; } -const char* function0D(char* buf) { return buf; } -const char* function0E(char* buf) { return buf; } -const char* function0F(char* buf) { return buf; } - -const char* function10(char* buf) { return buf; } -const char* function11(char* buf) { return buf; } -const char* function12(char* buf) { return buf; } -const char* function13(char* buf) { return buf; } -const char* function14(char* buf) { return buf; } -const char* function15(char* buf) { return buf; } -const char* function16(char* buf) { return buf; } -const char* function17(char* buf) { return buf; } -const char* function18(char* buf) { return buf; } -const char* function19(char* buf) { return buf; } -const char* function1A(char* buf) { return buf; } -const char* function1B(char* buf) { return buf; } -const char* function1C(char* buf) { return buf; } -const char* function1D(char* buf) { return buf; } -const char* function1E(char* buf) { return buf; } +char* function02(char* buf) { return buf; } +char* function03(char* buf) { return buf; } +char* function04(char* buf) { return buf; } +char* function05(char* buf) { return buf; } +char* function06(char* buf) { return buf; } +char* function07(char* buf) { return buf; } +char* function08(char* buf) { return buf; } +char* function09(char* buf) { return buf; } +char* function0A(char* buf) { return buf; } +char* function0B(char* buf) { return buf; } +char* function0C(char* buf) { return buf; } +char* function0D(char* buf) { return buf; } +char* function0E(char* buf) { return buf; } +char* function0F(char* buf) { return buf; } +char* function10(char* buf) { return buf; } +char* function11(char* buf) { return buf; } +char* function12(char* buf) { return buf; } +char* function13(char* buf) { return buf; } +char* function14(char* buf) { return buf; } +char* function15(char* buf) { return buf; } +char* function16(char* buf) { return buf; } +char* function17(char* buf) { return buf; } +char* function18(char* buf) { return buf; } +char* function19(char* buf) { return buf; } +char* function1A(char* buf) { return buf; } +char* function1B(char* buf) { return buf; } +char* function1C(char* buf) { return buf; } +char* function1D(char* buf) { return buf; } +char* function1E(char* buf) { return buf; } void setup() { Serial.begin(BAUD_RATE); @@ -184,3 +185,4 @@ void loop() { } } } + diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex index 2743e7d..1ffb4a5 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -4,22 +4,22 @@ :100030000C94A9000C94A9000C94A9000C94A9009C :100040000C9409030C94A9000C94D7020C94B102EF :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A900400519054005400511 -:100070004005400540054005400540054005400558 -:100080004005400540054005400540054005400548 -:100090004005400540054005400540054005400538 -:1000A00040054005400500000000240027002A000C +:100060000C94A9000C94A9003F051B053F053F0512 +:100070003F053F053F053F053F053F053F053F0560 +:100080003F053F053F053F053F053F053F053F0550 +:100090003F053F053F053F053F053F053F053F0540 +:1000A0003F053F053F0500000000240027002A000F :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:100100006F0511241FBECFEFD8E0DEBFCDBF11E0D9 -:10011000A0E0B1E0E2E3F0E102C005900D92A0346E -:10012000B107D9F722E0A0E4B1E001C01D92A037E9 +:100100006E0511241FBECFEFD8E0DEBFCDBF11E0DA +:10011000A0E0B1E0E4E9FBE002C005900D92AA3353 +:10012000B107D9F725E0AAE3B1E001C01D92A63ED0 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E949C05C038D107C9F70E9453030C9444 -:1001500017080C940000CF92DF92EF92FF920F935A +:100140000E94BD05C038D107C9F70E9453030C9423 +:10015000C8050C940000CF92DF92EF92FF920F93AC :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958FEC91E00E94F8006F +:1002000091098F739927089589E495E00E94F80079 :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -44,8 +44,8 @@ :1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B :1002C000EA89FB898081806207C0EE89FF896083AB :1002D000E889F98980818064808381E090E0DF9102 -:1002E000CF911F910F91FF90EF900895682F8FECA1 -:1002F00091E00C942F01682F8FEC91E00C942F016A +:1002E000CF911F910F91FF90EF900895682F89E4AF +:1002F00095E00C942F01682F89E495E00C942F0170 :10030000CF93DF93EC01888D8823C9F0EA89FB89BC :10031000808185FD05C0A889B9898C9186FD0FC0B3 :100320000FB607FCF5CF808185FFF2CFA889B98988 @@ -70,8 +70,8 @@ :100450002E230BC0623061F49FB7F8943881822F4D :10046000809583238883EC912E2B2C939FBF06C00D :100470008FB7F894E8812E2B28838FBFDF91CF911F -:1004800008953FB7F8948091410190914201A09165 -:100490004301B091440126B5A89B05C02F3F19F038 +:1004800008953FB7F89480913B0190913C01A09171 +:100490003D01B0913E0126B5A89B05C02F3F19F044 :1004A0000196A11DB11D3FBFBA2FA92F982F8827F4 :1004B000820F911DA11DB11DBC01CD0142E0660F4F :1004C000771F881F991F4A95D1F708958F929F92A1 @@ -83,26 +83,26 @@ :10052000D104E104F10419F7FF90EF90DF90CF9030 :10053000BF90AF909F908F900895009769F0FC0155 :1005400001900020E9F73197AF01481B590BBC011E -:100550008FEC91E00C94AB0080E090E008950E9455 -:1005600099071F920F920FB60F9211242F933F936A +:1005500089E495E00C94AB0080E090E008950E945F +:10056000C3051F920F920FB60F9211242F933F9342 :100570004F935F936F937F938F939F93AF93BF93AB -:10058000EF93FF938FEC91E00E940E01FF91EF91AA +:10058000EF93FF9389E495E00E940E01FF91EF91B4 :10059000BF91AF919F918F917F916F915F914F919B :1005A0003F912F910F900FBE0F901F9018951F92A3 :1005B0000F920FB60F9211242F938F939F93EF9367 -:1005C000FF93E091DF01F091E0018081E091E5018E -:1005D000F091E60182FD12C090818091E8018F5F69 -:1005E0008F732091E901821751F0E091E801F0E06A -:1005F000E153FE4F958F8093E80101C08081FF9108 +:1005C000FF93E0915905F0915A058081E0915F0514 +:1005D000F091600582FD12C09081809162058F5F6D +:1005E0008F7320916305821751F0E0916205F0E06E +:1005F000E75BFA4F958F8093620501C08081FF9180 :10060000EF919F918F912F910F900FBE0F901F90A0 :1006100018951F920F920FB60F9211242F933F93AC -:100620008F939F93AF93BF93809145019091460123 -:10063000A0914701B09148013091400123E0230F80 +:100620008F939F93AF93BF9380913F01909140012F +:10063000A0914101B091420130913A0123E0230F92 :100640002D3720F40196A11DB11D05C026E8230F0A -:100650000296A11DB11D2093400180934501909306 -:100660004601A0934701B0934801809141019091C8 -:100670004201A0914301B09144010196A11DB11D19 -:100680008093410190934201A0934301B0934401B0 +:100650000296A11DB11D20933A0180933F01909312 +:100660004001A0934101B093420180913B019091E0 +:100670003C01A0913D01B0913E010196A11DB11D2B +:1006800080933B0190933C01A0933D01B0933E01C8 :10069000BF91AF919F918F913F912F910F900FBE7E :1006A0000F901F901895CF93DF93CDB7DEB7A1972A :1006B0000FB6F894DEBF0FBECDBF789484B58260CC @@ -114,152 +114,78 @@ :100710008093B00080917A00846080937A00809109 :100720007A00826080937A0080917A008160809361 :100730007A0080917A00806880937A001092C100DC -:10074000E091DF01F091E00182E08083E091DB0144 -:10075000F091DC011082E091DD01F091DE0180E199 -:1007600080831092E701E091E301F091E40186E0DB -:100770008083E091E101F091E201808180618083DA -:10078000E091E101F091E201808188608083E09155 -:10079000E101F091E201808180688083E091E101D4 -:1007A000F091E20180818F7D808382E291E00E945E -:1007B0009D0287E391E00E949D028DE391E00E94FB -:1007C0009D0280EE90E00E947B018FEC91E00E9400 -:1007D0008001CE0101967C018FEC91E00E94F8002F -:1007E000892B09F46DC18FEC91E00E94D600182F7F -:1007F000082E000C990B9093CE018093CD0187FFBA -:1008000052C19C01207F33273093CC012093CB0130 -:100810002039310511F51F70212F30E0F901E45125 -:10082000FF4F8491F901E852FF4FD490F901EC5346 -:10083000FF4F0491002309F446C181110E94AC01CD -:10084000E02FF0E0EE0FFF1FE654FF4FA591B491AB -:10085000EC91ED2109F437C13BC1203A310511F487 -:1008600060E004C0203B310541F461E0812F8F70CE -:100870000E94D5010E94660223C1203C310509F087 -:10088000A5C0012F077013FF72C0002E000C110BC2 -:100890008FEC91E00E94F8000297D4F38FEC91E086 -:1008A0000E94D6008F70D82E8FEC91E00E94D60067 -:1008B00044E0880F991F4A95E1F7D82A000F111FCD -:1008C000F801EA5EFE4F0081118161E0802F0E94F5 -:1008D0000502DD2009F446C0F801FF27E451FF4F6F -:1008E000E491E33011F148F4E130D1F0E230D1F598 -:1008F00084B5806284BDD8BCE3C0E73019F1E8302C -:1009000049F1E43079F58091800080628093800025 -:100910008D2DDD0C990B90938B0080938A00D0C0B5 -:1009200084B5806884BDD7BCCBC0809180008068CE -:10093000809380008D2DDD0C990B9093890080931E -:100940008800BEC08091B00080688093B000D092D3 -:10095000B300B6C08091B00080628093B000D092A6 -:10096000B400AEC060E0802F0E94D501A9C00E94F3 -:100970007601006400937C0080917A00806480930B -:100980007A0080917A0086FDFCCF009178008091FA -:10099000790010E0182BC8018F709927806D0E9494 -:1009A0007B01C80124E0959587952A95E1F78F7022 -:1009B0009927806D0E947B01812F992787FD9A9549 -:1009C0008F709927806D0E947B017AC02038310595 -:1009D000C9F48FEC91E00E94D6008F709927813086 -:1009E000910541F08230910539F0892B09F068C0FA -:1009F00060E003C062E001C061E0812F8F700E945F -:100A000005025EC0203D310509F45AC0E091C901DC -:100A1000F091CA01E75BFE4F1082E12FEF710E2EBD -:100A2000000CFF0BEF31F10578F5EC5CFF4F0C94F7 -:100A30009C052FB7F8946091450170914601809113 -:100A40004701909148012FBF2AE0A7010E94AE07FD -:100A5000F70101900020E9F7BF016E197F0980E0DE -:100A600090E00E94CF068C01009729F0FC011082D3 -:100A7000B7010E94A707C8010E943706C80102C03B -:100A800089E491E00E949D028091CD019091CE0178 -:100A90000E9476018FEC91E00E9480011092CA01C1 -:100AA0001092C9010DC08091C9019091CA01FC0149 -:100AB000E75BFE4F108301969093CA018093C901B2 -:100AC0000E94A20189CE812F110F990B806A04C068 -:100AD000812F110F990B806B0E947601F1CFEFEC03 -:100AE000F1E01382128288EE93E0A0E0B0E084830C -:100AF0009583A683B7838AE091E09183808385EC18 -:100B000090E09587848784EC90E09787868780ECD7 -:100B100090E0918B808B81EC90E0938B828B82ECC8 -:100B200090E0958B848B86EC90E0978B868B118E72 -:100B3000128E138E148E0895EE0FFF1F0590F49100 -:100B4000E02D0994CF93DF938230910510F482E079 -:100B500090E0E0916E02F0916F0220E030E0C0E0A2 -:100B6000D0E0309711F14081518148175907C0F00A -:100B70004817590761F482819381209719F09B836C -:100B80008A832BC090936F0280936E0226C021153A -:100B9000310519F04217530718F49A01BE01DF011D -:100BA000EF010280F381E02DDCCF2115310509F141 -:100BB000281B390B2430310590F412968D919C91AD -:100BC00013976115710521F0FB019383828304C0A3 -:100BD00090936F0280936E02FD01329644C0FD0136 -:100BE000E20FF31F81939193225031092D933C938F -:100BF0003AC020916C0230916D02232B41F4209178 -:100C000002013091030130936D0220936C02209118 -:100C10000001309101012115310541F42DB73EB796 -:100C20004091040150910501241B350BE0916C02A9 -:100C3000F0916D02E217F307A0F42E1B3F0B28176B -:100C4000390778F0AC014E5F5F4F2417350748F045 -:100C50004E0F5F1F50936D0240936C0281939193EE -:100C600002C0E0E0F0E0CF01DF91CF9108950F9353 -:100C70001F93CF93DF93009709F48CC0FC01329748 -:100C80001382128200916E0210916F0201151105FC -:100C900081F420813181820F931F20916C02309169 -:100CA0006D022817390779F5F0936D02E0936C0215 -:100CB00071C0D80140E050E0AE17BF0750F4129663 -:100CC0002D913C911397AD012115310509F1D90101 -:100CD000F3CF9D01DA013383228360817181860F16 -:100CE000971F8217930769F4EC0128813981260F39 -:100CF000371F2E5F3F4F318320838A819B819383EF -:100D00008283452B29F4F0936F02E0936E0242C078 -:100D10001396FC93EE931297ED01499159919E0120 -:100D2000240F351FE217F30771F480819181840F3E -:100D3000951F029611969C938E93828193811396B0 -:100D40009C938E931297E0E0F0E0D80112968D917B -:100D50009C911397009719F0F8018C01F6CF8D91B3 -:100D60009C9198012E5F3F4F820F931F20916C0240 -:100D700030916D022817390769F4309729F41092E1 -:100D80006F0210926E0202C01382128210936D02E3 -:100D900000936C02DF91CF911F910F910895A0E015 -:100DA000B0E0E5EDF6E00C94E407EC01009721F4E7 -:100DB000CB010E94A205B8C0FC01E60FF71F9C0101 -:100DC00022503109E217F30708F4ACC0D9010D91A4 -:100DD0001C91119706171707B0F00530110508F49C -:100DE0009FC0C80104978617970708F499C002505E -:100DF0001109061B170B019311936D937C93CF017F -:100E00000E9437068DC05B01A01AB10A4C01800E0A -:100E1000911EA0916E02B0916F0240E050E0E12C73 -:100E2000F12C109709F44AC0A815B905D1F56D90B9 -:100E30007C901197630182E0C80ED11CCA14DB04B8 -:100E400080F1A3014A195B096A0182E0C80ED11C36 -:100E50001296BC9012971396AC91B5E0CB16D104C4 -:100E600040F0B282A38351834083D9016D937C9378 -:100E70000AC00E5F1F4FC301800F911FF9019183BC -:100E80008083EB2DFA2FE114F10431F0D701139692 -:100E9000FC93EE93129744C0F0936F02E0936E02BE -:100EA0003FC08D919C9111974817590708F4AC01E8 -:100EB0007D0112960D90BC91A02DB3CF80916C0254 -:100EC00090916D0288159905E1F446175707C8F40B -:100ED0008091000190910101009741F48DB79EB778 -:100EE0004091040150910501841B950BE817F90707 -:100EF000C8F4F0936D02E0936C02F9017183608392 -:100F00000FC0CB010E94A2057C01009759F0A801F7 -:100F1000BE010E949E07CE010E943706C70104C091 -:100F2000CE0102C080E090E0CDB7DEB7EEE00C94D9 -:100F3000000881E090E0F8940C941708FB01DC01B4 -:100F400002C001900D9241505040D8F70895FB0126 -:100F5000DC0101900D920020E1F70895BB27FA0112 -:100F6000A62F6217710581059105330B30FB66F0E2 -:100F7000AA27660F771F881F991FAA1FA21710F0B4 -:100F8000A21B63953850A9F7A05DAA3308F0A95DAC -:100F9000A19336F7B111B1931082CA010C94D00716 -:100FA000DC01FC01672F71917723E1F7329704C0D0 -:100FB0007C916D9370836291AE17BF07C8F308955B -:100FC0002F923F924F925F926F927F928F929F9259 -:100FD000AF92BF92CF92DF92EF92FF920F931F9347 -:100FE000CF93DF93CDB7DEB7CA1BDB0B0FB6F894F8 -:100FF000DEBF0FBECDBF09942A88398848885F8438 -:101000006E847D848C849B84AA84B984C884DF80A8 -:10101000EE80FD800C811B81AA81B981CE0FD11D8C -:101020000FB6F894DEBF0FBECDBFED010895F89462 -:02103000FFCFF0 -:10103200000070028000000000002F01AB00F800E9 -:10104200D600EA00800103000500060009000A003C -:101052000B00496D7065656475696E6F2056657227 -:1010620073696F6E3A2000302E302E33000D0A0065 +:10074000E0915905F0915A0582E08083E0915505CA +:10075000F09156051082E0915705F091580580E11F +:10076000808310926105E0915D05F0915E0586E061 +:100770008083E0915B05F0915C05808180618083DE +:10078000E0915B05F0915C05808188608083E09159 +:100790005B05F0915C05808180688083E0915B055A +:1007A000F0915C0580818F7D80838CE191E00E94D7 +:1007B0009D0281E391E00E949D0287E391E00E9407 +:1007C0009D0280EE90E00E947B0189E495E00E940A +:1007D00080017AE0C72ED12CE12CF12C89E495E040 +:1007E0000E94F800892B09F46AC189E495E00E940F +:1007F000D600182F082E000C990B90934805809373 +:10080000470587FF4FC19C01207F33273093460562 +:10081000209345052039310511F51F70412F50E017 +:10082000FA01E451FF4F8491FA01E852FF4FB4906E +:10083000FA01EC53FF4F0491002309F443C18111E5 +:100840000E94AC01E02FF0E0EE0FFF1FE654FF4FD7 +:10085000A591B491EC91EB2109F434C138C1203A4F +:10086000310511F460E004C0203B310541F461E042 +:10087000812F8F700E94D5010E94660220C1203C0A +:10088000310509F0A5C0012F077013FF72C0A02E1B +:10089000000FBB0889E495E00E94F8000297D4F3AA +:1008A00089E495E00E94D600182F1F7089E495E036 +:1008B0000E94D60044E0880F991F4A95E1F7182B53 +:1008C000F501EE0FFF1FE05FFE4FA080B18061E0F9 +:1008D0008A2D0E940502112309F446C0F501FF2765 +:1008E000E451FF4FE491E33011F148F4E130D1F0ED +:1008F000E230D1F584B5806284BD18BDE0C0E73038 +:1009000019F1E83049F1E43079F580918000806296 +:1009100080938000812F110F990B90938B0080930F +:100920008A00CDC084B5806884BD17BDC8C08091E1 +:100930008000806880938000812F110F990B909325 +:10094000890080938800BBC08091B000806880934C +:10095000B0001093B300B3C08091B0008062809368 +:10096000B0001093B400ABC060E08A2D0E94D501A6 +:10097000A6C00E947601006400937C0080917A00FA +:10098000806480937A0080917A0086FDFCCF00918C +:1009900078008091790010E0182BC8018F7099279A +:1009A000806D0E947B01C80124E0959587952A956A +:1009B000E1F78F709927806D0E947B01812F992725 +:1009C00087FD9A958F709927806D0E947B0177C073 +:1009D00020383105C9F489E495E00E94D6008F7073 +:1009E00099278130910541F08230910539F0892BAA +:1009F00009F065C060E003C062E001C061E0812FE2 +:100A00008F700E9405025BC0203D310509F457C07C +:100A1000E0914305F0914405ED5BFE4F1082E12F1C +:100A2000EF710E2E000CFF0BEF31F10560F5EC5C61 +:100A3000FF4F0C94BD058FB7F89420913F01309182 +:100A4000400140914101509142018FBF19A28E0196 +:100A50000F5D1F4FCA01B901A70196010E949B05B6 +:100A6000605DF80162938F01211531054105510543 +:100A700089F7CF010E949D0289E391E002C083E4DF +:100A800091E00E949D0280914705909148050E9447 +:100A9000760189E495E00E9480011092440510924D +:100AA00043050DC08091430590914405FC01ED5B29 +:100AB000FE4F1083019690934405809343050E9456 +:100AC000A2018CCE812F110F990B806A04C0812F57 +:100AD000110F990B806B0E947601F1CFE9E4F5E0EC +:100AE0001382128288EE93E0A0E0B0E084839583C5 +:100AF000A683B78384E091E09183808385EC90E0C6 +:100B00009587848784EC90E09787868780EC90E0D7 +:100B1000918B808B81EC90E0938B828B82EC90E0C8 +:100B2000958B848B86EC90E0978B868B118E128E42 +:100B3000138E148E0895A1E21A2EAA1BBB1BFD0171 +:100B40000DC0AA1FBB1FEE1FFF1FA217B307E407AC +:100B5000F50720F0A21BB30BE40BF50B661F771F04 +:100B6000881F991F1A9469F76095709580959095E4 +:100B70009B01AC01BD01CF010895EE0FFF1F059051 +:100B8000F491E02D099481E090E0F8940C94C8056C +:040B9000F894FFCF07 +:100B9400000000002F01AB00F800D600EA0080013D +:100BA40003000500060009000A000B00496D70658A +:100BB400656475696E6F2056657273696F6E3A204D +:0A0BC40000302E302E33000D0A0021 :00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex index f5ef9d9..aa07d65 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -4,22 +4,22 @@ :100030000C94A9000C94A9000C94A9000C94A9009C :100040000C9409030C94A9000C94D7020C94B102EF :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A900400519054005400511 -:100070004005400540054005400540054005400558 -:100080004005400540054005400540054005400548 -:100090004005400540054005400540054005400538 -:1000A00040054005400500000000240027002A000C +:100060000C94A9000C94A9003F051B053F053F0512 +:100070003F053F053F053F053F053F053F053F0560 +:100080003F053F053F053F053F053F053F053F0550 +:100090003F053F053F053F053F053F053F053F0540 +:1000A0003F053F053F0500000000240027002A000F :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:100100006F0511241FBECFEFD8E0DEBFCDBF11E0D9 -:10011000A0E0B1E0E2E3F0E102C005900D92A0346E -:10012000B107D9F722E0A0E4B1E001C01D92A037E9 +:100100006E0511241FBECFEFD8E0DEBFCDBF11E0DA +:10011000A0E0B1E0E4E9FBE002C005900D92AA3353 +:10012000B107D9F725E0AAE3B1E001C01D92A63ED0 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E949C05C038D107C9F70E9453030C9444 -:1001500017080C940000CF92DF92EF92FF920F935A +:100140000E94BD05C038D107C9F70E9453030C9423 +:10015000C8050C940000CF92DF92EF92FF920F93AC :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -30,7 +30,7 @@ :1001D0009FEF0895FC01918D828D981731F0828DEB :1001E000E80FF11D858D90E008958FEF9FEF089542 :1001F000FC01918D228D892F90E0805C9F4F821BA6 -:1002000091098F73992708958FEC91E00E94F8006F +:1002000091098F739927089589E495E00E94F80079 :1002100021E0892B09F420E0822F0895FC01848DD0 :10022000DF01A80FB11DA35ABF4F2C91848D90E020 :1002300001968F739927848FA689B7892C93A089FB @@ -44,8 +44,8 @@ :1002B0008B8DFE01E80FF11DE35AFF4FF0820B8F8B :1002C000EA89FB898081806207C0EE89FF896083AB :1002D000E889F98980818064808381E090E0DF9102 -:1002E000CF911F910F91FF90EF900895682F8FECA1 -:1002F00091E00C942F01682F8FEC91E00C942F016A +:1002E000CF911F910F91FF90EF900895682F89E4AF +:1002F00095E00C942F01682F89E495E00C942F0170 :10030000CF93DF93EC01888D8823C9F0EA89FB89BC :10031000808185FD05C0A889B9898C9186FD0FC0B3 :100320000FB607FCF5CF808185FFF2CFA889B98988 @@ -70,8 +70,8 @@ :100450002E230BC0623061F49FB7F8943881822F4D :10046000809583238883EC912E2B2C939FBF06C00D :100470008FB7F894E8812E2B28838FBFDF91CF911F -:1004800008953FB7F8948091410190914201A09165 -:100490004301B091440126B5A89B05C02F3F19F038 +:1004800008953FB7F89480913B0190913C01A09171 +:100490003D01B0913E0126B5A89B05C02F3F19F044 :1004A0000196A11DB11D3FBFBA2FA92F982F8827F4 :1004B000820F911DA11DB11DBC01CD0142E0660F4F :1004C000771F881F991F4A95D1F708958F929F92A1 @@ -83,26 +83,26 @@ :10052000D104E104F10419F7FF90EF90DF90CF9030 :10053000BF90AF909F908F900895009769F0FC0155 :1005400001900020E9F73197AF01481B590BBC011E -:100550008FEC91E00C94AB0080E090E008950E9455 -:1005600099071F920F920FB60F9211242F933F936A +:1005500089E495E00C94AB0080E090E008950E945F +:10056000C3051F920F920FB60F9211242F933F9342 :100570004F935F936F937F938F939F93AF93BF93AB -:10058000EF93FF938FEC91E00E940E01FF91EF91AA +:10058000EF93FF9389E495E00E940E01FF91EF91B4 :10059000BF91AF919F918F917F916F915F914F919B :1005A0003F912F910F900FBE0F901F9018951F92A3 :1005B0000F920FB60F9211242F938F939F93EF9367 -:1005C000FF93E091DF01F091E0018081E091E5018E -:1005D000F091E60182FD12C090818091E8018F5F69 -:1005E0008F732091E901821751F0E091E801F0E06A -:1005F000E153FE4F958F8093E80101C08081FF9108 +:1005C000FF93E0915905F0915A058081E0915F0514 +:1005D000F091600582FD12C09081809162058F5F6D +:1005E0008F7320916305821751F0E0916205F0E06E +:1005F000E75BFA4F958F8093620501C08081FF9180 :10060000EF919F918F912F910F900FBE0F901F90A0 :1006100018951F920F920FB60F9211242F933F93AC -:100620008F939F93AF93BF93809145019091460123 -:10063000A0914701B09148013091400123E0230F80 +:100620008F939F93AF93BF9380913F01909140012F +:10063000A0914101B091420130913A0123E0230F92 :100640002D3720F40196A11DB11D05C026E8230F0A -:100650000296A11DB11D2093400180934501909306 -:100660004601A0934701B0934801809141019091C8 -:100670004201A0914301B09144010196A11DB11D19 -:100680008093410190934201A0934301B0934401B0 +:100650000296A11DB11D20933A0180933F01909312 +:100660004001A0934101B093420180913B019091E0 +:100670003C01A0913D01B0913E010196A11DB11D2B +:1006800080933B0190933C01A0933D01B0933E01C8 :10069000BF91AF919F918F913F912F910F900FBE7E :1006A0000F901F901895CF93DF93CDB7DEB7A1972A :1006B0000FB6F894DEBF0FBECDBF789484B58260CC @@ -114,154 +114,80 @@ :100710008093B00080917A00846080937A00809109 :100720007A00826080937A0080917A008160809361 :100730007A0080917A00806880937A001092C100DC -:10074000E091DF01F091E00182E08083E091DB0144 -:10075000F091DC011082E091DD01F091DE0180E199 -:1007600080831092E701E091E301F091E40186E0DB -:100770008083E091E101F091E201808180618083DA -:10078000E091E101F091E201808188608083E09155 -:10079000E101F091E201808180688083E091E101D4 -:1007A000F091E20180818F7D808382E291E00E945E -:1007B0009D0287E391E00E949D028DE391E00E94FB -:1007C0009D0280EE90E00E947B018FEC91E00E9400 -:1007D0008001CE0101967C018FEC91E00E94F8002F -:1007E000892B09F46DC18FEC91E00E94D600182F7F -:1007F000082E000C990B9093CE018093CD0187FFBA -:1008000052C19C01207F33273093CC012093CB0130 -:100810002039310511F51F70212F30E0F901E45125 -:10082000FF4F8491F901E852FF4FD490F901EC5346 -:10083000FF4F0491002309F446C181110E94AC01CD -:10084000E02FF0E0EE0FFF1FE654FF4FA591B491AB -:10085000EC91ED2109F437C13BC1203A310511F487 -:1008600060E004C0203B310541F461E0812F8F70CE -:100870000E94D5010E94660223C1203C310509F087 -:10088000A5C0012F077013FF72C0002E000C110BC2 -:100890008FEC91E00E94F8000297D4F38FEC91E086 -:1008A0000E94D6008F70D82E8FEC91E00E94D60067 -:1008B00044E0880F991F4A95E1F7D82A000F111FCD -:1008C000F801EA5EFE4F0081118161E0802F0E94F5 -:1008D0000502DD2009F446C0F801FF27E451FF4F6F -:1008E000E491E33011F148F4E130D1F0E230D1F598 -:1008F00084B5806284BDD8BCE3C0E73019F1E8302C -:1009000049F1E43079F58091800080628093800025 -:100910008D2DDD0C990B90938B0080938A00D0C0B5 -:1009200084B5806884BDD7BCCBC0809180008068CE -:10093000809380008D2DDD0C990B9093890080931E -:100940008800BEC08091B00080688093B000D092D3 -:10095000B300B6C08091B00080628093B000D092A6 -:10096000B400AEC060E0802F0E94D501A9C00E94F3 -:100970007601006400937C0080917A00806480930B -:100980007A0080917A0086FDFCCF009178008091FA -:10099000790010E0182BC8018F709927806D0E9494 -:1009A0007B01C80124E0959587952A95E1F78F7022 -:1009B0009927806D0E947B01812F992787FD9A9549 -:1009C0008F709927806D0E947B017AC02038310595 -:1009D000C9F48FEC91E00E94D6008F709927813086 -:1009E000910541F08230910539F0892B09F068C0FA -:1009F00060E003C062E001C061E0812F8F700E945F -:100A000005025EC0203D310509F45AC0E091C901DC -:100A1000F091CA01E75BFE4F1082E12FEF710E2EBD -:100A2000000CFF0BEF31F10578F5EC5CFF4F0C94F7 -:100A30009C052FB7F8946091450170914601809113 -:100A40004701909148012FBF2AE0A7010E94AE07FD -:100A5000F70101900020E9F7BF016E197F0980E0DE -:100A600090E00E94CF068C01009729F0FC011082D3 -:100A7000B7010E94A707C8010E943706C80102C03B -:100A800089E491E00E949D028091CD019091CE0178 -:100A90000E9476018FEC91E00E9480011092CA01C1 -:100AA0001092C9010DC08091C9019091CA01FC0149 -:100AB000E75BFE4F108301969093CA018093C901B2 -:100AC0000E94A20189CE812F110F990B806A04C068 -:100AD000812F110F990B806B0E947601F1CFEFEC03 -:100AE000F1E01382128288EE93E0A0E0B0E084830C -:100AF0009583A683B7838AE091E09183808385EC18 -:100B000090E09587848784EC90E09787868780ECD7 -:100B100090E0918B808B81EC90E0938B828B82ECC8 -:100B200090E0958B848B86EC90E0978B868B118E72 -:100B3000128E138E148E0895EE0FFF1F0590F49100 -:100B4000E02D0994CF93DF938230910510F482E079 -:100B500090E0E0916E02F0916F0220E030E0C0E0A2 -:100B6000D0E0309711F14081518148175907C0F00A -:100B70004817590761F482819381209719F09B836C -:100B80008A832BC090936F0280936E0226C021153A -:100B9000310519F04217530718F49A01BE01DF011D -:100BA000EF010280F381E02DDCCF2115310509F141 -:100BB000281B390B2430310590F412968D919C91AD -:100BC00013976115710521F0FB019383828304C0A3 -:100BD00090936F0280936E02FD01329644C0FD0136 -:100BE000E20FF31F81939193225031092D933C938F -:100BF0003AC020916C0230916D02232B41F4209178 -:100C000002013091030130936D0220936C02209118 -:100C10000001309101012115310541F42DB73EB796 -:100C20004091040150910501241B350BE0916C02A9 -:100C3000F0916D02E217F307A0F42E1B3F0B28176B -:100C4000390778F0AC014E5F5F4F2417350748F045 -:100C50004E0F5F1F50936D0240936C0281939193EE -:100C600002C0E0E0F0E0CF01DF91CF9108950F9353 -:100C70001F93CF93DF93009709F48CC0FC01329748 -:100C80001382128200916E0210916F0201151105FC -:100C900081F420813181820F931F20916C02309169 -:100CA0006D022817390779F5F0936D02E0936C0215 -:100CB00071C0D80140E050E0AE17BF0750F4129663 -:100CC0002D913C911397AD012115310509F1D90101 -:100CD000F3CF9D01DA013383228360817181860F16 -:100CE000971F8217930769F4EC0128813981260F39 -:100CF000371F2E5F3F4F318320838A819B819383EF -:100D00008283452B29F4F0936F02E0936E0242C078 -:100D10001396FC93EE931297ED01499159919E0120 -:100D2000240F351FE217F30771F480819181840F3E -:100D3000951F029611969C938E93828193811396B0 -:100D40009C938E931297E0E0F0E0D80112968D917B -:100D50009C911397009719F0F8018C01F6CF8D91B3 -:100D60009C9198012E5F3F4F820F931F20916C0240 -:100D700030916D022817390769F4309729F41092E1 -:100D80006F0210926E0202C01382128210936D02E3 -:100D900000936C02DF91CF911F910F910895A0E015 -:100DA000B0E0E5EDF6E00C94E407EC01009721F4E7 -:100DB000CB010E94A205B8C0FC01E60FF71F9C0101 -:100DC00022503109E217F30708F4ACC0D9010D91A4 -:100DD0001C91119706171707B0F00530110508F49C -:100DE0009FC0C80104978617970708F499C002505E -:100DF0001109061B170B019311936D937C93CF017F -:100E00000E9437068DC05B01A01AB10A4C01800E0A -:100E1000911EA0916E02B0916F0240E050E0E12C73 -:100E2000F12C109709F44AC0A815B905D1F56D90B9 -:100E30007C901197630182E0C80ED11CCA14DB04B8 -:100E400080F1A3014A195B096A0182E0C80ED11C36 -:100E50001296BC9012971396AC91B5E0CB16D104C4 -:100E600040F0B282A38351834083D9016D937C9378 -:100E70000AC00E5F1F4FC301800F911FF9019183BC -:100E80008083EB2DFA2FE114F10431F0D701139692 -:100E9000FC93EE93129744C0F0936F02E0936E02BE -:100EA0003FC08D919C9111974817590708F4AC01E8 -:100EB0007D0112960D90BC91A02DB3CF80916C0254 -:100EC00090916D0288159905E1F446175707C8F40B -:100ED0008091000190910101009741F48DB79EB778 -:100EE0004091040150910501841B950BE817F90707 -:100EF000C8F4F0936D02E0936C02F9017183608392 -:100F00000FC0CB010E94A2057C01009759F0A801F7 -:100F1000BE010E949E07CE010E943706C70104C091 -:100F2000CE0102C080E090E0CDB7DEB7EEE00C94D9 -:100F3000000881E090E0F8940C941708FB01DC01B4 -:100F400002C001900D9241505040D8F70895FB0126 -:100F5000DC0101900D920020E1F70895BB27FA0112 -:100F6000A62F6217710581059105330B30FB66F0E2 -:100F7000AA27660F771F881F991FAA1FA21710F0B4 -:100F8000A21B63953850A9F7A05DAA3308F0A95DAC -:100F9000A19336F7B111B1931082CA010C94D00716 -:100FA000DC01FC01672F71917723E1F7329704C0D0 -:100FB0007C916D9370836291AE17BF07C8F308955B -:100FC0002F923F924F925F926F927F928F929F9259 -:100FD000AF92BF92CF92DF92EF92FF920F931F9347 -:100FE000CF93DF93CDB7DEB7CA1BDB0B0FB6F894F8 -:100FF000DEBF0FBECDBF09942A88398848885F8438 -:101000006E847D848C849B84AA84B984C884DF80A8 -:10101000EE80FD800C811B81AA81B981CE0FD11D8C -:101020000FB6F894DEBF0FBECDBFED010895F89462 -:02103000FFCFF0 -:10103200000070028000000000002F01AB00F800E9 -:10104200D600EA00800103000500060009000A003C -:101052000B00496D7065656475696E6F2056657227 -:1010620073696F6E3A2000302E302E33000D0A0065 +:10074000E0915905F0915A0582E08083E0915505CA +:10075000F09156051082E0915705F091580580E11F +:10076000808310926105E0915D05F0915E0586E061 +:100770008083E0915B05F0915C05808180618083DE +:10078000E0915B05F0915C05808188608083E09159 +:100790005B05F0915C05808180688083E0915B055A +:1007A000F0915C0580818F7D80838CE191E00E94D7 +:1007B0009D0281E391E00E949D0287E391E00E9407 +:1007C0009D0280EE90E00E947B0189E495E00E940A +:1007D00080017AE0C72ED12CE12CF12C89E495E040 +:1007E0000E94F800892B09F46AC189E495E00E940F +:1007F000D600182F082E000C990B90934805809373 +:10080000470587FF4FC19C01207F33273093460562 +:10081000209345052039310511F51F70412F50E017 +:10082000FA01E451FF4F8491FA01E852FF4FB4906E +:10083000FA01EC53FF4F0491002309F443C18111E5 +:100840000E94AC01E02FF0E0EE0FFF1FE654FF4FD7 +:10085000A591B491EC91EB2109F434C138C1203A4F +:10086000310511F460E004C0203B310541F461E042 +:10087000812F8F700E94D5010E94660220C1203C0A +:10088000310509F0A5C0012F077013FF72C0A02E1B +:10089000000FBB0889E495E00E94F8000297D4F3AA +:1008A00089E495E00E94D600182F1F7089E495E036 +:1008B0000E94D60044E0880F991F4A95E1F7182B53 +:1008C000F501EE0FFF1FE05FFE4FA080B18061E0F9 +:1008D0008A2D0E940502112309F446C0F501FF2765 +:1008E000E451FF4FE491E33011F148F4E130D1F0ED +:1008F000E230D1F584B5806284BD18BDE0C0E73038 +:1009000019F1E83049F1E43079F580918000806296 +:1009100080938000812F110F990B90938B0080930F +:100920008A00CDC084B5806884BD17BDC8C08091E1 +:100930008000806880938000812F110F990B909325 +:10094000890080938800BBC08091B000806880934C +:10095000B0001093B300B3C08091B0008062809368 +:10096000B0001093B400ABC060E08A2D0E94D501A6 +:10097000A6C00E947601006400937C0080917A00FA +:10098000806480937A0080917A0086FDFCCF00918C +:1009900078008091790010E0182BC8018F7099279A +:1009A000806D0E947B01C80124E0959587952A956A +:1009B000E1F78F709927806D0E947B01812F992725 +:1009C00087FD9A958F709927806D0E947B0177C073 +:1009D00020383105C9F489E495E00E94D6008F7073 +:1009E00099278130910541F08230910539F0892BAA +:1009F00009F065C060E003C062E001C061E0812FE2 +:100A00008F700E9405025BC0203D310509F457C07C +:100A1000E0914305F0914405ED5BFE4F1082E12F1C +:100A2000EF710E2E000CFF0BEF31F10560F5EC5C61 +:100A3000FF4F0C94BD058FB7F89420913F01309182 +:100A4000400140914101509142018FBF19A28E0196 +:100A50000F5D1F4FCA01B901A70196010E949B05B6 +:100A6000605DF80162938F01211531054105510543 +:100A700089F7CF010E949D0289E391E002C083E4DF +:100A800091E00E949D0280914705909148050E9447 +:100A9000760189E495E00E9480011092440510924D +:100AA00043050DC08091430590914405FC01ED5B29 +:100AB000FE4F1083019690934405809343050E9456 +:100AC000A2018CCE812F110F990B806A04C0812F57 +:100AD000110F990B806B0E947601F1CFE9E4F5E0EC +:100AE0001382128288EE93E0A0E0B0E084839583C5 +:100AF000A683B78384E091E09183808385EC90E0C6 +:100B00009587848784EC90E09787868780EC90E0D7 +:100B1000918B808B81EC90E0938B828B82EC90E0C8 +:100B2000958B848B86EC90E0978B868B118E128E42 +:100B3000138E148E0895A1E21A2EAA1BBB1BFD0171 +:100B40000DC0AA1FBB1FEE1FFF1FA217B307E407AC +:100B5000F50720F0A21BB30BE40BF50B661F771F04 +:100B6000881F991F1A9469F76095709580959095E4 +:100B70009B01AC01BD01CF010895EE0FFF1F059051 +:100B8000F491E02D099481E090E0F8940C94C8056C +:040B9000F894FFCF07 +:100B9400000000002F01AB00F800D600EA0080013D +:100BA40003000500060009000A000B00496D70658A +:100BB400656475696E6F2056657273696F6E3A204D +:0A0BC40000302E302E33000D0A0021 :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index a4e9258..6ee0a2f 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -1,6 +1,6 @@ class Impeeduino { - static version = [0, 0, 2] + static version = [0, 0, 3] static BAUD_RATE = 115200; @@ -58,6 +58,7 @@ class Impeeduino { _rxBuf = blob(); _functioncb = {}; + _functioncb[0] <- _versionCheck; _digitalReadcb = {}; _analogReadcb = {}; @@ -333,6 +334,15 @@ class Impeeduino { _rxBuf.writeblob(_serial.readblob()); imp.wakeup(0, _parseRXBuffer.bindenv(this)); } + + function _versionCheck(data) { + local versionString = format("%s", data.tostring()); + server.log(versionString); + if (!versionString.find(version[0] + "." + version[1] + "." + version[2])) { + server.log("Library version " + version[0] + "." + version[1] + "." + version[2]) + server.error("Impeeduino version mismatch!"); + } + } } activityLED <- hardware.pin2; From 8a49f8968a7ddfd78b4b49c37f7e961673c19300 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 22:16:18 -0500 Subject: [PATCH 27/34] Disable debug server.log() calls --- hardware/impeeduino/impeeduino.class.nut | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 6ee0a2f..233b9d7 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -58,7 +58,7 @@ class Impeeduino { _rxBuf = blob(); _functioncb = {}; - _functioncb[0] <- _versionCheck; + //_functioncb[0] <- _versionCheck; _digitalReadcb = {}; _analogReadcb = {}; @@ -79,7 +79,7 @@ class Impeeduino { assert (typeof pin == "integer"); assert (pin != 0 && pin != 1); // Do not reconfigure UART bus pins _serial.write(OP_CONFIGURE | pin); - server.log("Configuring " + pin); + //server.log("Configuring " + pin); switch (mode) { case DIGITAL_IN: _serial.write(OP_ARB | CONFIG_INPUT); @@ -88,7 +88,7 @@ class Impeeduino { _serial.write(OP_ARB | CONFIG_INPUT_PULLUP); break; case DIGITAL_OUT: - server.log("to Output"); + //server.log("to Output"); _serial.write(OP_ARB | CONFIG_OUTPUT); break; case PWM_OUT: @@ -164,7 +164,7 @@ class Impeeduino { } readByte = _serial.read(); } - server.log(format("0x%02X", readByte)); + //server.log(format("0x%02X", readByte)); imp.wakeup(0, _parseRXBuffer.bindenv(this)); return readByte & MASK_DIGITAL_WRITE ? 1 : 0; @@ -273,7 +273,7 @@ class Impeeduino { readByte = buf.readn('b'); if (readByte & 0x80) { // Interpret as Opcode - server.log(format("Opcode: 0x%02X", readByte)); + //server.log(format("Opcode: 0x%02X", readByte)); switch (readByte & MASK_OP) { case OP_DIGITAL_WRITE_0: local addr = readByte & MASK_DIGITAL_ADDR; @@ -323,13 +323,9 @@ class Impeeduino { _funcBuf.writen(readByte, 'b'); } } - if (_funcBuf.len() > 0) { - server.log(format("%s", _funcBuf.tostring())); - } } function _uartEvent() { - server.log("Uart event") _rxBuf.seek(0, 'e'); _rxBuf.writeblob(_serial.readblob()); imp.wakeup(0, _parseRXBuffer.bindenv(this)); From c457d44f50a02f06be349228709c04bb726ba399 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 22:28:11 -0500 Subject: [PATCH 28/34] Update comments --- hardware/impeeduino/impeeduino.class.nut | 65 ++++++++++++++++++++---- 1 file changed, 54 insertions(+), 11 deletions(-) diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 233b9d7..9218fe6 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -66,7 +66,10 @@ class Impeeduino { } // -------------------- PUBLIC METHODS -------------------- // - /* Resets the ATMega processor. */ + /* + * Resets the ATMega processor by bouncing the reset pin. Note that reseting + * will block the imp for about 0.2 seconds. + */ function reset() { server.log("Resetting Duino...") _reset.write(1); @@ -74,12 +77,14 @@ class Impeeduino { _reset.write(0); } - /* Configures the specified GPIO pin to behave either as an input or an output. */ + /* + * Configures the specified GPIO pin to the specified mode. Possible + * configurations are DIGITAL_IN, DIGITAL_IN_PULLUP, DIGITAL_OUT, and PWM_OUT + */ function pinMode(pin, mode) { assert (typeof pin == "integer"); assert (pin != 0 && pin != 1); // Do not reconfigure UART bus pins _serial.write(OP_CONFIGURE | pin); - //server.log("Configuring " + pin); switch (mode) { case DIGITAL_IN: _serial.write(OP_ARB | CONFIG_INPUT); @@ -88,7 +93,6 @@ class Impeeduino { _serial.write(OP_ARB | CONFIG_INPUT_PULLUP); break; case DIGITAL_OUT: - //server.log("to Output"); _serial.write(OP_ARB | CONFIG_OUTPUT); break; case PWM_OUT: @@ -102,7 +106,12 @@ class Impeeduino { } } - // Writes a value to a digital pin + /* + * Writes a value to the specified digital pin. Value can be either a + * boolean or an integer value. For boolean values, true corresponding to + * high and false to low. For integers, non-zero values correspond to high + * and zero corresponds to false. + */ function digitalWrite(pin, value) { assert (typeof pin == "integer"); assert (typeof value == "integer" || typeof value == "bool"); @@ -114,7 +123,13 @@ class Impeeduino { _serial.flush(); } - // Writes an analog value (PWM wave) to a pin. value represents the duty cycle and ranges between 0 (off) and 255 (always on). + /* + * Writes an analog value (PWM wave) to a pin. *value* is an integer value + * representing the duty cycle and ranges between 0 (off) and 255 + * (always on). For compatibility with imp code, value may also be a + * floating point duty ratio from 0.0 to 1.0. This is then rounded to the + * nearest available value. + */ function analogWrite(pin, value) { assert (typeof pin == "integer"); if (PWM_PINMAP[pin] == -1) throw "Pin " + pin + " does not have PWM capability"; @@ -136,7 +151,11 @@ class Impeeduino { _serial.flush(); } - // Reads the value from a specified digital pin + /* + * Reads the logical value of the specified digital pin and returns it as + * an integer. A value of 0 corresponds to digital low, a value of 1 + * corresponds to digital high. + */ function digitalRead(pin, cb = null) { assert (typeof pin == "integer"); _serial.write(OP_DIGITAL_READ | pin); @@ -171,7 +190,10 @@ class Impeeduino { } } - // Reads the value from the specified analog pin. The Arduino board contains a 6 channel , 10-bit analog to digital converter. + /* + * Reads the value of the specified analog pin and returns it as an integer. + * The Arduino has a 10-bit ADC, so returned values will range from 0 to 1023. + */ function analogRead(pin, cb = null) { assert (typeof pin == "integer"); if (pin < 0 || pin > 5) throw "Invalid analog input number: " + pin; @@ -241,7 +263,12 @@ class Impeeduino { return value.readn('w'); } } - /* Calls function */ + /* + * Performs a function call on the Arduino. This is intended as a way to + * trigger additional functionality on the Arduino. There are 30 + * user-modifiable custom functions available in the Arduino code, with id + * numbers 1-30. + */ function functionCall(id, arg = "", cb = null) { assert (typeof id == "integer"); if (typeof arg != "string") throw "Function call argument must be type string"; @@ -262,7 +289,10 @@ class Impeeduino { } // -------------------- PRIVATE METHODS -------------------- // - + /* + * Processes the buffer of pending received data. ASCII data is transcribed + * to the function return value buffer, while opcodes are executed. + */ function _parseRXBuffer() { local buf = _rxBuf; _rxBuf = blob(); @@ -277,6 +307,7 @@ class Impeeduino { switch (readByte & MASK_OP) { case OP_DIGITAL_WRITE_0: local addr = readByte & MASK_DIGITAL_ADDR; + // Call callback if one has been assigned if (addr in _digitalReadcb) { imp.wakeup(0, function() { (delete _digitalReadcb[addr])(0); @@ -285,6 +316,7 @@ class Impeeduino { break; case OP_DIGITAL_WRITE_1: local addr = readByte & MASK_DIGITAL_ADDR; + // Call callback if one has been assigned if (addr in _digitalReadcb) { imp.wakeup(0, function() { (delete _digitalReadcb[addr])(1); @@ -296,6 +328,7 @@ class Impeeduino { local value = blob(2); value[0] = (buf.readn('b') & 0x0F) | ((buf.readn('b') & 0x0F) << 4); value[1] = buf.readn('b') & 0x0F; + // Call callback if one has been assigned if (addr in _analogReadcb) { imp.wakeup(0, function() { (delete _analogReadcb[addr])(value.readn('w')); @@ -307,6 +340,7 @@ class Impeeduino { local buf = _funcBuf; _funcBuf = blob(); buf.seek(0, 'b'); + // Call callback if one has been assigned if (addr in _functioncb) { imp.wakeup(0, function() { (delete _functioncb[addr])(buf); @@ -324,13 +358,22 @@ class Impeeduino { } } } - + /* + * UART data available event handler. Copies any available data to rxBuf, + * then calls _parseRXBuffer to interpret it. + */ function _uartEvent() { _rxBuf.seek(0, 'e'); _rxBuf.writeblob(_serial.readblob()); imp.wakeup(0, _parseRXBuffer.bindenv(this)); } + /* + * Compares the version string sent from the Arduino to a target version. + * By default, the Arduino sketch transmits its version on startup and then + * calls function 0 (0xE0). Assigning _versionCheck as the callback for + * functioncb[0] will perform a check on that version string. + */ function _versionCheck(data) { local versionString = format("%s", data.tostring()); server.log(versionString); From 980ecfddf579e20a45d1de8bca3f0d1fdb177433 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 22:29:29 -0500 Subject: [PATCH 29/34] Fixed small typo --- hardware/impeeduino/impeeduino.class.nut | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 9218fe6..a606786 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -4,7 +4,7 @@ class Impeeduino { static BAUD_RATE = 115200; - // PWM enabled pins. -1: No PWM, otherwise + // PWM enabled pins. -1: No PWM, otherwise gives address mapping static PWM_PINMAP = [-1, -1, -1, 0, -1, 1, 2, -1, -1, 3, 4, 5, -1, -1]; static MASK_OP = 0xF0; From f81463b678bbb145a31af5ae5273554228c40aa1 Mon Sep 17 00:00:00 2001 From: Sunny He Date: Sun, 6 Nov 2016 22:31:51 -0500 Subject: [PATCH 30/34] Update LICENSE to correct copyright year --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 514d025..e49d082 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2013 Electric Imp +Copyright (c) 2016 Electric Imp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 1bd9ee77cb150c780548a3807889f2092662ca77 Mon Sep 17 00:00:00 2001 From: Sunny He Date: Sun, 6 Nov 2016 23:16:36 -0500 Subject: [PATCH 31/34] Update README.md --- .../impeeduino/arduino/impeeduino/README.md | 113 ++++++++++-------- 1 file changed, 65 insertions(+), 48 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/README.md b/hardware/impeeduino/arduino/impeeduino/README.md index 4132c1c..9de9bb7 100644 --- a/hardware/impeeduino/arduino/impeeduino/README.md +++ b/hardware/impeeduino/arduino/impeeduino/README.md @@ -1,60 +1,77 @@ -Instruction format: 1[op (3b)][addr (4b)] - Any byte received that does not have MSB set to 1 is interpreted as ASCII data, - should be added to function call buffer. - -000 (0x80) Configure Pin - Must be followed by arb data with config type - 1111[configtype (4b)] - 0000 Input - 0001 Input PULLUP - 0010 Output - -001 (0x90) Digital Read - Arduino responds with digital write op corresponding to read value - -010 (0xA0) Digital Write 0 -011 (0xB0) Digital Write 1 +# Impeeduino Communication Scheme +This document provides documentation for the communication scheme between the imp001 and the ATMega. Incoming serial data is interpreted byte by byte, with commands differentiated from regular ASCII data by checking the most significant bit of each byte. This allows us to take advantage of regular strings sent via Serial.print() on the Arduino as a simple way to pass data while still leaving sufficient address space to assign most common functions to concise commands. +## Instruction Format +Instruction format: `1[op (3b)][addr (4b)]` +Any byte received that does not have its MSB set to 1 is interpreted as ASCII data and is added to function call buffer. The next 3 bits (bits 6:4) define the opcode, which determines what operation to perform. The last 4 bits (bits 3:0) define an address, usually used to describe a pin number. -100 (0xC0) Analog Op + W/~R + addr (3b) - pin 3 : 0 - pin 5 : 1 - pin 6 : 2 - pin 9 : 3 - pin 10: 4 - pin 11: 5 - - (0xC8 | addr) Analog Write: Must pass 1 byte argument 0-255 for PWM duty cycle - - Full instruction is 1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)] - - (0xC0 | addr) Analog Read: Arduino responds w/ copy of op and 10-bit ADC value split into 3 bytes. - - 1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)] - - Note imp is little-endian. +### 000 (0x80): Configure Pin +A command to configure a pin must be followed by arbitrary data op specifying the config type. + +Arbitrary data command byte format: `1111[configtype (4b)]` + +| Config Type | Decimal | Hex | Binary | +| ----------- | ------- | --- | ------ | +| Input | 0 | 0x0 | 0000 | +| Input Pullup| 1 | 0x1 | 0001 | +| Output | 2 | 0x2 | 0010 | +| PWM Output | 3 | 0x3 | 0011 | + +### 001 (0x90): Digital Read +The Arduino responds to a digital read command with digital write command byte corresponding to the read value. For instance, if the Arduino receives `0x96`, instructing a digital read of pin 6, it will respond with `0xA6` (Digital Write 0 on Pin 6) if pin 6 is low or `0xB6` (Digital Write 1 on Pin 6) if pin 6 is high. + +### 010 (0xA0): Digital Write 0 +Write digital low to the specified pin address. +### 011 (0xB0): Digital Write 1 +Write digital high to the specified pin address. + +### 100 (0xC0): Analog Op +This opcode represents both analog reads and writes. Since there are only 5 analog inputs and 6 PWM enabled outputs on the Arduino, this first bit of the address field can be used to choose between a analogWrite or analogRead while still being able to address all the applicable pins. In the future it might be worth redesignating one of the function call opcodes in order to address boards with more outputs. + +Analog operation format: `1100[W/~R (1b)][addr (3b)]` + +For analog writes, the Arduino pin numbers are remapped to the available address space as shown below: + +| Arduino Pin Number | Command Address | Example Analog Write | +| -------- | --------- | ----------- | +| 3 | 0 | `0xC8 = 1100 1 000` | +| 5 | 1 | `0xC9 = 1100 1 001` | +| 6 | 2 | `0xCA = 1100 1 010` | +| 9 | 3 | `0xCB = 1100 1 011` | +| 10 | 4 | `0xCC = 1100 1 100` | +| 11 | 5 | `0xCD = 1100 1 101` | + +Analog writes must also pass a 1 byte argument for the PWM duty cycle. The two bytes after the intial analogWrite command must be arbitrary data bytes with the least significant word, then most significant word, of the duty cycle. +Thus a complete analogWrite instruction would be: `1100 1[addr (3b)], 1101[LSB (4b)], 1101[MSB (4b)]`. -101 (0xD0) Arb data/Reserved +Analog reads return a 10-bit ADC value. The Arduino responds with a copy of the original analog operation command followed by 3 arbitrary data commands containing the 10-bit ADC value split into 3 words. The words are sent in little-endian order. +A complete analogRead response would be: `1100 0[addr (3b)], 1101 [ADC(3:0)], 1101 [ADC(7:4)], 1101 00[ADC(9:8)]` -110 (0xE0) Call/Return - call 0 (11000000) reserved for "clear buffer" -111 (0xF0) Call/Return - 11111111 (0xFF) May not be used to avoid confusion +### 101 (0xD0): Arbitrary Data +This operation is used by other operations to send words of binary data. It is preferable to have an arbitrary data operation in order to avoid issues with interfering with ASCII data being sent as part of a function call or have awkward situations such as long strings of `0xFF` bytes being confused with a -1 read return value. + +### 110 (0xE0) and 111 (0xF0): Call/Return +These operations call user-defined functions in the Arduino code. A character array buffer stores incoming ASCII characters received on the UART bus and is passed as the argument to function calls. Between the opcodes `0xE0` and `0xF0`, there are 32 possible functions that may be called. These are referred to with a 5-bit ID, meaning that it may be more accurate to describe the call operation format as: `11[function id (5b)]` + +There are two function calls that are reserved for system use. + - *call 0* (`0xE0` or `11000000`) is used to clear the receive buffers. + - *call 31* (`0xFF` or `11111111`) may not be used to avoid any confusion with -1, which is commonly used to indicate "no data" by UART read functions. -========== -Function call process +The complete function call process is summarized below: -Valid functions are 1-30 (0x01 to 0x1E) -function 0 (0x00) is reserved as "clear buffer" -function 32 (0xFF) is not allowed to avoid 0xFF confusion with -1 +Valid functions ids are 1-30 (`0x01` to `0x1E`). +function 0 `(0x00)` is reserved as "clear buffer." +function 31 `(0xFF)` is not allowed to avoid confusion with -1. -1. Imp sends "call 0x00" to clear Arduino function buffer +1. Imp sends *call 0x00* to clear Arduino function buffer 2. Imp sends function argument as ASCII characters (0-127) 3. Arduino places received characters into buffer -4. Imp sends "call 0xXX" to initiate call of function #XX -5. Arduino calls functionXX() with the function buffer's contents as the argument -6. functionXX returns, optionally with a character array return value -7. Arduino sends "call 0x00" to clear Imp's return value buffer +4. Imp sends *call 0xXX* to initiate call of the function with id number 0xXX +5. Arduino calls *functionXX()* with the function buffer's contents as the argument +6. *functionXX* returns, optionally with a character array return value +7. Arduino sends *call 0x00* to clear Imp's return value buffer 8. Arduino sends return value as ASCII characters 9. Imp places received characters into buffer -10. Arduino sends "call 0xXX" to indicate function return -11. If a callback has been set, Imp calls it with the returned value as an argument. \ No newline at end of file +10. Arduino sends *call 0xXX* to indicate function return +11. If a callback has been set, Imp calls it with the returned value as an argument. From 00882757147896540547f4b974241493f897a08a Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 23:28:40 -0500 Subject: [PATCH 32/34] Remove extraneous device code from library squirrel file. Advance version to 1.0.0 --- hardware/impeeduino/README.md | 2 +- .../arduino/impeeduino/impeeduino.ino | 374 +++++++++--------- .../example/remotecontrol.device.nut | 1 - hardware/impeeduino/impeeduino.class.nut | 59 +-- 4 files changed, 190 insertions(+), 246 deletions(-) diff --git a/hardware/impeeduino/README.md b/hardware/impeeduino/README.md index 308a0ec..cda05cc 100644 --- a/hardware/impeeduino/README.md +++ b/hardware/impeeduino/README.md @@ -1,4 +1,4 @@ -# Impeeduino 0.0.? +# Impeeduino 1.0.0 The Impeeduino is a combination of an imp001 and an Arduino. This library provides a simple way to instruct the Arduino side of the Impeeduino to perform basic tasks over UART. diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 159e969..aa51179 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,188 +1,188 @@ -#define VERSION "0.0.3" - -#define BAUD_RATE 115200 -#define DELAY_WRITE 50 - -#define MASK_OP 0xF0 -#define OP_CONFIGURE 0x80 -#define OP_DIGITAL_READ 0x90 -#define OP_DIGITAL_WRITE_0 0xA0 -#define OP_DIGITAL_WRITE_1 0xB0 -#define OP_ANALOG 0xC0 -#define OP_ARB 0xD0 -#define OP_CALL0 0xE0 -#define OP_CALL1 0xF0 - -#define MASK_CONFIG 0x0F -#define CONFIG_INPUT 0x00 -#define CONFIG_INPUT_PULLUP 0x01 -#define CONFIG_OUTPUT 0x02 -#define CONFIG_OUTPUT_PWM 0x03 - -#define MASK_DIGITAL_ADDR 0x0F -#define MASK_DIGITAL_WRITE 0x10 -#define MASK_ANALOG_W 0x08 -#define MASK_ANALOG_ADDR 0x07 -#define MASK_CALL 0x1F - -const int PWM_PINMAP[6] = {3, 5, 6, 9, 10, 11}; - -unsigned int rxByte = 0; -unsigned int rxOp = 0; -char rxbuffer[1024]; -int rxbufferindex = 0; - -// ========== USER-DEFINED FUNCTIONS ========== // -char* function01(char* buf) { - // Send back data from the Arduino - Serial.print(millis()); - return ""; -} -char* function02(char* buf) { return buf; } -char* function03(char* buf) { return buf; } -char* function04(char* buf) { return buf; } -char* function05(char* buf) { return buf; } -char* function06(char* buf) { return buf; } -char* function07(char* buf) { return buf; } -char* function08(char* buf) { return buf; } -char* function09(char* buf) { return buf; } -char* function0A(char* buf) { return buf; } -char* function0B(char* buf) { return buf; } -char* function0C(char* buf) { return buf; } -char* function0D(char* buf) { return buf; } -char* function0E(char* buf) { return buf; } -char* function0F(char* buf) { return buf; } - -char* function10(char* buf) { return buf; } -char* function11(char* buf) { return buf; } -char* function12(char* buf) { return buf; } -char* function13(char* buf) { return buf; } -char* function14(char* buf) { return buf; } -char* function15(char* buf) { return buf; } -char* function16(char* buf) { return buf; } -char* function17(char* buf) { return buf; } -char* function18(char* buf) { return buf; } -char* function19(char* buf) { return buf; } -char* function1A(char* buf) { return buf; } -char* function1B(char* buf) { return buf; } -char* function1C(char* buf) { return buf; } -char* function1D(char* buf) { return buf; } -char* function1E(char* buf) { return buf; } - -void setup() { - Serial.begin(BAUD_RATE); - Serial.print("Impeeduino Version: "); - Serial.println(VERSION); - Serial.write(OP_CALL0); - Serial.flush(); -} - -void loop() { - if (Serial.available()) { - // get the new byte: - - rxByte = (char)Serial.read(); - if (rxByte & 0x80) { - // Not ASCII text, attempt to decode opcode - rxOp = rxByte & MASK_OP; - if (rxOp == OP_DIGITAL_READ) { - if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { - //Serial.println("Digital HIGH"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); - } else { - //Serial.println("Digital LOW"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); - } - } else if (rxOp == OP_DIGITAL_WRITE_0) { - //Serial.println("Writing LOW"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); - delay(DELAY_WRITE); - } else if (rxOp == OP_DIGITAL_WRITE_1) { - //Serial.println("Writing HIGH"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); - delay(DELAY_WRITE); - } else if (rxOp == OP_ANALOG) { - if (rxByte & MASK_ANALOG_W) { - int addr = rxByte & MASK_ANALOG_ADDR; - // Wait for value bytes to arrive - while(Serial.available() < 2); - // Lowest order bits (3-0) - char value = Serial.read() & 0x0F; - // Higest order bits (7-4) - value = value | ((Serial.read() & 0x0F) << 4); - //Serial.write(value); - analogWrite(PWM_PINMAP[addr], value); - } else { - Serial.write(rxByte); - int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); - // Lowest order bits (3-0) - Serial.write(OP_ARB | (analogvalue & 0x0F)); - // Middle bits (7-4) - Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); - // Highest order bits (9-8) - Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); - } - - } else if (rxOp == OP_CONFIGURE) { - switch (Serial.read() & MASK_CONFIG) { - case CONFIG_INPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); - break; - case CONFIG_INPUT_PULLUP: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); - break; - case CONFIG_OUTPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); - break; - } - } else if (rxOp == OP_ARB) { - - } else { - // Call Function Op: 111X - rxbuffer[rxbufferindex] = '\0'; - switch (rxByte & MASK_CALL) { - case 0x00: Serial.write(rxbuffer); break; - case 0x01: Serial.write(function01(rxbuffer)); break; - case 0x02: Serial.write(function02(rxbuffer)); break; - case 0x03: Serial.write(function03(rxbuffer)); break; - case 0x04: Serial.write(function04(rxbuffer)); break; - case 0x05: Serial.write(function05(rxbuffer)); break; - case 0x06: Serial.write(function06(rxbuffer)); break; - case 0x07: Serial.write(function07(rxbuffer)); break; - case 0x08: Serial.write(function08(rxbuffer)); break; - case 0x09: Serial.write(function09(rxbuffer)); break; - case 0x0A: Serial.write(function0A(rxbuffer)); break; - case 0x0B: Serial.write(function0B(rxbuffer)); break; - case 0x0C: Serial.write(function0C(rxbuffer)); break; - case 0x0D: Serial.write(function0D(rxbuffer)); break; - case 0x0E: Serial.write(function0E(rxbuffer)); break; - case 0x0F: Serial.write(function0F(rxbuffer)); break; - - case 0x10: Serial.write(function10(rxbuffer)); break; - case 0x11: Serial.write(function11(rxbuffer)); break; - case 0x12: Serial.write(function12(rxbuffer)); break; - case 0x13: Serial.write(function13(rxbuffer)); break; - case 0x14: Serial.write(function14(rxbuffer)); break; - case 0x15: Serial.write(function15(rxbuffer)); break; - case 0x16: Serial.write(function16(rxbuffer)); break; - case 0x17: Serial.write(function17(rxbuffer)); break; - case 0x18: Serial.write(function18(rxbuffer)); break; - case 0x19: Serial.write(function19(rxbuffer)); break; - case 0x1A: Serial.write(function1A(rxbuffer)); break; - case 0x1B: Serial.write(function1B(rxbuffer)); break; - case 0x1C: Serial.write(function1C(rxbuffer)); break; - case 0x1D: Serial.write(function1D(rxbuffer)); break; - case 0x1E: Serial.write(function1E(rxbuffer)); break; - } - Serial.write(rxByte); - Serial.flush(); - rxbufferindex = 0; - } - } else { - // Received ASCII text, insert into rxbuffer - rxbuffer[rxbufferindex] = char(rxByte); - rxbufferindex++; - } - } -} +#define VERSION "1.0.0" + +#define BAUD_RATE 115200 +#define DELAY_WRITE 50 + +#define MASK_OP 0xF0 +#define OP_CONFIGURE 0x80 +#define OP_DIGITAL_READ 0x90 +#define OP_DIGITAL_WRITE_0 0xA0 +#define OP_DIGITAL_WRITE_1 0xB0 +#define OP_ANALOG 0xC0 +#define OP_ARB 0xD0 +#define OP_CALL0 0xE0 +#define OP_CALL1 0xF0 + +#define MASK_CONFIG 0x0F +#define CONFIG_INPUT 0x00 +#define CONFIG_INPUT_PULLUP 0x01 +#define CONFIG_OUTPUT 0x02 +#define CONFIG_OUTPUT_PWM 0x03 + +#define MASK_DIGITAL_ADDR 0x0F +#define MASK_DIGITAL_WRITE 0x10 +#define MASK_ANALOG_W 0x08 +#define MASK_ANALOG_ADDR 0x07 +#define MASK_CALL 0x1F + +const int PWM_PINMAP[6] = {3, 5, 6, 9, 10, 11}; + +unsigned int rxByte = 0; +unsigned int rxOp = 0; +char rxbuffer[1024]; +int rxbufferindex = 0; + +// ========== USER-DEFINED FUNCTIONS ========== // +char* function01(char* buf) { + // Send back data from the Arduino + Serial.print(millis()); + return ""; +} +char* function02(char* buf) { return buf; } +char* function03(char* buf) { return buf; } +char* function04(char* buf) { return buf; } +char* function05(char* buf) { return buf; } +char* function06(char* buf) { return buf; } +char* function07(char* buf) { return buf; } +char* function08(char* buf) { return buf; } +char* function09(char* buf) { return buf; } +char* function0A(char* buf) { return buf; } +char* function0B(char* buf) { return buf; } +char* function0C(char* buf) { return buf; } +char* function0D(char* buf) { return buf; } +char* function0E(char* buf) { return buf; } +char* function0F(char* buf) { return buf; } + +char* function10(char* buf) { return buf; } +char* function11(char* buf) { return buf; } +char* function12(char* buf) { return buf; } +char* function13(char* buf) { return buf; } +char* function14(char* buf) { return buf; } +char* function15(char* buf) { return buf; } +char* function16(char* buf) { return buf; } +char* function17(char* buf) { return buf; } +char* function18(char* buf) { return buf; } +char* function19(char* buf) { return buf; } +char* function1A(char* buf) { return buf; } +char* function1B(char* buf) { return buf; } +char* function1C(char* buf) { return buf; } +char* function1D(char* buf) { return buf; } +char* function1E(char* buf) { return buf; } + +void setup() { + Serial.begin(BAUD_RATE); + Serial.print("Impeeduino Version: "); + Serial.println(VERSION); + Serial.write(OP_CALL0); + Serial.flush(); +} + +void loop() { + if (Serial.available()) { + // get the new byte: + + rxByte = (char)Serial.read(); + if (rxByte & 0x80) { + // Not ASCII text, attempt to decode opcode + rxOp = rxByte & MASK_OP; + if (rxOp == OP_DIGITAL_READ) { + if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { + //Serial.println("Digital HIGH"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); + } else { + //Serial.println("Digital LOW"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); + } + } else if (rxOp == OP_DIGITAL_WRITE_0) { + //Serial.println("Writing LOW"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); + delay(DELAY_WRITE); + } else if (rxOp == OP_DIGITAL_WRITE_1) { + //Serial.println("Writing HIGH"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); + delay(DELAY_WRITE); + } else if (rxOp == OP_ANALOG) { + if (rxByte & MASK_ANALOG_W) { + int addr = rxByte & MASK_ANALOG_ADDR; + // Wait for value bytes to arrive + while(Serial.available() < 2); + // Lowest order bits (3-0) + char value = Serial.read() & 0x0F; + // Higest order bits (7-4) + value = value | ((Serial.read() & 0x0F) << 4); + //Serial.write(value); + analogWrite(PWM_PINMAP[addr], value); + } else { + Serial.write(rxByte); + int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); + // Lowest order bits (3-0) + Serial.write(OP_ARB | (analogvalue & 0x0F)); + // Middle bits (7-4) + Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); + // Highest order bits (9-8) + Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); + } + + } else if (rxOp == OP_CONFIGURE) { + switch (Serial.read() & MASK_CONFIG) { + case CONFIG_INPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); + break; + case CONFIG_INPUT_PULLUP: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); + break; + case CONFIG_OUTPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); + break; + } + } else if (rxOp == OP_ARB) { + + } else { + // Call Function Op: 111X + rxbuffer[rxbufferindex] = '\0'; + switch (rxByte & MASK_CALL) { + case 0x00: Serial.write(rxbuffer); break; + case 0x01: Serial.write(function01(rxbuffer)); break; + case 0x02: Serial.write(function02(rxbuffer)); break; + case 0x03: Serial.write(function03(rxbuffer)); break; + case 0x04: Serial.write(function04(rxbuffer)); break; + case 0x05: Serial.write(function05(rxbuffer)); break; + case 0x06: Serial.write(function06(rxbuffer)); break; + case 0x07: Serial.write(function07(rxbuffer)); break; + case 0x08: Serial.write(function08(rxbuffer)); break; + case 0x09: Serial.write(function09(rxbuffer)); break; + case 0x0A: Serial.write(function0A(rxbuffer)); break; + case 0x0B: Serial.write(function0B(rxbuffer)); break; + case 0x0C: Serial.write(function0C(rxbuffer)); break; + case 0x0D: Serial.write(function0D(rxbuffer)); break; + case 0x0E: Serial.write(function0E(rxbuffer)); break; + case 0x0F: Serial.write(function0F(rxbuffer)); break; + + case 0x10: Serial.write(function10(rxbuffer)); break; + case 0x11: Serial.write(function11(rxbuffer)); break; + case 0x12: Serial.write(function12(rxbuffer)); break; + case 0x13: Serial.write(function13(rxbuffer)); break; + case 0x14: Serial.write(function14(rxbuffer)); break; + case 0x15: Serial.write(function15(rxbuffer)); break; + case 0x16: Serial.write(function16(rxbuffer)); break; + case 0x17: Serial.write(function17(rxbuffer)); break; + case 0x18: Serial.write(function18(rxbuffer)); break; + case 0x19: Serial.write(function19(rxbuffer)); break; + case 0x1A: Serial.write(function1A(rxbuffer)); break; + case 0x1B: Serial.write(function1B(rxbuffer)); break; + case 0x1C: Serial.write(function1C(rxbuffer)); break; + case 0x1D: Serial.write(function1D(rxbuffer)); break; + case 0x1E: Serial.write(function1E(rxbuffer)); break; + } + Serial.write(rxByte); + Serial.flush(); + rxbufferindex = 0; + } + } else { + // Received ASCII text, insert into rxbuffer + rxbuffer[rxbufferindex] = char(rxByte); + rxbufferindex++; + } + } +} diff --git a/hardware/impeeduino/example/remotecontrol.device.nut b/hardware/impeeduino/example/remotecontrol.device.nut index 90b45f8..d7f08b7 100644 --- a/hardware/impeeduino/example/remotecontrol.device.nut +++ b/hardware/impeeduino/example/remotecontrol.device.nut @@ -31,7 +31,6 @@ agent.on("digitalRead", function(data) { } else { server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); } - activityLED.write(0); }); agent.on("analogRead", function(data) { diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index a606786..104f512 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -1,6 +1,6 @@ class Impeeduino { - static version = [0, 0, 3] + static version = [1, 0, 0] static BAUD_RATE = 115200; @@ -382,59 +382,4 @@ class Impeeduino { server.error("Impeeduino version mismatch!"); } } -} - -activityLED <- hardware.pin2; -linkLED <- hardware.pin8; - -server.log("Starting... "); -impeeduino <- Impeeduino(); - -agent.on("config", function(data) { - activityLED.write(1); - server.log("Configuring pin " + data.pin); - impeeduino.pinMode(data.pin, data.val); - activityLED.write(0); -}); -agent.on("digitalWrite", function(data) { - activityLED.write(1); - server.log("Writing " + data.val + " to pin " + data.pin); - impeeduino.digitalWrite(data.pin, data.val); - activityLED.write(0); -}); -agent.on("analogWrite", function(data) { - activityLED.write(1); - server.log("PWM " + data.val + " to pin " + data.pin); - impeeduino.analogWrite(data.pin, data.val); - activityLED.write(0); -}); -agent.on("digitalRead", function(data) { - activityLED.write(1); - if (data.async) { - impeeduino.digitalRead(data.pin, function(value) { - server.log("Async: Pin " + data.pin + " = " + value); - }); - } else { - server.log("Pin " + data.pin + " = " + impeeduino.digitalRead(data.pin)); - } - activityLED.write(0); -}); -agent.on("analogRead", function(data) { - activityLED.write(1); - if (data.async) { - impeeduino.analogRead(data.pin, function(value) { - server.log("Async: Pin A" + data.pin + " = " + value); - }); - } else { - server.log("Pin A" + data.pin + " = " + impeeduino.analogRead(data.pin)); - } - activityLED.write(0); -}); -agent.on("call", function(data) { - activityLED.write(1); - server.log("Calling function " + data.id); - impeeduino.functionCall(data.id, data.arg, function(value) { - server.log("Function " + data.id + " returned with value: " + value); - }); - activityLED.write(0); -}); \ No newline at end of file +} \ No newline at end of file From eeb5da3978669c459546866227cd52d855dd1f17 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sun, 6 Nov 2016 23:34:20 -0500 Subject: [PATCH 33/34] Update license headers --- hardware/impeeduino/arduino/impeeduino/README.md | 4 ++++ hardware/impeeduino/arduino/impeeduino/impeeduino.ino | 4 ++++ hardware/impeeduino/example/remotecontrol.agent.nut | 4 ++++ hardware/impeeduino/example/remotecontrol.device.nut | 4 ++++ hardware/impeeduino/impeeduino.class.nut | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/hardware/impeeduino/arduino/impeeduino/README.md b/hardware/impeeduino/arduino/impeeduino/README.md index 9de9bb7..51021e6 100644 --- a/hardware/impeeduino/arduino/impeeduino/README.md +++ b/hardware/impeeduino/arduino/impeeduino/README.md @@ -75,3 +75,7 @@ function 31 `(0xFF)` is not allowed to avoid confusion with -1. 9. Imp places received characters into buffer 10. Arduino sends *call 0xXX* to indicate function return 11. If a callback has been set, Imp calls it with the returned value as an argument. + +## License + +The Impeeduino Arduino sketch and associated materials are provided under the [MIT License](../../LICENSE). \ No newline at end of file diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index aa51179..4595efb 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,3 +1,7 @@ +// Copyright (c) 2016 Electric Imp +// This file is licensed under the MIT License +// http://opensource.org/licenses/MIT + #define VERSION "1.0.0" #define BAUD_RATE 115200 diff --git a/hardware/impeeduino/example/remotecontrol.agent.nut b/hardware/impeeduino/example/remotecontrol.agent.nut index 1e6b550..5e1dea3 100644 --- a/hardware/impeeduino/example/remotecontrol.agent.nut +++ b/hardware/impeeduino/example/remotecontrol.agent.nut @@ -1,3 +1,7 @@ +// Copyright (c) 2016 Electric Imp +// This file is licensed under the MIT License +// http://opensource.org/licenses/MIT + function requestHandler(request, response) { try { if ("command" in request.query) { diff --git a/hardware/impeeduino/example/remotecontrol.device.nut b/hardware/impeeduino/example/remotecontrol.device.nut index d7f08b7..0c289da 100644 --- a/hardware/impeeduino/example/remotecontrol.device.nut +++ b/hardware/impeeduino/example/remotecontrol.device.nut @@ -1,3 +1,7 @@ +// Copyright (c) 2016 Electric Imp +// This file is licensed under the MIT License +// http://opensource.org/licenses/MIT + activityLED <- hardware.pin2; linkLED <- hardware.pin8; diff --git a/hardware/impeeduino/impeeduino.class.nut b/hardware/impeeduino/impeeduino.class.nut index 104f512..834551d 100644 --- a/hardware/impeeduino/impeeduino.class.nut +++ b/hardware/impeeduino/impeeduino.class.nut @@ -1,3 +1,7 @@ +// Copyright (c) 2016 Electric Imp +// This file is licensed under the MIT License +// http://opensource.org/licenses/MIT + class Impeeduino { static version = [1, 0, 0] From 679bc6be9aaff2a328faff4011b369affcf46eb0 Mon Sep 17 00:00:00 2001 From: AG6GR Date: Sat, 1 Apr 2017 21:45:00 -0400 Subject: [PATCH 34/34] Fresh version of Arduino code --- .../arduino/impeeduino/impeeduino.ino | 387 +++++++++--------- .../impeeduino/impeeduino.ino.standard.hex | 248 +++++------ ...mpeeduino.ino.with_bootloader.standard.hex | 248 +++++------ 3 files changed, 445 insertions(+), 438 deletions(-) diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino index 4595efb..382bca0 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino @@ -1,192 +1,195 @@ -// Copyright (c) 2016 Electric Imp -// This file is licensed under the MIT License -// http://opensource.org/licenses/MIT - -#define VERSION "1.0.0" - -#define BAUD_RATE 115200 -#define DELAY_WRITE 50 - -#define MASK_OP 0xF0 -#define OP_CONFIGURE 0x80 -#define OP_DIGITAL_READ 0x90 -#define OP_DIGITAL_WRITE_0 0xA0 -#define OP_DIGITAL_WRITE_1 0xB0 -#define OP_ANALOG 0xC0 -#define OP_ARB 0xD0 -#define OP_CALL0 0xE0 -#define OP_CALL1 0xF0 - -#define MASK_CONFIG 0x0F -#define CONFIG_INPUT 0x00 -#define CONFIG_INPUT_PULLUP 0x01 -#define CONFIG_OUTPUT 0x02 -#define CONFIG_OUTPUT_PWM 0x03 - -#define MASK_DIGITAL_ADDR 0x0F -#define MASK_DIGITAL_WRITE 0x10 -#define MASK_ANALOG_W 0x08 -#define MASK_ANALOG_ADDR 0x07 -#define MASK_CALL 0x1F - -const int PWM_PINMAP[6] = {3, 5, 6, 9, 10, 11}; - -unsigned int rxByte = 0; -unsigned int rxOp = 0; -char rxbuffer[1024]; -int rxbufferindex = 0; - -// ========== USER-DEFINED FUNCTIONS ========== // -char* function01(char* buf) { - // Send back data from the Arduino - Serial.print(millis()); - return ""; -} -char* function02(char* buf) { return buf; } -char* function03(char* buf) { return buf; } -char* function04(char* buf) { return buf; } -char* function05(char* buf) { return buf; } -char* function06(char* buf) { return buf; } -char* function07(char* buf) { return buf; } -char* function08(char* buf) { return buf; } -char* function09(char* buf) { return buf; } -char* function0A(char* buf) { return buf; } -char* function0B(char* buf) { return buf; } -char* function0C(char* buf) { return buf; } -char* function0D(char* buf) { return buf; } -char* function0E(char* buf) { return buf; } -char* function0F(char* buf) { return buf; } - -char* function10(char* buf) { return buf; } -char* function11(char* buf) { return buf; } -char* function12(char* buf) { return buf; } -char* function13(char* buf) { return buf; } -char* function14(char* buf) { return buf; } -char* function15(char* buf) { return buf; } -char* function16(char* buf) { return buf; } -char* function17(char* buf) { return buf; } -char* function18(char* buf) { return buf; } -char* function19(char* buf) { return buf; } -char* function1A(char* buf) { return buf; } -char* function1B(char* buf) { return buf; } -char* function1C(char* buf) { return buf; } -char* function1D(char* buf) { return buf; } -char* function1E(char* buf) { return buf; } - -void setup() { - Serial.begin(BAUD_RATE); - Serial.print("Impeeduino Version: "); - Serial.println(VERSION); - Serial.write(OP_CALL0); - Serial.flush(); -} - -void loop() { - if (Serial.available()) { - // get the new byte: - - rxByte = (char)Serial.read(); - if (rxByte & 0x80) { - // Not ASCII text, attempt to decode opcode - rxOp = rxByte & MASK_OP; - if (rxOp == OP_DIGITAL_READ) { - if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { - //Serial.println("Digital HIGH"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); - } else { - //Serial.println("Digital LOW"); - Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); - } - } else if (rxOp == OP_DIGITAL_WRITE_0) { - //Serial.println("Writing LOW"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); - delay(DELAY_WRITE); - } else if (rxOp == OP_DIGITAL_WRITE_1) { - //Serial.println("Writing HIGH"); - digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); - delay(DELAY_WRITE); - } else if (rxOp == OP_ANALOG) { - if (rxByte & MASK_ANALOG_W) { - int addr = rxByte & MASK_ANALOG_ADDR; - // Wait for value bytes to arrive - while(Serial.available() < 2); - // Lowest order bits (3-0) - char value = Serial.read() & 0x0F; - // Higest order bits (7-4) - value = value | ((Serial.read() & 0x0F) << 4); - //Serial.write(value); - analogWrite(PWM_PINMAP[addr], value); - } else { - Serial.write(rxByte); - int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); - // Lowest order bits (3-0) - Serial.write(OP_ARB | (analogvalue & 0x0F)); - // Middle bits (7-4) - Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); - // Highest order bits (9-8) - Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); - } - - } else if (rxOp == OP_CONFIGURE) { - switch (Serial.read() & MASK_CONFIG) { - case CONFIG_INPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); - break; - case CONFIG_INPUT_PULLUP: - pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); - break; - case CONFIG_OUTPUT: - pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); - break; - } - } else if (rxOp == OP_ARB) { - - } else { - // Call Function Op: 111X - rxbuffer[rxbufferindex] = '\0'; - switch (rxByte & MASK_CALL) { - case 0x00: Serial.write(rxbuffer); break; - case 0x01: Serial.write(function01(rxbuffer)); break; - case 0x02: Serial.write(function02(rxbuffer)); break; - case 0x03: Serial.write(function03(rxbuffer)); break; - case 0x04: Serial.write(function04(rxbuffer)); break; - case 0x05: Serial.write(function05(rxbuffer)); break; - case 0x06: Serial.write(function06(rxbuffer)); break; - case 0x07: Serial.write(function07(rxbuffer)); break; - case 0x08: Serial.write(function08(rxbuffer)); break; - case 0x09: Serial.write(function09(rxbuffer)); break; - case 0x0A: Serial.write(function0A(rxbuffer)); break; - case 0x0B: Serial.write(function0B(rxbuffer)); break; - case 0x0C: Serial.write(function0C(rxbuffer)); break; - case 0x0D: Serial.write(function0D(rxbuffer)); break; - case 0x0E: Serial.write(function0E(rxbuffer)); break; - case 0x0F: Serial.write(function0F(rxbuffer)); break; - - case 0x10: Serial.write(function10(rxbuffer)); break; - case 0x11: Serial.write(function11(rxbuffer)); break; - case 0x12: Serial.write(function12(rxbuffer)); break; - case 0x13: Serial.write(function13(rxbuffer)); break; - case 0x14: Serial.write(function14(rxbuffer)); break; - case 0x15: Serial.write(function15(rxbuffer)); break; - case 0x16: Serial.write(function16(rxbuffer)); break; - case 0x17: Serial.write(function17(rxbuffer)); break; - case 0x18: Serial.write(function18(rxbuffer)); break; - case 0x19: Serial.write(function19(rxbuffer)); break; - case 0x1A: Serial.write(function1A(rxbuffer)); break; - case 0x1B: Serial.write(function1B(rxbuffer)); break; - case 0x1C: Serial.write(function1C(rxbuffer)); break; - case 0x1D: Serial.write(function1D(rxbuffer)); break; - case 0x1E: Serial.write(function1E(rxbuffer)); break; - } - Serial.write(rxByte); - Serial.flush(); - rxbufferindex = 0; - } - } else { - // Received ASCII text, insert into rxbuffer - rxbuffer[rxbufferindex] = char(rxByte); - rxbufferindex++; - } - } -} - +// Copyright (c) 2016 Electric Imp +// This file is licensed under the MIT License +// http://opensource.org/licenses/MIT + +#define VERSION "1.0.0" + +#define BAUD_RATE 115200 +#define DELAY_WRITE 50 + +#define MASK_OP 0xF0 +#define OP_CONFIGURE 0x80 +#define OP_DIGITAL_READ 0x90 +#define OP_DIGITAL_WRITE_0 0xA0 +#define OP_DIGITAL_WRITE_1 0xB0 +#define OP_ANALOG 0xC0 +#define OP_ARB 0xD0 +#define OP_CALL0 0xE0 +#define OP_CALL1 0xF0 + +#define MASK_CONFIG 0x0F +#define CONFIG_INPUT 0x00 +#define CONFIG_INPUT_PULLUP 0x01 +#define CONFIG_OUTPUT 0x02 +#define CONFIG_OUTPUT_PWM 0x03 + +#define MASK_DIGITAL_ADDR 0x0F +#define MASK_DIGITAL_WRITE 0x10 +#define MASK_ANALOG_W 0x08 +#define MASK_ANALOG_ADDR 0x07 +#define MASK_CALL 0x1F + +const int PWM_PINMAP[6] = {3, 5, 6, 9, 10, 11}; + +unsigned int rxByte = 0; +unsigned int rxOp = 0; +char rxbuffer[1024]; +int rxbufferindex = 0; + +// ========== USER-DEFINED FUNCTIONS ========== // +char* function01(char* buf) { + // Send back data from the Arduino + Serial.print(millis()); + return ""; +} +char* function02(char* buf) { return buf; } +char* function03(char* buf) { return buf; } +char* function04(char* buf) { return buf; } +char* function05(char* buf) { return buf; } +char* function06(char* buf) { return buf; } +char* function07(char* buf) { return buf; } +char* function08(char* buf) { return buf; } +char* function09(char* buf) { return buf; } +char* function0A(char* buf) { return buf; } +char* function0B(char* buf) { return buf; } +char* function0C(char* buf) { return buf; } +char* function0D(char* buf) { return buf; } +char* function0E(char* buf) { return buf; } +char* function0F(char* buf) { return buf; } + +char* function10(char* buf) { return buf; } +char* function11(char* buf) { return buf; } +char* function12(char* buf) { return buf; } +char* function13(char* buf) { return buf; } +char* function14(char* buf) { return buf; } +char* function15(char* buf) { return buf; } +char* function16(char* buf) { return buf; } +char* function17(char* buf) { return buf; } +char* function18(char* buf) { return buf; } +char* function19(char* buf) { return buf; } +char* function1A(char* buf) { return buf; } +char* function1B(char* buf) { return buf; } +char* function1C(char* buf) { return buf; } +char* function1D(char* buf) { return buf; } +char* function1E(char* buf) { return buf; } + +void setup() { + Serial.begin(BAUD_RATE); + Serial.print("Impeeduino Version: "); + Serial.println(VERSION); + Serial.write(OP_CALL0); + Serial.flush(); + digitalWrite(7, HIGH); + delay(500); + digitalWrite(7,LOW); +} + +void loop() { + if (Serial.available()) { + // get the new byte: + + rxByte = (char)Serial.read(); + if (rxByte & 0x80) { + // Not ASCII text, attempt to decode opcode + rxOp = rxByte & MASK_OP; + if (rxOp == OP_DIGITAL_READ) { + if (digitalRead(rxByte & MASK_DIGITAL_ADDR) == HIGH) { + //Serial.println("Digital HIGH"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_1); + } else { + //Serial.println("Digital LOW"); + Serial.write((rxByte & MASK_DIGITAL_ADDR) | OP_DIGITAL_WRITE_0); + } + } else if (rxOp == OP_DIGITAL_WRITE_0) { + //Serial.println("Writing LOW"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, LOW); + delay(DELAY_WRITE); + } else if (rxOp == OP_DIGITAL_WRITE_1) { + //Serial.println("Writing HIGH"); + digitalWrite(rxByte & MASK_DIGITAL_ADDR, HIGH); + delay(DELAY_WRITE); + } else if (rxOp == OP_ANALOG) { + if (rxByte & MASK_ANALOG_W) { + int addr = rxByte & MASK_ANALOG_ADDR; + // Wait for value bytes to arrive + while(Serial.available() < 2); + // Lowest order bits (3-0) + char value = Serial.read() & 0x0F; + // Higest order bits (7-4) + value = value | ((Serial.read() & 0x0F) << 4); + //Serial.write(value); + analogWrite(PWM_PINMAP[addr], value); + } else { + Serial.write(rxByte); + int analogvalue = analogRead(rxByte & MASK_ANALOG_ADDR); + // Lowest order bits (3-0) + Serial.write(OP_ARB | (analogvalue & 0x0F)); + // Middle bits (7-4) + Serial.write(OP_ARB | ((analogvalue >> 4) & 0x0F)); + // Highest order bits (9-8) + Serial.write(OP_ARB | ((analogvalue >> 8) & 0x0F)); + } + + } else if (rxOp == OP_CONFIGURE) { + switch (Serial.read() & MASK_CONFIG) { + case CONFIG_INPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT); + break; + case CONFIG_INPUT_PULLUP: + pinMode(rxByte & MASK_DIGITAL_ADDR, INPUT_PULLUP); + break; + case CONFIG_OUTPUT: + pinMode(rxByte & MASK_DIGITAL_ADDR, OUTPUT); + break; + } + } else if (rxOp == OP_ARB) { + + } else { + // Call Function Op: 111X + rxbuffer[rxbufferindex] = '\0'; + switch (rxByte & MASK_CALL) { + case 0x00: Serial.write(rxbuffer); break; + case 0x01: Serial.write(function01(rxbuffer)); break; + case 0x02: Serial.write(function02(rxbuffer)); break; + case 0x03: Serial.write(function03(rxbuffer)); break; + case 0x04: Serial.write(function04(rxbuffer)); break; + case 0x05: Serial.write(function05(rxbuffer)); break; + case 0x06: Serial.write(function06(rxbuffer)); break; + case 0x07: Serial.write(function07(rxbuffer)); break; + case 0x08: Serial.write(function08(rxbuffer)); break; + case 0x09: Serial.write(function09(rxbuffer)); break; + case 0x0A: Serial.write(function0A(rxbuffer)); break; + case 0x0B: Serial.write(function0B(rxbuffer)); break; + case 0x0C: Serial.write(function0C(rxbuffer)); break; + case 0x0D: Serial.write(function0D(rxbuffer)); break; + case 0x0E: Serial.write(function0E(rxbuffer)); break; + case 0x0F: Serial.write(function0F(rxbuffer)); break; + + case 0x10: Serial.write(function10(rxbuffer)); break; + case 0x11: Serial.write(function11(rxbuffer)); break; + case 0x12: Serial.write(function12(rxbuffer)); break; + case 0x13: Serial.write(function13(rxbuffer)); break; + case 0x14: Serial.write(function14(rxbuffer)); break; + case 0x15: Serial.write(function15(rxbuffer)); break; + case 0x16: Serial.write(function16(rxbuffer)); break; + case 0x17: Serial.write(function17(rxbuffer)); break; + case 0x18: Serial.write(function18(rxbuffer)); break; + case 0x19: Serial.write(function19(rxbuffer)); break; + case 0x1A: Serial.write(function1A(rxbuffer)); break; + case 0x1B: Serial.write(function1B(rxbuffer)); break; + case 0x1C: Serial.write(function1C(rxbuffer)); break; + case 0x1D: Serial.write(function1D(rxbuffer)); break; + case 0x1E: Serial.write(function1E(rxbuffer)); break; + } + Serial.write(rxByte); + Serial.flush(); + rxbufferindex = 0; + } + } else { + // Received ASCII text, insert into rxbuffer + rxbuffer[rxbufferindex] = char(rxByte); + rxbufferindex++; + } + } +} + diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex index 1ffb4a5..c476b68 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C9409030C94A9000C94D7020C94B102EF +:100040000C940C030C94A9000C94DA020C94B402E6 :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9003F051B053F053F0512 -:100070003F053F053F053F053F053F053F053F0560 -:100080003F053F053F053F053F053F053F053F0550 -:100090003F053F053F053F053F053F053F053F0540 -:1000A0003F053F053F0500000000240027002A000F +:100060000C94A9000C94A9005405300554055405BE +:1000700054055405540554055405540554055405B8 +:1000800054055405540554055405540554055405A8 +:100090005405540554055405540554055405540598 +:1000A00054055405540500000000240027002A00D0 :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:100100006E0511241FBECFEFD8E0DEBFCDBF11E0DA -:10011000A0E0B1E0E4E9FBE002C005900D92AA3353 +:10010000830511241FBECFEFD8E0DEBFCDBF11E0C5 +:10011000A0E0B1E0EEEBFBE002C005900D92AA3347 :10012000B107D9F725E0AAE3B1E001C01D92A63ED0 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E94BD05C038D107C9F70E9453030C9423 -:10015000C8050C940000CF92DF92EF92FF920F93AC +:100140000E94D205C038D107C9F70E9456030C940B +:10015000DD050C940000CF92DF92EF92FF920F9397 :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -75,117 +75,119 @@ :1004A0000196A11DB11D3FBFBA2FA92F982F8827F4 :1004B000820F911DA11DB11DBC01CD0142E0660F4F :1004C000771F881F991F4A95D1F708958F929F92A1 -:1004D000AF92BF92CF92DF92EF92FF920E944102C1 -:1004E0004B015C0182E3C82ED12CE12CF12C0E943F -:1004F0004102DC01CB0188199909AA09BB09883E90 -:100500009340A105B10558F021E0C21AD108E108D5 -:10051000F10888EE880E83E0981EA11CB11CC1145E -:10052000D104E104F10419F7FF90EF90DF90CF9030 -:10053000BF90AF909F908F900895009769F0FC0155 -:1005400001900020E9F73197AF01481B590BBC011E -:1005500089E495E00C94AB0080E090E008950E945F -:10056000C3051F920F920FB60F9211242F933F9342 -:100570004F935F936F937F938F939F93AF93BF93AB -:10058000EF93FF9389E495E00E940E01FF91EF91B4 -:10059000BF91AF919F918F917F916F915F914F919B -:1005A0003F912F910F900FBE0F901F9018951F92A3 -:1005B0000F920FB60F9211242F938F939F93EF9367 -:1005C000FF93E0915905F0915A058081E0915F0514 -:1005D000F091600582FD12C09081809162058F5F6D -:1005E0008F7320916305821751F0E0916205F0E06E -:1005F000E75BFA4F958F8093620501C08081FF9180 -:10060000EF919F918F912F910F900FBE0F901F90A0 -:1006100018951F920F920FB60F9211242F933F93AC -:100620008F939F93AF93BF9380913F01909140012F -:10063000A0914101B091420130913A0123E0230F92 -:100640002D3720F40196A11DB11D05C026E8230F0A -:100650000296A11DB11D20933A0180933F01909312 -:100660004001A0934101B093420180913B019091E0 -:100670003C01A0913D01B0913E010196A11DB11D2B -:1006800080933B0190933C01A0933D01B0933E01C8 -:10069000BF91AF919F918F913F912F910F900FBE7E -:1006A0000F901F901895CF93DF93CDB7DEB7A1972A -:1006B0000FB6F894DEBF0FBECDBF789484B58260CC -:1006C00084BD84B5816084BD85B5826085BD85B5F6 -:1006D000816085BD80916E00816080936E00109274 -:1006E00081008091810082608093810080918100EF -:1006F0008160809381008091800081608093800080 -:100700008091B10084608093B1008091B0008160DD -:100710008093B00080917A00846080937A00809109 -:100720007A00826080937A0080917A008160809361 -:100730007A0080917A00806880937A001092C100DC -:10074000E0915905F0915A0582E08083E0915505CA -:10075000F09156051082E0915705F091580580E11F -:10076000808310926105E0915D05F0915E0586E061 -:100770008083E0915B05F0915C05808180618083DE -:10078000E0915B05F0915C05808188608083E09159 -:100790005B05F0915C05808180688083E0915B055A -:1007A000F0915C0580818F7D80838CE191E00E94D7 -:1007B0009D0281E391E00E949D0287E391E00E9407 -:1007C0009D0280EE90E00E947B0189E495E00E940A -:1007D00080017AE0C72ED12CE12CF12C89E495E040 -:1007E0000E94F800892B09F46AC189E495E00E940F -:1007F000D600182F082E000C990B90934805809373 -:10080000470587FF4FC19C01207F33273093460562 -:10081000209345052039310511F51F70412F50E017 -:10082000FA01E451FF4F8491FA01E852FF4FB4906E -:10083000FA01EC53FF4F0491002309F443C18111E5 -:100840000E94AC01E02FF0E0EE0FFF1FE654FF4FD7 -:10085000A591B491EC91EB2109F434C138C1203A4F -:10086000310511F460E004C0203B310541F461E042 -:10087000812F8F700E94D5010E94660220C1203C0A -:10088000310509F0A5C0012F077013FF72C0A02E1B -:10089000000FBB0889E495E00E94F8000297D4F3AA -:1008A00089E495E00E94D600182F1F7089E495E036 -:1008B0000E94D60044E0880F991F4A95E1F7182B53 -:1008C000F501EE0FFF1FE05FFE4FA080B18061E0F9 -:1008D0008A2D0E940502112309F446C0F501FF2765 -:1008E000E451FF4FE491E33011F148F4E130D1F0ED -:1008F000E230D1F584B5806284BD18BDE0C0E73038 -:1009000019F1E83049F1E43079F580918000806296 -:1009100080938000812F110F990B90938B0080930F -:100920008A00CDC084B5806884BD17BDC8C08091E1 -:100930008000806880938000812F110F990B909325 -:10094000890080938800BBC08091B000806880934C -:10095000B0001093B300B3C08091B0008062809368 -:10096000B0001093B400ABC060E08A2D0E94D501A6 -:10097000A6C00E947601006400937C0080917A00FA -:10098000806480937A0080917A0086FDFCCF00918C -:1009900078008091790010E0182BC8018F7099279A -:1009A000806D0E947B01C80124E0959587952A956A -:1009B000E1F78F709927806D0E947B01812F992725 -:1009C00087FD9A958F709927806D0E947B0177C073 -:1009D00020383105C9F489E495E00E94D6008F7073 -:1009E00099278130910541F08230910539F0892BAA -:1009F00009F065C060E003C062E001C061E0812FE2 -:100A00008F700E9405025BC0203D310509F457C07C -:100A1000E0914305F0914405ED5BFE4F1082E12F1C -:100A2000EF710E2E000CFF0BEF31F10560F5EC5C61 -:100A3000FF4F0C94BD058FB7F89420913F01309182 -:100A4000400140914101509142018FBF19A28E0196 -:100A50000F5D1F4FCA01B901A70196010E949B05B6 -:100A6000605DF80162938F01211531054105510543 -:100A700089F7CF010E949D0289E391E002C083E4DF -:100A800091E00E949D0280914705909148050E9447 -:100A9000760189E495E00E9480011092440510924D -:100AA00043050DC08091430590914405FC01ED5B29 -:100AB000FE4F1083019690934405809343050E9456 -:100AC000A2018CCE812F110F990B806A04C0812F57 -:100AD000110F990B806B0E947601F1CFE9E4F5E0EC -:100AE0001382128288EE93E0A0E0B0E084839583C5 -:100AF000A683B78384E091E09183808385EC90E0C6 -:100B00009587848784EC90E09787868780EC90E0D7 -:100B1000918B808B81EC90E0938B828B82EC90E0C8 -:100B2000958B848B86EC90E0978B868B118E128E42 -:100B3000138E148E0895A1E21A2EAA1BBB1BFD0171 -:100B40000DC0AA1FBB1FEE1FFF1FA217B307E407AC -:100B5000F50720F0A21BB30BE40BF50B661F771F04 -:100B6000881F991F1A9469F76095709580959095E4 -:100B70009B01AC01BD01CF010895EE0FFF1F059051 -:100B8000F491E02D099481E090E0F8940C94C8056C -:040B9000F894FFCF07 -:100B9400000000002F01AB00F800D600EA0080013D -:100BA40003000500060009000A000B00496D70658A -:100BB400656475696E6F2056657273696F6E3A204D -:0A0BC40000302E302E33000D0A0021 +:1004D000AF92BF92CF92DF92EF92FF926B017C01BD +:1004E0000E9441024B015C01C114D104E104F104FA +:1004F000F1F00E944102DC01CB0188199909AA0997 +:10050000BB09883E9340A105B10570F321E0C21AF2 +:10051000D108E108F10888EE880E83E0981EA11C3E +:10052000B11CC114D104E104F10419F7DDCFFF902F +:10053000EF90DF90CF90BF90AF909F908F900895F5 +:10054000009769F0FC0101900020E9F73197AF01B5 +:10055000481B590BBC0189E495E00C94AB0080E08A +:1005600090E008950E94D8051F920F920FB60F9247 +:1005700011242F933F934F935F936F937F938F93A8 +:100580009F93AF93BF93EF93FF9389E495E00E940D +:100590000E01FF91EF91BF91AF919F918F917F914C +:1005A0006F915F914F913F912F910F900FBE0F90E0 +:1005B0001F9018951F920F920FB60F9211242F9330 +:1005C0008F939F93EF93FF93E0915905F0915A0514 +:1005D0008081E0915F05F091600582FD12C09081FD +:1005E000809162058F5F8F7320916305821751F0B0 +:1005F000E0916205F0E0E75BFA4F958F809362052A +:1006000001C08081FF91EF919F918F912F910F9069 +:100610000FBE0F901F9018951F920F920FB60F925A +:1006200011242F933F938F939F93AF93BF93809108 +:100630003F0190914001A0914101B0914201309160 +:100640003A0123E0230F2D3720F40196A11DB11D9F +:1006500005C026E8230F0296A11DB11D20933A0183 +:1006600080933F0190934001A0934101B0934201D8 +:1006700080913B0190913C01A0913D01B0913E01E0 +:100680000196A11DB11D80933B0190933C01A09365 +:100690003D01B0933E01BF91AF919F918F913F91EA +:1006A0002F910F900FBE0F901F901895CF93DF934F +:1006B000CDB7DEB7A1970FB6F894DEBF0FBECDBFA2 +:1006C000789484B5826084BD84B5816084BD85B52D +:1006D000826085BD85B5816085BD80916E00816039 +:1006E00080936E00109281008091810082608093DF +:1006F00081008091810081608093810080918000E1 +:100700008160809380008091B10084608093B1000B +:100710008091B00081608093B00080917A00846005 +:1007200080937A0080917A00826080937A00809131 +:100730007A00816080937A0080917A00806880934B +:100740007A001092C100E0915905F0915A0582E0BB +:100750008083E0915505F09156051082E091570590 +:10076000F091580580E1808310926105E0915D056C +:10077000F0915E0586E08083E0915B05F0915C0579 +:10078000808180618083E0915B05F0915C058081D0 +:1007900088608083E0915B05F0915C0580818068D2 +:1007A0008083E0915B05F0915C0580818F7D808383 +:1007B0008CE191E00E94A00281E391E00E94A002FE +:1007C00087E391E00E94A00280EE90E00E947B010E +:1007D00089E495E00E94800161E087E00E94D501F4 +:1007E00064EF71E080E090E00E94660260E087E0E4 +:1007F0000E94D5017AE0C72ED12CE12CF12C89E49E +:1008000095E00E94F800892B09F46EC189E495E017 +:100810000E94D600182F082E000C990B90934805C3 +:100820008093470587FF53C19C01207F3327309376 +:100830004605209345052039310511F51F70412FDC +:1008400050E0FA01E451FF4F8491FA01E852FF4F62 +:10085000B490FA01EC53FF4F0491002309F447C10F +:1008600081110E94AC01E02FF0E0EE0FFF1FE65473 +:10087000FF4FA591B491EC91EB2109F438C13CC133 +:10088000203A310511F460E004C0203B310561F4E9 +:1008900061E0812F8F700E94D50162E370E080E0FB +:1008A00090E00E94660220C1203C310509F0A5C0FD +:1008B000012F077013FF72C0A02E000FBB0889E440 +:1008C00095E00E94F8000297D4F389E495E00E9435 +:1008D000D600182F1F7089E495E00E94D60044E0EE +:1008E000880F991F4A95E1F7182BF501EE0FFF1FAE +:1008F000E05FFE4FA080B18061E08A2D0E9405027A +:10090000112309F446C0F501FF27E451FF4FE4919C +:10091000E33011F148F4E130D1F0E230D1F584B5A3 +:10092000806284BD18BDE0C0E73019F1E83049F1BC +:10093000E43079F580918000806280938000812F7F +:10094000110F990B90938B0080938A00CDC084B5D2 +:10095000806884BD17BDC8C0809180008068809386 +:100960008000812F110F990B90938900809388004C +:10097000BBC08091B00080688093B0001093B3003A +:10098000B3C08091B00080628093B0001093B40037 +:10099000ABC060E08A2D0E94D501A6C00E947601FE +:1009A000006400937C0080917A00806480937A00D8 +:1009B00080917A0086FDFCCF0091780080917900CB +:1009C00010E0182BC8018F709927806D0E947B0161 +:1009D000C80124E0959587952A95E1F78F709927AE +:1009E000806D0E947B01812F992787FD9A958F70DA +:1009F0009927806D0E947B0177C020383105C9F4AA +:100A000089E495E00E94D6008F7099278130910586 +:100A100041F08230910539F0892B09F065C060E022 +:100A200003C062E001C061E0812F8F700E94050267 +:100A30005BC0203D310509F457C0E0914305F091BA +:100A40004405ED5BFE4F1082E12FEF710E2E000C7E +:100A5000FF0BEF31F10560F5EC5CFF4F0C94D20514 +:100A60008FB7F89420913F013091400140914101AE +:100A7000509142018FBF19A28E010F5D1F4FCA0115 +:100A8000B901A70196010E94B005605DF80162936B +:100A90008F01211531054105510589F7CF010E94CC +:100AA000A00289E391E002C083E491E00E94A002E9 +:100AB00080914705909148050E94760189E495E070 +:100AC0000E94800110924405109243050DC0809150 +:100AD000430590914405FC01ED5BFE4F10830196A8 +:100AE00090934405809343050E94A20188CE812FF4 +:100AF000110F990B806A04C0812F110F990B806B25 +:100B00000E947601F1CFE9E4F5E01382128288EECB +:100B100093E0A0E0B0E084839583A683B78384E06C +:100B200091E09183808385EC90E09587848784ECC5 +:100B300090E09787868780EC90E0918B808B81ECAA +:100B400090E0938B828B82EC90E0958B848B86EC8B +:100B500090E0978B868B118E128E138E148E0895D3 +:100B6000A1E21A2EAA1BBB1BFD010DC0AA1FBB1FB1 +:100B7000EE1FFF1FA217B307E407F50720F0A21B23 +:100B8000B30BE40BF50B661F771F881F991F1A9490 +:100B900069F760957095809590959B01AC01BD01BA +:100BA000CF010895EE0FFF1F0590F491E02D0994F9 +:0E0BB00081E090E0F8940C94DD05F894FFCFFE +:100BBE00000000002F01AB00F800D600EA00800113 +:100BCE0003000500060009000A000B00496D706560 +:100BDE00656475696E6F2056657273696F6E3A2023 +:0A0BEE0000312E302E30000D0A00F9 :00000001FF diff --git a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex index aa07d65..60059bf 100644 --- a/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex +++ b/hardware/impeeduino/arduino/impeeduino/impeeduino.ino.with_bootloader.standard.hex @@ -2,24 +2,24 @@ :100010000C94A9000C94A9000C94A9000C94A900BC :100020000C94A9000C94A9000C94A9000C94A900AC :100030000C94A9000C94A9000C94A9000C94A9009C -:100040000C9409030C94A9000C94D7020C94B102EF +:100040000C940C030C94A9000C94DA020C94B402E6 :100050000C94A9000C94A9000C94A9000C94A9007C -:100060000C94A9000C94A9003F051B053F053F0512 -:100070003F053F053F053F053F053F053F053F0560 -:100080003F053F053F053F053F053F053F053F0550 -:100090003F053F053F053F053F053F053F053F0540 -:1000A0003F053F053F0500000000240027002A000F +:100060000C94A9000C94A9005405300554055405BE +:1000700054055405540554055405540554055405B8 +:1000800054055405540554055405540554055405A8 +:100090005405540554055405540554055405540598 +:1000A00054055405540500000000240027002A00D0 :1000B00000000000250028002B00000000002300A5 :1000C00026002900040404040404040402020202B9 :1000D000020203030303030301020408102040800B :1000E000010204081020010204081020000000088A :1000F00000020100000304070000000000000000EF -:100100006E0511241FBECFEFD8E0DEBFCDBF11E0DA -:10011000A0E0B1E0E4E9FBE002C005900D92AA3353 +:10010000830511241FBECFEFD8E0DEBFCDBF11E0C5 +:10011000A0E0B1E0EEEBFBE002C005900D92AA3347 :10012000B107D9F725E0AAE3B1E001C01D92A63ED0 :10013000B207E1F710E0C1E8D0E004C02197FE016A -:100140000E94BD05C038D107C9F70E9453030C9423 -:10015000C8050C940000CF92DF92EF92FF920F93AC +:100140000E94D205C038D107C9F70E9456030C940B +:10015000DD050C940000CF92DF92EF92FF920F9397 :100160001F93CF93DF936C017A018B01C0E0D0E045 :10017000CE15DF0589F0D8016D918D01D601ED9185 :10018000FC910190F081E02DC6010995892B11F4B5 @@ -75,119 +75,121 @@ :1004A0000196A11DB11D3FBFBA2FA92F982F8827F4 :1004B000820F911DA11DB11DBC01CD0142E0660F4F :1004C000771F881F991F4A95D1F708958F929F92A1 -:1004D000AF92BF92CF92DF92EF92FF920E944102C1 -:1004E0004B015C0182E3C82ED12CE12CF12C0E943F -:1004F0004102DC01CB0188199909AA09BB09883E90 -:100500009340A105B10558F021E0C21AD108E108D5 -:10051000F10888EE880E83E0981EA11CB11CC1145E -:10052000D104E104F10419F7FF90EF90DF90CF9030 -:10053000BF90AF909F908F900895009769F0FC0155 -:1005400001900020E9F73197AF01481B590BBC011E -:1005500089E495E00C94AB0080E090E008950E945F -:10056000C3051F920F920FB60F9211242F933F9342 -:100570004F935F936F937F938F939F93AF93BF93AB -:10058000EF93FF9389E495E00E940E01FF91EF91B4 -:10059000BF91AF919F918F917F916F915F914F919B -:1005A0003F912F910F900FBE0F901F9018951F92A3 -:1005B0000F920FB60F9211242F938F939F93EF9367 -:1005C000FF93E0915905F0915A058081E0915F0514 -:1005D000F091600582FD12C09081809162058F5F6D -:1005E0008F7320916305821751F0E0916205F0E06E -:1005F000E75BFA4F958F8093620501C08081FF9180 -:10060000EF919F918F912F910F900FBE0F901F90A0 -:1006100018951F920F920FB60F9211242F933F93AC -:100620008F939F93AF93BF9380913F01909140012F -:10063000A0914101B091420130913A0123E0230F92 -:100640002D3720F40196A11DB11D05C026E8230F0A -:100650000296A11DB11D20933A0180933F01909312 -:100660004001A0934101B093420180913B019091E0 -:100670003C01A0913D01B0913E010196A11DB11D2B -:1006800080933B0190933C01A0933D01B0933E01C8 -:10069000BF91AF919F918F913F912F910F900FBE7E -:1006A0000F901F901895CF93DF93CDB7DEB7A1972A -:1006B0000FB6F894DEBF0FBECDBF789484B58260CC -:1006C00084BD84B5816084BD85B5826085BD85B5F6 -:1006D000816085BD80916E00816080936E00109274 -:1006E00081008091810082608093810080918100EF -:1006F0008160809381008091800081608093800080 -:100700008091B10084608093B1008091B0008160DD -:100710008093B00080917A00846080937A00809109 -:100720007A00826080937A0080917A008160809361 -:100730007A0080917A00806880937A001092C100DC -:10074000E0915905F0915A0582E08083E0915505CA -:10075000F09156051082E0915705F091580580E11F -:10076000808310926105E0915D05F0915E0586E061 -:100770008083E0915B05F0915C05808180618083DE -:10078000E0915B05F0915C05808188608083E09159 -:100790005B05F0915C05808180688083E0915B055A -:1007A000F0915C0580818F7D80838CE191E00E94D7 -:1007B0009D0281E391E00E949D0287E391E00E9407 -:1007C0009D0280EE90E00E947B0189E495E00E940A -:1007D00080017AE0C72ED12CE12CF12C89E495E040 -:1007E0000E94F800892B09F46AC189E495E00E940F -:1007F000D600182F082E000C990B90934805809373 -:10080000470587FF4FC19C01207F33273093460562 -:10081000209345052039310511F51F70412F50E017 -:10082000FA01E451FF4F8491FA01E852FF4FB4906E -:10083000FA01EC53FF4F0491002309F443C18111E5 -:100840000E94AC01E02FF0E0EE0FFF1FE654FF4FD7 -:10085000A591B491EC91EB2109F434C138C1203A4F -:10086000310511F460E004C0203B310541F461E042 -:10087000812F8F700E94D5010E94660220C1203C0A -:10088000310509F0A5C0012F077013FF72C0A02E1B -:10089000000FBB0889E495E00E94F8000297D4F3AA -:1008A00089E495E00E94D600182F1F7089E495E036 -:1008B0000E94D60044E0880F991F4A95E1F7182B53 -:1008C000F501EE0FFF1FE05FFE4FA080B18061E0F9 -:1008D0008A2D0E940502112309F446C0F501FF2765 -:1008E000E451FF4FE491E33011F148F4E130D1F0ED -:1008F000E230D1F584B5806284BD18BDE0C0E73038 -:1009000019F1E83049F1E43079F580918000806296 -:1009100080938000812F110F990B90938B0080930F -:100920008A00CDC084B5806884BD17BDC8C08091E1 -:100930008000806880938000812F110F990B909325 -:10094000890080938800BBC08091B000806880934C -:10095000B0001093B300B3C08091B0008062809368 -:10096000B0001093B400ABC060E08A2D0E94D501A6 -:10097000A6C00E947601006400937C0080917A00FA -:10098000806480937A0080917A0086FDFCCF00918C -:1009900078008091790010E0182BC8018F7099279A -:1009A000806D0E947B01C80124E0959587952A956A -:1009B000E1F78F709927806D0E947B01812F992725 -:1009C00087FD9A958F709927806D0E947B0177C073 -:1009D00020383105C9F489E495E00E94D6008F7073 -:1009E00099278130910541F08230910539F0892BAA -:1009F00009F065C060E003C062E001C061E0812FE2 -:100A00008F700E9405025BC0203D310509F457C07C -:100A1000E0914305F0914405ED5BFE4F1082E12F1C -:100A2000EF710E2E000CFF0BEF31F10560F5EC5C61 -:100A3000FF4F0C94BD058FB7F89420913F01309182 -:100A4000400140914101509142018FBF19A28E0196 -:100A50000F5D1F4FCA01B901A70196010E949B05B6 -:100A6000605DF80162938F01211531054105510543 -:100A700089F7CF010E949D0289E391E002C083E4DF -:100A800091E00E949D0280914705909148050E9447 -:100A9000760189E495E00E9480011092440510924D -:100AA00043050DC08091430590914405FC01ED5B29 -:100AB000FE4F1083019690934405809343050E9456 -:100AC000A2018CCE812F110F990B806A04C0812F57 -:100AD000110F990B806B0E947601F1CFE9E4F5E0EC -:100AE0001382128288EE93E0A0E0B0E084839583C5 -:100AF000A683B78384E091E09183808385EC90E0C6 -:100B00009587848784EC90E09787868780EC90E0D7 -:100B1000918B808B81EC90E0938B828B82EC90E0C8 -:100B2000958B848B86EC90E0978B868B118E128E42 -:100B3000138E148E0895A1E21A2EAA1BBB1BFD0171 -:100B40000DC0AA1FBB1FEE1FFF1FA217B307E407AC -:100B5000F50720F0A21BB30BE40BF50B661F771F04 -:100B6000881F991F1A9469F76095709580959095E4 -:100B70009B01AC01BD01CF010895EE0FFF1F059051 -:100B8000F491E02D099481E090E0F8940C94C8056C -:040B9000F894FFCF07 -:100B9400000000002F01AB00F800D600EA0080013D -:100BA40003000500060009000A000B00496D70658A -:100BB400656475696E6F2056657273696F6E3A204D -:0A0BC40000302E302E33000D0A0021 +:1004D000AF92BF92CF92DF92EF92FF926B017C01BD +:1004E0000E9441024B015C01C114D104E104F104FA +:1004F000F1F00E944102DC01CB0188199909AA0997 +:10050000BB09883E9340A105B10570F321E0C21AF2 +:10051000D108E108F10888EE880E83E0981EA11C3E +:10052000B11CC114D104E104F10419F7DDCFFF902F +:10053000EF90DF90CF90BF90AF909F908F900895F5 +:10054000009769F0FC0101900020E9F73197AF01B5 +:10055000481B590BBC0189E495E00C94AB0080E08A +:1005600090E008950E94D8051F920F920FB60F9247 +:1005700011242F933F934F935F936F937F938F93A8 +:100580009F93AF93BF93EF93FF9389E495E00E940D +:100590000E01FF91EF91BF91AF919F918F917F914C +:1005A0006F915F914F913F912F910F900FBE0F90E0 +:1005B0001F9018951F920F920FB60F9211242F9330 +:1005C0008F939F93EF93FF93E0915905F0915A0514 +:1005D0008081E0915F05F091600582FD12C09081FD +:1005E000809162058F5F8F7320916305821751F0B0 +:1005F000E0916205F0E0E75BFA4F958F809362052A +:1006000001C08081FF91EF919F918F912F910F9069 +:100610000FBE0F901F9018951F920F920FB60F925A +:1006200011242F933F938F939F93AF93BF93809108 +:100630003F0190914001A0914101B0914201309160 +:100640003A0123E0230F2D3720F40196A11DB11D9F +:1006500005C026E8230F0296A11DB11D20933A0183 +:1006600080933F0190934001A0934101B0934201D8 +:1006700080913B0190913C01A0913D01B0913E01E0 +:100680000196A11DB11D80933B0190933C01A09365 +:100690003D01B0933E01BF91AF919F918F913F91EA +:1006A0002F910F900FBE0F901F901895CF93DF934F +:1006B000CDB7DEB7A1970FB6F894DEBF0FBECDBFA2 +:1006C000789484B5826084BD84B5816084BD85B52D +:1006D000826085BD85B5816085BD80916E00816039 +:1006E00080936E00109281008091810082608093DF +:1006F00081008091810081608093810080918000E1 +:100700008160809380008091B10084608093B1000B +:100710008091B00081608093B00080917A00846005 +:1007200080937A0080917A00826080937A00809131 +:100730007A00816080937A0080917A00806880934B +:100740007A001092C100E0915905F0915A0582E0BB +:100750008083E0915505F09156051082E091570590 +:10076000F091580580E1808310926105E0915D056C +:10077000F0915E0586E08083E0915B05F0915C0579 +:10078000808180618083E0915B05F0915C058081D0 +:1007900088608083E0915B05F0915C0580818068D2 +:1007A0008083E0915B05F0915C0580818F7D808383 +:1007B0008CE191E00E94A00281E391E00E94A002FE +:1007C00087E391E00E94A00280EE90E00E947B010E +:1007D00089E495E00E94800161E087E00E94D501F4 +:1007E00064EF71E080E090E00E94660260E087E0E4 +:1007F0000E94D5017AE0C72ED12CE12CF12C89E49E +:1008000095E00E94F800892B09F46EC189E495E017 +:100810000E94D600182F082E000C990B90934805C3 +:100820008093470587FF53C19C01207F3327309376 +:100830004605209345052039310511F51F70412FDC +:1008400050E0FA01E451FF4F8491FA01E852FF4F62 +:10085000B490FA01EC53FF4F0491002309F447C10F +:1008600081110E94AC01E02FF0E0EE0FFF1FE65473 +:10087000FF4FA591B491EC91EB2109F438C13CC133 +:10088000203A310511F460E004C0203B310561F4E9 +:1008900061E0812F8F700E94D50162E370E080E0FB +:1008A00090E00E94660220C1203C310509F0A5C0FD +:1008B000012F077013FF72C0A02E000FBB0889E440 +:1008C00095E00E94F8000297D4F389E495E00E9435 +:1008D000D600182F1F7089E495E00E94D60044E0EE +:1008E000880F991F4A95E1F7182BF501EE0FFF1FAE +:1008F000E05FFE4FA080B18061E08A2D0E9405027A +:10090000112309F446C0F501FF27E451FF4FE4919C +:10091000E33011F148F4E130D1F0E230D1F584B5A3 +:10092000806284BD18BDE0C0E73019F1E83049F1BC +:10093000E43079F580918000806280938000812F7F +:10094000110F990B90938B0080938A00CDC084B5D2 +:10095000806884BD17BDC8C0809180008068809386 +:100960008000812F110F990B90938900809388004C +:10097000BBC08091B00080688093B0001093B3003A +:10098000B3C08091B00080628093B0001093B40037 +:10099000ABC060E08A2D0E94D501A6C00E947601FE +:1009A000006400937C0080917A00806480937A00D8 +:1009B00080917A0086FDFCCF0091780080917900CB +:1009C00010E0182BC8018F709927806D0E947B0161 +:1009D000C80124E0959587952A95E1F78F709927AE +:1009E000806D0E947B01812F992787FD9A958F70DA +:1009F0009927806D0E947B0177C020383105C9F4AA +:100A000089E495E00E94D6008F7099278130910586 +:100A100041F08230910539F0892B09F065C060E022 +:100A200003C062E001C061E0812F8F700E94050267 +:100A30005BC0203D310509F457C0E0914305F091BA +:100A40004405ED5BFE4F1082E12FEF710E2E000C7E +:100A5000FF0BEF31F10560F5EC5CFF4F0C94D20514 +:100A60008FB7F89420913F013091400140914101AE +:100A7000509142018FBF19A28E010F5D1F4FCA0115 +:100A8000B901A70196010E94B005605DF80162936B +:100A90008F01211531054105510589F7CF010E94CC +:100AA000A00289E391E002C083E491E00E94A002E9 +:100AB00080914705909148050E94760189E495E070 +:100AC0000E94800110924405109243050DC0809150 +:100AD000430590914405FC01ED5BFE4F10830196A8 +:100AE00090934405809343050E94A20188CE812FF4 +:100AF000110F990B806A04C0812F110F990B806B25 +:100B00000E947601F1CFE9E4F5E01382128288EECB +:100B100093E0A0E0B0E084839583A683B78384E06C +:100B200091E09183808385EC90E09587848784ECC5 +:100B300090E09787868780EC90E0918B808B81ECAA +:100B400090E0938B828B82EC90E0958B848B86EC8B +:100B500090E0978B868B118E128E138E148E0895D3 +:100B6000A1E21A2EAA1BBB1BFD010DC0AA1FBB1FB1 +:100B7000EE1FFF1FA217B307E407F50720F0A21B23 +:100B8000B30BE40BF50B661F771F881F991F1A9490 +:100B900069F760957095809590959B01AC01BD01BA +:100BA000CF010895EE0FFF1F0590F491E02D0994F9 +:0E0BB00081E090E0F8940C94DD05F894FFCFFE +:100BBE00000000002F01AB00F800D600EA00800113 +:100BCE0003000500060009000A000B00496D706560 +:100BDE00656475696E6F2056657273696F6E3A2023 +:0A0BEE0000312E302E30000D0A00F9 :107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 :107E2000C20080E18093C4008EE0C9D0259A86E02C