diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bbd515..00d6deb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(battletank) cmake_minimum_required(VERSION 2.6) -set(REMOTE_PORT "/dev/ttyUSB0") -set(DOZER_PORT "/dev/ttyUSB1") +set(REMOTE_PORT "/dev/ttyUSB1") +set(DOZER_PORT "/dev/ttyUSB0") set(MCU "atmega328p" ) set(CPU_SPEED "16000000" ) @@ -49,8 +49,8 @@ set(CMAKE_LINKER avr-ld) # Compiler flags add_definitions(-DBAUD=9600UL -DARDUINO -DROLE=1) -add_definitions(-mmcu=${MCU} -DF_CPU=${CPU_SPEED}) -add_definitions(-c -g -Os -Wall) +add_definitions(-mmcu=${MCU} -DF_CPU=${CPU_SPEED}) #-DARDUINO_AVR_NANO) +add_definitions(-c -g -Os -Wall --std=c++11) add_definitions(-fpack-struct -fno-exceptions -ffunction-sections -fdata-sections -funsigned-char -funsigned-bitfields -fshort-enums) # Linker flags diff --git a/arduino/hardware/arduino/avr/boards.txt b/arduino/hardware/arduino/avr/boards.txt index e2f3707..1344fbb 100644 --- a/arduino/hardware/arduino/avr/boards.txt +++ b/arduino/hardware/arduino/avr/boards.txt @@ -46,7 +46,7 @@ yun.build.extra_flags={build.usb_flags} ############################################################## -uno.name=Arduino/Genuino Uno +uno.name=Arduino Uno uno.vid.0=0x2341 uno.pid.0=0x0043 @@ -185,7 +185,7 @@ nano.menu.cpu.atmega168.build.mcu=atmega168 ############################################################## -mega.name=Arduino/Genuino Mega or Mega 2560 +mega.name=Arduino Mega or Mega 2560 mega.vid.0=0x2341 mega.pid.0=0x0010 @@ -214,7 +214,7 @@ mega.build.variant=mega # default board may be overridden by the cpu menu mega.build.board=AVR_MEGA2560 -## Arduino/Genuino Mega w/ ATmega2560 +## Arduino Mega w/ ATmega2560 ## ------------------------- mega.menu.cpu.atmega2560=ATmega2560 (Mega 2560) @@ -353,7 +353,7 @@ leonardoeth.build.extra_flags={build.usb_flags} ############################################################## -micro.name=Arduino/Genuino Micro +micro.name=Arduino Micro micro.vid.0=0x2341 micro.pid.0=0x0037 @@ -363,24 +363,10 @@ micro.vid.2=0x2A03 micro.pid.2=0x0037 micro.vid.3=0x2A03 micro.pid.3=0x8037 - micro.vid.4=0x2341 micro.pid.4=0x0237 -# If the board is a 2341:0237 use 2341:8237 for build and set -# other parameters as well -micro.vid.4.build.vid=0x2341 -micro.vid.4.build.pid=0x8237 -micro.vid.4.build.usb_product="Genuino Micro" -micro.vid.4.bootloader.file=caterina/Caterina-Genuino-Micro.hex - micro.vid.5=0x2341 micro.pid.5=0x8237 -# If the board is a 2341:8237 use 2341:8237 for build and set -# other paramters as well -micro.vid.5.build.vid=0x2341 -micro.vid.5.build.pid=0x8237 -micro.vid.5.build.usb_product="Genuino Micro" -micro.vid.5.bootloader.file=caterina/Caterina-Genuino-Micro.hex micro.upload.tool=avrdude micro.upload.protocol=avr109 @@ -946,7 +932,7 @@ yunmini.bootloader.tool=avrdude yunmini.bootloader.low_fuses=0xff yunmini.bootloader.high_fuses=0xd8 yunmini.bootloader.extended_fuses=0xfb -yunmini.bootloader.file=caterina/Caterina-Yunmini.hex +yunmini.bootloader.file=caterina/Caterina-YunMini.hex yunmini.bootloader.unlock_bits=0x3F yunmini.bootloader.lock_bits=0x2F diff --git a/arduino/hardware/arduino/avr/bootloaders/caterina/Caterina-Genuino-Micro.hex b/arduino/hardware/arduino/avr/bootloaders/caterina/Caterina-Genuino-Micro.hex deleted file mode 100644 index b658b28..0000000 --- a/arduino/hardware/arduino/avr/bootloaders/caterina/Caterina-Genuino-Micro.hex +++ /dev/null @@ -1,257 +0,0 @@ -:1070000055C000006EC000006CC000006AC00000E7 -:1070100068C0000066C0000064C0000062C00000DC -:1070200060C000005EC00000F2C400005AC0000052 -:1070300058C0000056C0000054C0000052C00000FC -:1070400050C0000078C000004CC000004AC00000E2 -:1070500048C0000046C0000044C0000042C000001C -:1070600040C000003EC000003CC000003AC000002C -:1070700038C0000036C0000034C0000032C000003C -:1070800030C000002EC000002CC000002AC000004C -:1070900028C0000026C0000024C0000022C000005C -:1070A00020C000001EC000001CC0000011241FBE34 -:1070B000CFEFDAE0DEBFCDBF11E0A0E0B1E0E2E368 -:1070C000FFE702C005900D92A83AB107D9F711E089 -:1070D000A8EAB1E001C01D92AE3BB107E1F78FD342 -:1070E00026C78ECFF89410926F00109281001092F4 -:1070F00085001092840081E085BF15BE47985D9899 -:1071000028980C94000008952091B2013091B301A9 -:107110002F5F3F4F3093B3012093B201932F37FF7E -:1071200003C08EEF831B982F990F921710F4479886 -:107130000895479A08951F920F920FB60F92112447 -:107140002F938F939F93EF93FF931092850010924C -:1071500084008091A8019091A901009741F00197C6 -:107160009093A9018093A801892B09F45D988091DF -:10717000AA019091AB01009741F001979093AB0168 -:107180008093AA01892B09F42898E0E0F0E085912A -:1071900094918F5F9F4F49F08091AC019091AD0128 -:1071A00001969093AD018093AC01FF91EF919F9177 -:1071B0008F912F910F900FBE0F901F90189584E024 -:1071C0008093E9000DC08091E8008B778093E80000 -:1071D00003C08EB3882351F08091E80082FFF9CF7D -:1071E0008091E80085FFEFCF8091F1000895982FFE -:1071F00083E08093E9008091E80085FD0DC08091D7 -:10720000E8008E778093E80003C08EB3882369F08E -:107210008091E80080FFF9CF9093F1005D9A84E6B9 -:1072200090E09093A9018093A80108954F925F92F6 -:107230006F927F928F929F92AF92BF92CF92DF9286 -:10724000EF92FF920F931F93CF93DF9384E080938D -:10725000E9008091E80082FF57C2289A84E690E016 -:107260009093AB018093AA01AADF182F853481F493 -:107270008CE49DE19093AD018093AC0107B600FCD6 -:10728000FDCFF999FECF81E180935700E89503C0C7 -:10729000843519F494DF8DE00DC28C34E1F3803530 -:1072A000D1F3843721F484E4A2DF80E003C2813685 -:1072B00011F489E5FFC18134B1F481DF182F7FDF3C -:1072C00090E0880F991FAA2797FDA095BA2F312F1C -:1072D000330F20E0442737FD4095542F822B932B0A -:1072E000A42BB52BB8C1803711F483E5E3C18335F6 -:1072F00049F4C0E0D1E089917ADF21E0C730D207BC -:10730000D1F7D9C1863521F481E371DF80E3D2C1A1 -:10731000833731F487E86BDF85E969DF8EE1CAC125 -:107320008536B9F4E0E0F0E093E085E09093570013 -:10733000E89507B600FCFDCF80935700E89507B6A7 -:1073400000FCFDCFE058FF4FA0E7E030FA0771F7EF -:10735000A2CF823739F4E1E0F0E089E08093570072 -:107360008491A8C1863439F4E0E0F0E089E08093AC -:10737000570084919FC18E3439F4E3E0F0E089E056 -:1073800080935700849196C1813539F4E2E0F0E0B2 -:1073900089E08093570084918DC1823631F489E56C -:1073A00026DF80E024DF80E885C1823419F087364B -:1073B00009F0E5C01092AD011092AC0100DF082F7A -:1073C000FEDEF82EFCDE682E8554823008F071C196 -:1073D000902F80E0CF2DD0E0C82BD92B10926F00DA -:1073E000173609F04BC081E180935700E895DD2402 -:1073F000CC24C3943FC0E090AE01F090AF01009167 -:10740000B0011091B101B6E46B16D9F4ED2DF0E0A6 -:10741000EE29FF29E4918E2FEADEDD2081F082E063 -:1074200090E0A0E0B0E0E80EF91E0A1F1B1FE092FA -:10743000AE01F092AF010093B0011093B101DC24D2 -:1074400018C0D801C701B695A7959795879559D5C6 -:10745000CEDE82E090E0A0E0B0E0E80EF91E0A1F68 -:107460001B1FE092AE01F092AF010093B0011093A8 -:10747000B1012197209709F0BECF7DC08090AE0169 -:107480009090AF01A090B001B090B10196E4691660 -:1074900009F05DC083E0F40180935700E89507B6DA -:1074A00000FCFDCF54C0F6E46F1661F5772031F192 -:1074B000E090AE01F090AF010091B0011091B101E8 -:1074C0007EDED82ECC24852D90E08C299D29F701D5 -:1074D0000C0140925700E895112482E090E0A0E072 -:1074E000B0E0E80EF91E0A1F1B1FE092AE01F092F9 -:1074F000AF010093B0011093B10102C060DE582EBD -:10750000742423C0E090AE01F090AF010091B0016F -:107510001091B10116950795F794E79450DE682F06 -:10752000C701F7D48091AE019091AF01A091B00155 -:10753000B091B1010296A11DB11D8093AE0190934F -:10754000AF01A093B001B093B101219704C05524BD -:10755000772444244394209709F0A5CF96E4691634 -:1075600041F485E0F40180935700E89507B600FCEC -:10757000FDCF8DE03CDE82E080936F009CC08334C1 -:1075800071F40091AE011091AF0119DE90E021E09D -:10759000F8010C0120935700E89511247CCE833626 -:1075A00019F5E090AE01F090AF010091B00110919B -:1075B000B10105DEF701E16090E021E00C012093CC -:1075C0005700E895112482E090E0A0E0B0E0E80EDA -:1075D000F91E0A1F1B1FE092AE01F092AF0100934B -:1075E000B0011093B10157CE8D3661F4E091AE0138 -:1075F000F091AF0185E080935700E89507B600FC55 -:10760000FDCF49CE823551F4E091AE01F091AF014A -:1076100005911491812FEBDD802F4CC0843421F52E -:10762000E090AE01F090AF010091B0011091B10176 -:1076300016950795F794E794C2DD682FC70169D4C2 -:107640008091AE019091AF01A091B001B091B101D4 -:107650000296A11DB11D8093AE019093AF01A0933E -:10766000B001B093B10117CE843609F5E090AE01B8 -:10767000F090AF010091B0011091B101D801C701A4 -:10768000B695A795979587953CD4B1DD82E090E0BB -:10769000A0E0B0E0E80EF91E0A1F1B1FE092AE0149 -:1076A000F092AF010093B0011093B10104C08B318F -:1076B00011F08FE39CDD83E08093E9009091E80076 -:1076C0008091E8008E778093E80095FF04C010C099 -:1076D0008EB38823C9F08091E80080FFF9CF8091B4 -:1076E000E8008E778093E80003C08EB3882361F0B2 -:1076F0008091E80080FFF9CF84E08093E9008091D9 -:10770000E8008B778093E800DF91CF911F910F9174 -:10771000FF90EF90DF90CF90BF90AF909F908F90B1 -:107720007F906F905F904F9008959091B601892F50 -:107730008F77813249F58091B7018032A1F0813293 -:1077400019F5913A09F58091E800877F8093E80068 -:107750008DE091E067E070E00BD28091E8008B77DC -:107760008093E8000895913279F48091E800877F52 -:107770008093E8008DE091E067E070E05DD2809159 -:10778000E8008E778093E800089582E061EC42E0A3 -:10779000B5D083E061E842E1B1D084E060E842E145 -:1077A000ADC084B7877F84BF88E10FB6F89480931B -:1077B0006000109260000FBE20E880E090E00FB6FD -:1077C000F89420936100809361000FBE81E085BF33 -:1077D00092E095BF3F9A209A559AE1E6F0E0208327 -:1077E000108247985D982898109289008AEF8093BC -:1077F000880090936F0083E080938100F0C04091F7 -:10780000000850910108109201081092000894B7E6 -:1078100014BE88E10FB6F894809360001092600067 -:107820000FBE292F30E0F901E270F07091FD18C011 -:1078300090FF05C0859194918F5F9F4F81F423FF46 -:107840000FC08091090190910A014817590741F032 -:10785000E0E0F0E0859194918F5F9F4F09F042DC6A -:10786000A0DF78941092AD011092AC010CC0DEDC68 -:1078700036D38091AC019091AD0181549F4110F0BD -:107880001092140141DC80911401882381F78091CA -:10789000E00081608093E00025DC80E090E00895C6 -:1078A000FA01923049F0933061F09130F9F485E1BA -:1078B00091E022E130E01EC087E291E02EE330E06B -:1078C00019C0882329F485E691E024E030E012C055 -:1078D000813029F489E691E022E230E00BC0823069 -:1078E00029F48DE891E028E130E004C080E090E0E8 -:1078F00020E030E091838083C90108958093E900FE -:107900008091EB0081608093EB001092ED0060931A -:10791000EC004093ED008091EE00881F8827881FBF -:1079200008958091B60188238CF403C08EB3882318 -:10793000B1F08091E80082FFF9CF8091E8008B7769 -:107940008093E80008958EB3882349F08091E80081 -:1079500080FFF9CF8091E8008E778093E80008954A -:10796000EF92FF920F931F9345D04CD008ED10E09B -:10797000F80180818F778083808180688083808117 -:107980008F7D808319BC1EBA1092B40180EEE82E60 -:10799000F12CF70180818B7F8083F80180818160E9 -:1079A000808380E060E042E0A9DFE1EEF0E08081EA -:1079B0008E7F8083E2EEF0E0808181608083808131 -:1079C00088608083F70180818E7F8083F8018081C9 -:1079D000806180831F910F91FF90EF900895E7EDF4 -:1079E000F0E08081816080838AE482BF81E08093BF -:1079F000B501B6CFE8EDF0E080818E7F80831092F4 -:107A0000E20008951092DA001092E10008951F92AA -:107A10000F920FB60F9211242F933F934F935F93C2 -:107A20006F937F938F939F93AF93BF93EF93FF9346 -:107A30008091DA0080FF1BC08091D80080FF17C0C2 -:107A40008091DA008E7F8093DA008091D90080FFE8 -:107A50000BC080E189BD82E189BD09B400FEFDCF84 -:107A600081E08EBB3BD203C019BC1EBA37D28091D5 -:107A7000E10080FF17C08091E20080FF13C0809179 -:107A8000E2008E7F8093E2008091E200806180932B -:107A9000E2008091D80080628093D80019BC85E014 -:107AA0008EBB1CD28091E10084FF2CC08091E2004B -:107AB00084FF28C080E189BD82E189BD09B400FE50 -:107AC000FDCF8091D8008F7D8093D8008091E10018 -:107AD0008F7E8093E1008091E2008F7E8093E200B0 -:107AE0008091E20081608093E2008091B40188235C -:107AF00031F48091E30087FD02C081E001C084E0A1 -:107B00008EBBECD18091E10083FF21C08091E20027 -:107B100083FF1DC08091E100877F8093E10082E0B8 -:107B20008EBB1092B4018091E1008E7F8093E100C2 -:107B30008091E2008E7F8093E2008091E20080617C -:107B40008093E20080E060E042E0D8DEC7D1FF91A0 -:107B5000EF91BF91AF919F918F917F916F915F91C5 -:107B60004F913F912F910F900FBE0F901F9018953E -:107B70009C014091BC015091BD014617570718F474 -:107B8000F90190E044C06115710511F0AB01F8CF27 -:107B90008091E8008E778093E80040E050E0F0CFDD -:107BA0008EB3882309F444C0853009F443C0809122 -:107BB000E80083FF02C081E008958091E80082FD23 -:107BC00031C08091E80080FF22C08091F300909145 -:107BD000F200782F60E0292F30E0262B372B07C0EA -:107BE00081918093F100415050402F5F3F4F4115EC -:107BF000510519F02830310598F390E0283031050F -:107C000009F491E08091E8008E778093E8004115B7 -:107C1000510531F6992321F605C08EB3882341F032 -:107C2000853041F08091E80082FFF7CF80E0089531 -:107C300082E0089583E008959C016115710529F49F -:107C40008091E8008B778093E800F90126C08EB31D -:107C5000882391F1853091F18091E80083FF02C083 -:107C600081E008958091E80082FFF1CF06C0809105 -:107C7000F10081936150704059F02091F3008091A0 -:107C8000F200322F20E090E0822B932B892B79F7A2 -:107C90008091E8008B778093E80061157105B9F653 -:107CA00005C08EB3882341F0853041F08091E80013 -:107CB00080FFF7CF80E0089582E0089583E0089583 -:107CC0000F931F93DF93CF9300D0CDB7DEB7E6EBD2 -:107CD000F1E08091F100819381E0EE3BF807C9F774 -:107CE00024DD8091E80083FFE4C08091B60190918B -:107CF000B701953009F46DC0963040F4913081F1B0 -:107D0000913070F0933009F0D4C02AC0983009F453 -:107D1000A3C0993009F4B2C0963009F0CAC07CC043 -:107D2000803809F4C6C0823809F0C3C08091BA0116 -:107D300087708093E9008091EB001092E900209118 -:107D4000E800277F2093E80090E025E0969587954E -:107D50002A95E1F781708093F1001092F10087C0BD -:107D6000882319F0823009F0A4C08F71823009F0A5 -:107D7000A0C08091B801882331F52091BA01277005 -:107D800009F497C02093E9008091EB0080FF1BC0AD -:107D9000933021F48091EB00806213C08091EB005E -:107DA00080618093EB0081E090E002C0880F991F12 -:107DB0002A95E2F78093EA001092EA008091EB00A6 -:107DC00088608093EB001092E9008091E800877F43 -:107DD00051C0882309F06DC01091B8011F770FB70B -:107DE000F8948091E800877F8093E8009ADD809185 -:107DF000E80080FFFCCF8091E3008078812B8093A6 -:107E0000E30080688093E300112311F482E001C055 -:107E100083E08EBB0FBF4DC08058823008F049C050 -:107E20008091B8019091B9016091BA01AE014F5FA4 -:107E30005F4F36DDBC01009709F43BC08091E8003C -:107E4000877F8093E80089819A8192DE8091E800A3 -:107E50008B778093E8002DC0803859F58091E80039 -:107E6000877F8093E8008091B4018093F100809136 -:107E7000E8008E778093E80054DD1BC08823C9F4A6 -:107E80009091B8019230A8F48091E800877F8093A8 -:107E9000E8009093B40145DD8091B401882331F46A -:107EA0008091E30087FD02C081E001C084E08EBBC9 -:107EB0006CDC8091E80083FF0AC08091EB00806257 -:107EC0008093EB008091E800877F8093E8000F901B -:107ED0000F90CF91DF911F910F91089508951F93F7 -:107EE0008EB3882361F01091E9001092E90080912F -:107EF000E80083FF01C0E4DE17701093E9001F91D2 -:107F00000895F999FECF92BD81BDF89A992780B561 -:107F10000895262FF999FECF1FBA92BD81BD20BDCD -:107F20000FB6F894FA9AF99A0FBE01960895F8944C -:027F3000FFCF81 -:107F32004341544552494E41007777000800000002 -:107F4200000000080112011001020000084123375D -:107F52000201000201000109023E0002010080321A -:107F6200090400000102020100052400100104249A -:107F720002040524060001070582030800FF090424 -:107F82000100020A000000070504021000010705B3 -:107F92008302100001040309042203470065006EF6 -:107FA20000750069006E006F0020004D00690063DB -:107FB2000072006F00200020002000000018034122 -:107FC2000072006400750069006E006F0020004CB2 -:087FD200004C00430000000018 -:040000030000700089 -:00000001FF diff --git a/arduino/hardware/arduino/avr/bootloaders/caterina/Caterina-Genuino-Micro.txt b/arduino/hardware/arduino/avr/bootloaders/caterina/Caterina-Genuino-Micro.txt deleted file mode 100644 index fd29bd8..0000000 --- a/arduino/hardware/arduino/avr/bootloaders/caterina/Caterina-Genuino-Micro.txt +++ /dev/null @@ -1,19 +0,0 @@ -GENUINO MICRO PRODUCTION FIRMWARES -================================== - -Bootloader: ------------ - -Name: Caterina-Genuino-Micro.hex - -Notes: -Builds against LUFA version 111009 -make version 3.81 -avrdude version 5.11 - -All AVR tools except avrdude were installed by CrossPack 20100115: -avr-gcc version 4.3.3 (GCC) -Thread model: single -Configured with: ../configure —prefix=/usr/local/CrossPack-AVR-20100115 —disable-dependency-tracking —disable-nls —disable-werror —target=avr —enable-languages=c,c++ —disable-nls —disable-libssp —with-dwarf2 -avr-libc version 1.6.7 -binutils version 2.19 diff --git a/arduino/hardware/arduino/avr/cores/arduino/Arduino.h b/arduino/hardware/arduino/avr/cores/arduino/Arduino.h index 09c1448..91eeb16 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/Arduino.h +++ b/arduino/hardware/arduino/avr/cores/arduino/Arduino.h @@ -111,7 +111,8 @@ void yield(void); #define bitRead(value, bit) (((value) >> (bit)) & 0x01) #define bitSet(value, bit) ((value) |= (1UL << (bit))) #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) -#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) +#define bitToggle(value, bit) ((value) ^= (1UL << (bit))) +#define bitWrite(value, bit, bitvalue) ((bitvalue) ? bitSet(value, bit) : bitClear(value, bit)) // avr-libc defines _NOP() since 1.6.2 #ifndef _NOP @@ -130,16 +131,16 @@ void initVariant(void); int atexit(void (*func)()) __attribute__((weak)); -void pinMode(uint8_t, uint8_t); -void digitalWrite(uint8_t, uint8_t); -int digitalRead(uint8_t); -int analogRead(uint8_t); +void pinMode(uint8_t pin, uint8_t mode); +void digitalWrite(uint8_t pin, uint8_t val); +int digitalRead(uint8_t pin); +int analogRead(uint8_t pin); void analogReference(uint8_t mode); -void analogWrite(uint8_t, int); +void analogWrite(uint8_t pin, int val); unsigned long millis(void); unsigned long micros(void); -void delay(unsigned long); +void delay(unsigned long ms); void delayMicroseconds(unsigned int us); unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout); unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout); @@ -147,8 +148,8 @@ unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout); void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder); -void attachInterrupt(uint8_t, void (*)(void), int mode); -void detachInterrupt(uint8_t); +void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode); +void detachInterrupt(uint8_t interruptNum); void setup(void); void loop(void); diff --git a/arduino/hardware/arduino/avr/cores/arduino/CDC.cpp b/arduino/hardware/arduino/avr/cores/arduino/CDC.cpp index 142f8f6..4ff6b9b 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/CDC.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/CDC.cpp @@ -41,7 +41,7 @@ static u8 wdtcsr_save; extern const CDCDescriptor _cdcInterface PROGMEM; const CDCDescriptor _cdcInterface = { - D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1), + D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0), // CDC communication interface D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0), diff --git a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp index 1146eeb..7d47ed2 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp @@ -26,7 +26,7 @@ #include "HardwareSerial.h" #include "HardwareSerial_private.h" -// Each HardwareSerial is defined in its own file, sine the linker pulls +// Each HardwareSerial is defined in its own file, since the linker pulls // in the entire file when any element inside is used. --gc-sections can // additionally cause unused symbols to be dropped, but ISRs have the // "used" attribute so are never dropped and they keep the diff --git a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp index 19625e2..a345cdb 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial1.cpp @@ -26,7 +26,7 @@ #include "HardwareSerial.h" #include "HardwareSerial_private.h" -// Each HardwareSerial is defined in its own file, sine the linker pulls +// Each HardwareSerial is defined in its own file, since the linker pulls // in the entire file when any element inside is used. --gc-sections can // additionally cause unused symbols to be dropped, but ISRs have the // "used" attribute so are never dropped and they keep the diff --git a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp index fd334ae..8e433b6 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial2.cpp @@ -26,7 +26,7 @@ #include "HardwareSerial.h" #include "HardwareSerial_private.h" -// Each HardwareSerial is defined in its own file, sine the linker pulls +// Each HardwareSerial is defined in its own file, since the linker pulls // in the entire file when any element inside is used. --gc-sections can // additionally cause unused symbols to be dropped, but ISRs have the // "used" attribute so are never dropped and they keep the diff --git a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp index a68095b..26aaee8 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/HardwareSerial3.cpp @@ -26,7 +26,7 @@ #include "HardwareSerial.h" #include "HardwareSerial_private.h" -// Each HardwareSerial is defined in its own file, sine the linker pulls +// Each HardwareSerial is defined in its own file, since the linker pulls // in the entire file when any element inside is used. --gc-sections can // additionally cause unused symbols to be dropped, but ISRs have the // "used" attribute so are never dropped and they keep the diff --git a/arduino/hardware/arduino/avr/cores/arduino/Stream.cpp b/arduino/hardware/arduino/avr/cores/arduino/Stream.cpp index d284631..9eff663 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/Stream.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/Stream.cpp @@ -218,7 +218,6 @@ size_t Stream::readBytes(char *buffer, size_t length) size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { - if (length < 1) return 0; size_t index = 0; while (index < length) { int c = timedRead(); diff --git a/arduino/hardware/arduino/avr/cores/arduino/Tone.cpp b/arduino/hardware/arduino/avr/cores/arduino/Tone.cpp index 3262f57..1bfb3e3 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/Tone.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/Tone.cpp @@ -180,12 +180,12 @@ static int8_t toneBegin(uint8_t _pin) #if defined(TCCR2A) && defined(TCCR2B) case 2: // 8 bit timer - // TCCR2A = 0; - // TCCR2B = 0; -// bitWrite(TCCR2A, WGM21, 1); -// bitWrite(TCCR2B, CS20, 1); -// timer2_pin_port = portOutputRegister(digitalPinToPort(_pin)); -// timer2_pin_mask = digitalPinToBitMask(_pin); + TCCR2A = 0; + TCCR2B = 0; + bitWrite(TCCR2A, WGM21, 1); + bitWrite(TCCR2B, CS20, 1); + timer2_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer2_pin_mask = digitalPinToBitMask(_pin); break; #endif @@ -304,7 +304,7 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) #endif #if defined(TCCR2B) { -// TCCR2B = (TCCR2B & 0b11111000) | prescalarbits; + TCCR2B = (TCCR2B & 0b11111000) | prescalarbits; } #else { @@ -385,9 +385,9 @@ void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) #if defined(OCR2A) && defined(TIMSK2) && defined(OCIE2A) case 2: -// OCR2A = ocr; -// timer2_toggle_count = toggle_count; -// bitWrite(TIMSK2, OCIE2A, 1); + OCR2A = ocr; + timer2_toggle_count = toggle_count; + bitWrite(TIMSK2, OCIE2A, 1); break; #endif @@ -443,16 +443,16 @@ void disableTimer(uint8_t _timer) case 2: #if defined(TIMSK2) && defined(OCIE2A) -// bitWrite(TIMSK2, OCIE2A, 0); // disable interrupt + bitWrite(TIMSK2, OCIE2A, 0); // disable interrupt #endif #if defined(TCCR2A) && defined(WGM20) -// TCCR2A = (1 << WGM20); + TCCR2A = (1 << WGM20); #endif #if defined(TCCR2B) && defined(CS22) -// TCCR2B = (TCCR2B & 0b11111000) | (1 << CS22); + TCCR2B = (TCCR2B & 0b11111000) | (1 << CS22); #endif #if defined(OCR2A) -// OCR2A = 0; + OCR2A = 0; #endif break; @@ -534,7 +534,7 @@ ISR(TIMER1_COMPA_vect) #endif -#ifdef NOPE //USE_TIMER2 +#ifdef USE_TIMER2 ISR(TIMER2_COMPA_vect) { diff --git a/arduino/hardware/arduino/avr/cores/arduino/USBAPI.h b/arduino/hardware/arduino/avr/cores/arduino/USBAPI.h index 479ced9..701a14f 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/USBAPI.h +++ b/arduino/hardware/arduino/avr/cores/arduino/USBAPI.h @@ -65,6 +65,8 @@ public: void detach(); // Serial port goes down too... void poll(); bool wakeupHost(); // returns false, when wakeup cannot be processed + + bool isSuspended(); }; extern USBDevice_ USBDevice; diff --git a/arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp b/arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp index 81f689d..dc6bc38 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/USBCore.cpp @@ -496,14 +496,13 @@ bool SendConfiguration(int maxlen) static bool SendDescriptor(USBSetup& setup) { - int ret; u8 t = setup.wValueH; if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t) return SendConfiguration(setup.wLength); InitControl(setup.wLength); #ifdef PLUGGABLE_USB_ENABLED - ret = PluggableUSB().getDescriptor(setup); + int ret = PluggableUSB().getDescriptor(setup); if (ret != 0) { return (ret > 0 ? true : false); } @@ -855,4 +854,10 @@ bool USBDevice_::wakeupHost() return false; } +bool USBDevice_::isSuspended() +{ + return (_usbSuspendState & (1 << SUSPI)); +} + + #endif /* if defined(USBCON) */ diff --git a/arduino/hardware/arduino/avr/cores/arduino/USBCore.h b/arduino/hardware/arduino/avr/cores/arduino/USBCore.h index 4210ced..0c63c2b 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/USBCore.h +++ b/arduino/hardware/arduino/avr/cores/arduino/USBCore.h @@ -97,6 +97,9 @@ // bMaxPower in Configuration Descriptor #define USB_CONFIG_POWER_MA(mA) ((mA)/2) +#ifndef USB_CONFIG_POWER + #define USB_CONFIG_POWER (500) +#endif // bEndpointAddress in Endpoint Descriptor #define USB_ENDPOINT_DIRECTION_MASK 0x80 @@ -267,7 +270,7 @@ typedef struct { 18, 1, USB_VERSION, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs } #define D_CONFIG(_totalLength,_interfaces) \ - { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(500) } + { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(USB_CONFIG_POWER) } #define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \ { 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 } diff --git a/arduino/hardware/arduino/avr/cores/arduino/WInterrupts.c b/arduino/hardware/arduino/avr/cores/arduino/WInterrupts.c index cef1106..38ea158 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/WInterrupts.c +++ b/arduino/hardware/arduino/avr/cores/arduino/WInterrupts.c @@ -65,7 +65,6 @@ static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS] = { nothing, #endif }; -// volatile static voidFuncPtr twiIntFunc; void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { if(interruptNum < EXTERNAL_NUM_INTERRUPTS) { @@ -103,6 +102,39 @@ void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { EICRB = (EICRB & ~((1< works as expected +*/ +#include "new.h" diff --git a/arduino/hardware/arduino/avr/cores/arduino/new.cpp b/arduino/hardware/arduino/avr/cores/arduino/new.cpp index cf6f89c..fc30cf8 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/new.cpp +++ b/arduino/hardware/arduino/avr/cores/arduino/new.cpp @@ -26,6 +26,11 @@ void *operator new[](size_t size) { return malloc(size); } +void * operator new(size_t size, void * ptr) noexcept { + (void)size; + return ptr; +} + void operator delete(void * ptr) { free(ptr); } diff --git a/arduino/hardware/arduino/avr/cores/arduino/new.h b/arduino/hardware/arduino/avr/cores/arduino/new.h index 6e1b68f..763f5cc 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/new.h +++ b/arduino/hardware/arduino/avr/cores/arduino/new.h @@ -23,6 +23,7 @@ void * operator new(size_t size); void * operator new[](size_t size); +void * operator new(size_t size, void * ptr) noexcept; void operator delete(void * ptr); void operator delete[](void * ptr); diff --git a/arduino/hardware/arduino/avr/cores/arduino/wiring_analog.c b/arduino/hardware/arduino/avr/cores/arduino/wiring_analog.c index 967c2b9..e237d6d 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/wiring_analog.c +++ b/arduino/hardware/arduino/avr/cores/arduino/wiring_analog.c @@ -164,7 +164,7 @@ void analogWrite(uint8_t pin, int val) #if defined(TCCR1A) && defined(COM1C1) case TIMER1C: - // connect pwm to pin on timer 1, channel B + // connect pwm to pin on timer 1, channel C sbi(TCCR1A, COM1C1); OCR1C = val; // set pwm duty break; diff --git a/arduino/hardware/arduino/avr/cores/arduino/wiring_pulse.c b/arduino/hardware/arduino/avr/cores/arduino/wiring_pulse.c index 94c11ff..d6e0434 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/wiring_pulse.c +++ b/arduino/hardware/arduino/avr/cores/arduino/wiring_pulse.c @@ -91,27 +91,3 @@ unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout) } return micros() - start; } - -#include -#include - -unsigned long countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, unsigned long maxloops) - { - unsigned long width = 0; - // wait for any previous pulse to end - while ((*port & bit) == stateMask) - if (--maxloops == 0) - return 0; - - // wait for the pulse to start - while ((*port & bit) != stateMask) - if (--maxloops == 0) - return 0; - - // wait for the pulse to stop - while ((*port & bit) == stateMask) { - if (++width == maxloops) - return 0; - } - return width; - } diff --git a/arduino/hardware/arduino/avr/cores/arduino/wiring_shift.c b/arduino/hardware/arduino/avr/cores/arduino/wiring_shift.c index 2b6f7a8..a9b3be5 100644 --- a/arduino/hardware/arduino/avr/cores/arduino/wiring_shift.c +++ b/arduino/hardware/arduino/avr/cores/arduino/wiring_shift.c @@ -42,10 +42,13 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) uint8_t i; for (i = 0; i < 8; i++) { - if (bitOrder == LSBFIRST) - digitalWrite(dataPin, !!(val & (1 << i))); - else - digitalWrite(dataPin, !!(val & (1 << (7 - i)))); + if (bitOrder == LSBFIRST) { + digitalWrite(dataPin, val & 1); + val >>= 1; + } else { + digitalWrite(dataPin, (val & 128) != 0); + val <<= 1; + } digitalWrite(clockPin, HIGH); digitalWrite(clockPin, LOW); diff --git a/arduino/hardware/arduino/avr/extras/pack.hourlybuild.bash b/arduino/hardware/arduino/avr/extras/pack.hourlybuild.bash new file mode 100755 index 0000000..b3a269f --- /dev/null +++ b/arduino/hardware/arduino/avr/extras/pack.hourlybuild.bash @@ -0,0 +1,51 @@ +#!/bin/bash -ex + +# pack.*.bash - Bash script to help packaging avr core releases. +# Copyright (c) 2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +BUILD_NUMBER=$1 +CURR_TIME=`date "+%Y-%m-%d %H:%M"` +CURR_TIME_SED=`date "+%Y\\-%m\\-%d %H:%M"` +VERSION=9.9.9-Hourly + +PWD=`pwd` +FOLDERNAME=`basename $PWD` +THIS_SCRIPT_NAME=`basename $0` +FILENAME=package_avr-hourly-b${BUILD_NUMBER}.tar.bz2 + +rm -f $FILENAME + +# Change name in platform.txt +sed -i "s/name=.*/name=SAMD Hourly Build ${BUILD_NUMBER} (${CURR_TIME})/" platform.txt + +cd .. +tar --transform "s|$FOLDERNAME|avr-hourly_b${BUILD_NUMBER}|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf $FILENAME $FOLDERNAME +cd - + +mv ../$FILENAME . + +CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'` +SIZE=`wc -c $FILENAME | awk '{ print $1 }'` + +cat extras/package_index.json.Hourly.template | +sed "s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/" | +sed "s/%%CURR_TIME%%/${CURR_TIME_SED}/" | +sed "s/%%VERSION%%/${VERSION}/" | +sed "s/%%FILENAME%%/${FILENAME}/" | +sed "s/%%CHECKSUM%%/${CHKSUM}/" | +sed "s/%%SIZE%%/${SIZE}/" > package_avr-hourly-build_index.json + diff --git a/arduino/hardware/arduino/avr/extras/pack.pullrequest.bash b/arduino/hardware/arduino/avr/extras/pack.pullrequest.bash new file mode 100755 index 0000000..64f5b95 --- /dev/null +++ b/arduino/hardware/arduino/avr/extras/pack.pullrequest.bash @@ -0,0 +1,50 @@ +#!/bin/bash -ex + +# pack.*.bash - Bash script to help packaging avr core releases. +# Copyright (c) 2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +PR_NUMBER=$1 +BUILD_NUMBER=$2 +VERSION=`grep version= platform.txt | sed 's/version=//g'` + +PWD=`pwd` +FOLDERNAME=`basename $PWD` +THIS_SCRIPT_NAME=`basename $0` +FILENAME=package_avr-b${BUILD_NUMBER}.tar.bz2 + +rm -f $FILENAME + +# Change name in platform.txt +sed -i "s/name=.*/name=SAMD Pull request #${PR_NUMBER} (Build ${BUILD_NUMBER})/" platform.txt + +cd .. +tar --transform "s|$FOLDERNAME|avr-PR${PR_NUMBER}_b${BUILD_NUMBER}|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf $FILENAME $FOLDERNAME +cd - + +mv ../$FILENAME . + +CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'` +SIZE=`wc -c $FILENAME | awk '{ print $1 }'` + +cat extras/package_index.json.PR.template | +sed s/%%PR_NUMBER%%/${PR_NUMBER}/ | +sed s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/ | +sed s/%%VERSION%%/${VERSION}-build-${BUILD_NUMBER}/ | +sed s/%%FILENAME%%/${FILENAME}/ | +sed s/%%CHECKSUM%%/${CHKSUM}/ | +sed s/%%SIZE%%/${SIZE}/ > package_avr-b${BUILD_NUMBER}_index.json + diff --git a/arduino/hardware/arduino/avr/extras/pack.release.bash b/arduino/hardware/arduino/avr/extras/pack.release.bash new file mode 100755 index 0000000..a2999d5 --- /dev/null +++ b/arduino/hardware/arduino/avr/extras/pack.release.bash @@ -0,0 +1,33 @@ +#!/bin/bash -ex + +# pack.*.bash - Bash script to help packaging avr core releases. +# Copyright (c) 2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +VERSION=`grep version= platform.txt | sed 's/version=//g'` + +PWD=`pwd` +FOLDERNAME=`basename $PWD` +THIS_SCRIPT_NAME=`basename $0` + +rm -f avr-$VERSION.tar.bz2 + +cd .. +tar --transform "s|$FOLDERNAME|$FOLDERNAME-$VERSION|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf avr-$VERSION.tar.bz2 $FOLDERNAME +cd - + +mv ../avr-$VERSION.tar.bz2 . + diff --git a/arduino/hardware/arduino/avr/extras/package_index.json.Hourly.template b/arduino/hardware/arduino/avr/extras/package_index.json.Hourly.template new file mode 100644 index 0000000..85c3665 --- /dev/null +++ b/arduino/hardware/arduino/avr/extras/package_index.json.Hourly.template @@ -0,0 +1,72 @@ +{ + "packages": [ + { + "name": "arduino-beta", + "maintainer": "Arduino Betatesting", + "websiteURL": "http://www.arduino.cc/", + "email": "packages@arduino.cc", + "help": { + "online": "http://www.arduino.cc/en/Reference/HomePage" + }, + "platforms": [ + { + "name": "Arduino AVR core - Hourly build", + "architecture": "avr", + "version": "%%VERSION%%", + "category": "Arduino", + "url": "http://downloads.arduino.cc/Hourly/avr/%%FILENAME%%", + "archiveFileName": "%%FILENAME%%", + "checksum": "SHA-256:%%CHECKSUM%%", + "size": "%%SIZE%%", + "boards": [ + {"name": "Arduino Yún"}, + {"name": "Arduino Uno"}, + {"name": "Arduino Uno WiFi"}, + {"name": "Arduino Diecimila"}, + {"name": "Arduino Nano"}, + {"name": "Arduino Mega"}, + {"name": "Arduino MegaADK"}, + {"name": "Arduino Leonardo"}, + {"name": "Arduino Leonardo Ethernet"}, + {"name": "Arduino Micro"}, + {"name": "Arduino Esplora"}, + {"name": "Arduino Mini"}, + {"name": "Arduino Ethernet"}, + {"name": "Arduino Fio"}, + {"name": "Arduino BT"}, + {"name": "Arduino LilyPadUSB"}, + {"name": "Arduino Lilypad"}, + {"name": "Arduino Pro"}, + {"name": "Arduino ATMegaNG"}, + {"name": "Arduino Robot Control"}, + {"name": "Arduino Robot Motor"}, + {"name": "Arduino Gemma"}, + {"name": "Adafruit Circuit Playground"}, + {"name": "Arduino Yún Mini"}, + {"name": "Arduino Industrial 101"}, + {"name": "Linino One"} + ], + "toolsDependencies": [ + { + "packager": "arduino", + "name": "avr-gcc", + "version": "4.9.2-atmel3.5.4-arduino2" + }, + { + "packager": "arduino", + "name": "avrdude", + "version": "6.3.0-arduino9" + }, + { + "packager": "arduino", + "name": "arduinoOTA", + "version": "1.1.1" + } + ] + } + ], + "tools": [ + ] + } + ] +} diff --git a/arduino/hardware/arduino/avr/extras/package_index.json.PR.template b/arduino/hardware/arduino/avr/extras/package_index.json.PR.template new file mode 100644 index 0000000..f1d21f3 --- /dev/null +++ b/arduino/hardware/arduino/avr/extras/package_index.json.PR.template @@ -0,0 +1,72 @@ +{ + "packages": [ + { + "name": "arduino-beta", + "maintainer": "Arduino Betatesting", + "websiteURL": "http://www.arduino.cc/", + "email": "packages@arduino.cc", + "help": { + "online": "http://www.arduino.cc/en/Reference/HomePage" + }, + "platforms": [ + { + "name": "Arduino AVR core - Pull request #%%PR_NUMBER%% (build %%BUILD_NUMBER%%)", + "architecture": "avr", + "version": "%%VERSION%%", + "category": "Arduino", + "url": "http://downloads.arduino.cc/PR/a/%%FILENAME%%", + "archiveFileName": "%%FILENAME%%", + "checksum": "SHA-256:%%CHECKSUM%%", + "size": "%%SIZE%%", + "boards": [ + {"name": "Arduino Yún"}, + {"name": "Arduino Uno"}, + {"name": "Arduino Uno WiFi"}, + {"name": "Arduino Diecimila"}, + {"name": "Arduino Nano"}, + {"name": "Arduino Mega"}, + {"name": "Arduino MegaADK"}, + {"name": "Arduino Leonardo"}, + {"name": "Arduino Leonardo Ethernet"}, + {"name": "Arduino Micro"}, + {"name": "Arduino Esplora"}, + {"name": "Arduino Mini"}, + {"name": "Arduino Ethernet"}, + {"name": "Arduino Fio"}, + {"name": "Arduino BT"}, + {"name": "Arduino LilyPadUSB"}, + {"name": "Arduino Lilypad"}, + {"name": "Arduino Pro"}, + {"name": "Arduino ATMegaNG"}, + {"name": "Arduino Robot Control"}, + {"name": "Arduino Robot Motor"}, + {"name": "Arduino Gemma"}, + {"name": "Adafruit Circuit Playground"}, + {"name": "Arduino Yún Mini"}, + {"name": "Arduino Industrial 101"}, + {"name": "Linino One"} + ], + "toolsDependencies": [ + { + "packager": "arduino", + "name": "avr-gcc", + "version": "4.9.2-atmel3.5.4-arduino2" + }, + { + "packager": "arduino", + "name": "avrdude", + "version": "6.3.0-arduino9" + }, + { + "packager": "arduino", + "name": "arduinoOTA", + "version": "1.1.1" + } + ] + } + ], + "tools": [ + ] + } + ] +} diff --git a/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp b/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp index 474fe4a..3163d7a 100644 --- a/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp +++ b/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp @@ -316,7 +316,7 @@ void SoftwareSerial::begin(long speed) _tx_delay = subtract_cap(bit_delay, 15 / 4); // Only setup rx when we have a valid PCINT for this pin - if (digitalPinToPCICR(_receivePin)) { + if (digitalPinToPCICR((int8_t)_receivePin)) { #if GCC_VERSION > 40800 // Timings counted from gcc 4.8.2 output. This works up to 115200 on // 16Mhz and 57600 on 8Mhz. @@ -357,7 +357,7 @@ void SoftwareSerial::begin(long speed) // Enable the PCINT for the entire port here, but never disable it // (others might also need it, so we disable the interrupt by using // the per-pin PCMSK register). - *digitalPinToPCICR(_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin)); + *digitalPinToPCICR((int8_t)_receivePin) |= _BV(digitalPinToPCICRbit(_receivePin)); // Precalculate the pcint mask register and value, so setRxIntMask // can be used inside the ISR without costing too much time. _pcint_maskreg = digitalPinToPCMSK(_receivePin); diff --git a/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.h b/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.h index b1a37c4..d8b88ce 100644 --- a/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.h +++ b/arduino/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.h @@ -111,13 +111,4 @@ public: static inline void handle_interrupt() __attribute__((__always_inline__)); }; -// Arduino 0012 workaround -#undef int -#undef char -#undef long -#undef byte -#undef float -#undef abs -#undef round - #endif diff --git a/arduino/hardware/arduino/avr/libraries/Wire/examples/i2c_scanner/i2c_scanner.ino b/arduino/hardware/arduino/avr/libraries/Wire/examples/i2c_scanner/i2c_scanner.ino new file mode 100644 index 0000000..3febbf4 --- /dev/null +++ b/arduino/hardware/arduino/avr/libraries/Wire/examples/i2c_scanner/i2c_scanner.ino @@ -0,0 +1,75 @@ +// -------------------------------------- +// i2c_scanner +// +// Version 1 +// This program (or code that looks like it) +// can be found in many places. +// For example on the Arduino.cc forum. +// The original author is not know. +// Version 2, Juni 2012, Using Arduino 1.0.1 +// Adapted to be as simple as possible by Arduino.cc user Krodal +// Version 3, Feb 26 2013 +// V3 by louarnold +// Version 4, March 3, 2013, Using Arduino 1.0.3 +// by Arduino.cc user Krodal. +// Changes by louarnold removed. +// Scanning addresses changed from 0...127 to 1...119, +// according to the i2c scanner by Nick Gammon +// https://www.gammon.com.au/forum/?id=10896 +// Version 5, March 28, 2013 +// As version 4, but address scans now to 127. +// A sensor seems to use address 120. +// Version 6, November 27, 2015. +// Added waiting for the Leonardo serial communication. +// +// +// This sketch tests the standard 7-bit addresses +// Devices with higher bit address might not be seen properly. +// + +#include + +void setup() { + Wire.begin(); + + Serial.begin(9600); + while (!Serial); // Leonardo: wait for serial monitor + Serial.println("\nI2C Scanner"); +} + +void loop() { + int nDevices = 0; + + Serial.println("Scanning..."); + + for (byte address = 1; address < 127; ++address) { + // The i2c_scanner uses the return value of + // the Write.endTransmisstion to see if + // a device did acknowledge to the address. + Wire.beginTransmission(address); + byte error = Wire.endTransmission(); + + if (error == 0) { + Serial.print("I2C device found at address 0x"); + if (address < 16) { + Serial.print("0"); + } + Serial.print(address, HEX); + Serial.println(" !"); + + ++nDevices; + } else if (error == 4) { + Serial.print("Unknown error at address 0x"); + if (address < 16) { + Serial.print("0"); + } + Serial.println(address, HEX); + } + } + if (nDevices == 0) { + Serial.println("No I2C devices found\n"); + } else { + Serial.println("done\n"); + } + delay(5000); // Wait 5 seconds for next scan +} diff --git a/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.cpp b/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.cpp index 58916ce..c407776 100644 --- a/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.cpp +++ b/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.cpp @@ -18,6 +18,7 @@ Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts Modified 2017 by Chuck Todd (ctodd@cableone.net) to correct Unconfigured Slave Mode reboot + Modified 2020 by Greyson Christoforo (grey@christoforo.net) to implement timeouts */ extern "C" { @@ -86,6 +87,52 @@ void TwoWire::setClock(uint32_t clock) twi_setFrequency(clock); } +/*** + * Sets the TWI timeout. + * + * This limits the maximum time to wait for the TWI hardware. If more time passes, the bus is assumed + * to have locked up (e.g. due to noise-induced glitches or faulty slaves) and the transaction is aborted. + * Optionally, the TWI hardware is also reset, which can be required to allow subsequent transactions to + * succeed in some cases (in particular when noise has made the TWI hardware think there is a second + * master that has claimed the bus). + * + * When a timeout is triggered, a flag is set that can be queried with `getWireTimeoutFlag()` and is cleared + * when `clearWireTimeoutFlag()` or `setWireTimeoutUs()` is called. + * + * Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master + * to complete its transaction. So make sure to adapt the timeout to accomodate for those cases if needed. + * A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol), + * but (much) shorter values will usually also work. + * + * In the future, a timeout will be enabled by default, so if you require the timeout to be disabled, it is + * recommended you disable it by default using `setWireTimeoutUs(0)`, even though that is currently + * the default. + * + * @param timeout a timeout value in microseconds, if zero then timeout checking is disabled + * @param reset_with_timeout if true then TWI interface will be automatically reset on timeout + * if false then TWI interface will not be reset on timeout + + */ +void TwoWire::setWireTimeout(uint32_t timeout, bool reset_with_timeout){ + twi_setTimeoutInMicros(timeout, reset_with_timeout); +} + +/*** + * Returns the TWI timeout flag. + * + * @return true if timeout has occured since the flag was last cleared. + */ +bool TwoWire::getWireTimeoutFlag(void){ + return(twi_manageTimeoutFlag(false)); +} + +/*** + * Clears the TWI timeout flag. + */ +void TwoWire::clearWireTimeoutFlag(void){ + twi_manageTimeoutFlag(true); +} + uint8_t TwoWire::requestFrom(uint8_t address, uint8_t quantity, uint32_t iaddress, uint8_t isize, uint8_t sendStop) { if (isize > 0) { diff --git a/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.h b/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.h index 702f37d..e70d72e 100644 --- a/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.h +++ b/arduino/hardware/arduino/avr/libraries/Wire/src/Wire.h @@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts + Modified 2020 by Greyson Christoforo (grey@christoforo.net) to implement timeouts */ #ifndef TwoWire_h @@ -54,13 +55,16 @@ class TwoWire : public Stream void begin(int); void end(); void setClock(uint32_t); + void setWireTimeout(uint32_t timeout = 25000, bool reset_with_timeout = false); + bool getWireTimeoutFlag(void); + void clearWireTimeoutFlag(void); void beginTransmission(uint8_t); void beginTransmission(int); uint8_t endTransmission(void); uint8_t endTransmission(uint8_t); uint8_t requestFrom(uint8_t, uint8_t); uint8_t requestFrom(uint8_t, uint8_t, uint8_t); - uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t); + uint8_t requestFrom(uint8_t, uint8_t, uint32_t, uint8_t, uint8_t); uint8_t requestFrom(int, int); uint8_t requestFrom(int, int, int); virtual size_t write(uint8_t); diff --git a/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.c b/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.c index 171af73..e8a41a2 100644 --- a/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.c +++ b/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.c @@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts + Modified 2020 by Greyson Christoforo (grey@christoforo.net) to implement timeouts */ #include @@ -24,8 +25,9 @@ #include #include #include +#include #include -#include "Arduino.h" // for digitalWrite +#include "Arduino.h" // for digitalWrite and micros #ifndef cbi #define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) @@ -43,6 +45,16 @@ static volatile uint8_t twi_slarw; static volatile uint8_t twi_sendStop; // should the transaction end with a stop static volatile uint8_t twi_inRepStart; // in the middle of a repeated start +// twi_timeout_us > 0 prevents the code from getting stuck in various while loops here +// if twi_timeout_us == 0 then timeout checking is disabled (the previous Wire lib behavior) +// at some point in the future, the default twi_timeout_us value could become 25000 +// and twi_do_reset_on_timeout could become true +// to conform to the SMBus standard +// http://smbus.org/specs/SMBus_3_1_20180319.pdf +static volatile uint32_t twi_timeout_us = 0ul; +static volatile bool twi_timed_out_flag = false; // a timeout has been seen +static volatile bool twi_do_reset_on_timeout = false; // reset the TWI registers on timeout + static void (*twi_onSlaveTransmit)(void); static void (*twi_onSlaveReceive)(uint8_t*, int); @@ -154,8 +166,12 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen } // wait until twi is ready, become master receiver + uint32_t startMicros = micros(); while(TWI_READY != twi_state){ - continue; + if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) { + twi_handleTimeout(twi_do_reset_on_timeout); + return 0; + } } twi_state = TWI_MRX; twi_sendStop = sendStop; @@ -183,28 +199,38 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen // up. Also, don't enable the START interrupt. There may be one pending from the // repeated start that we sent ourselves, and that would really confuse things. twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR + startMicros = micros(); do { TWDR = twi_slarw; + if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) { + twi_handleTimeout(twi_do_reset_on_timeout); + return 0; + } } while(TWCR & _BV(TWWC)); TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START - } - else + } else { // send start condition TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTA); + } // wait for read operation to complete + startMicros = micros(); while(TWI_MRX == twi_state){ - continue; + if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) { + twi_handleTimeout(twi_do_reset_on_timeout); + return 0; + } } - if (twi_masterBufferIndex < length) + if (twi_masterBufferIndex < length) { length = twi_masterBufferIndex; + } // copy twi buffer to data for(i = 0; i < length; ++i){ data[i] = twi_masterBuffer[i]; } - + return length; } @@ -222,6 +248,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen * 2 .. address send, NACK received * 3 .. data send, NACK received * 4 .. other twi error (lost bus arbitration, bus error, ..) + * 5 .. timeout */ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait, uint8_t sendStop) { @@ -233,8 +260,12 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait } // wait until twi is ready, become master transmitter + uint32_t startMicros = micros(); while(TWI_READY != twi_state){ - continue; + if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) { + twi_handleTimeout(twi_do_reset_on_timeout); + return (5); + } } twi_state = TWI_MTX; twi_sendStop = sendStop; @@ -265,18 +296,27 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait // up. Also, don't enable the START interrupt. There may be one pending from the // repeated start that we sent outselves, and that would really confuse things. twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR + startMicros = micros(); do { - TWDR = twi_slarw; + TWDR = twi_slarw; + if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) { + twi_handleTimeout(twi_do_reset_on_timeout); + return (5); + } } while(TWCR & _BV(TWWC)); TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START - } - else + } else { // send start condition TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE) | _BV(TWSTA); // enable INTs + } // wait for write operation to complete + startMicros = micros(); while(wait && (TWI_MTX == twi_state)){ - continue; + if((twi_timeout_us > 0ul) && ((micros() - startMicros) > twi_timeout_us)) { + twi_handleTimeout(twi_do_reset_on_timeout); + return (5); + } } if (twi_error == 0xFF) @@ -356,7 +396,7 @@ void twi_reply(uint8_t ack) if(ack){ TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT) | _BV(TWEA); }else{ - TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT); + TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWINT); } } @@ -373,8 +413,19 @@ void twi_stop(void) // wait for stop condition to be exectued on bus // TWINT is not set after a stop condition! + // We cannot use micros() from an ISR, so approximate the timeout with cycle-counted delays + const uint8_t us_per_loop = 8; + uint32_t counter = (twi_timeout_us + us_per_loop - 1)/us_per_loop; // Round up while(TWCR & _BV(TWSTO)){ - continue; + if(twi_timeout_us > 0ul){ + if (counter > 0ul){ + _delay_us(us_per_loop); + counter--; + } else { + twi_handleTimeout(twi_do_reset_on_timeout); + return; + } + } } // update twi state @@ -396,6 +447,59 @@ void twi_releaseBus(void) twi_state = TWI_READY; } +/* + * Function twi_setTimeoutInMicros + * Desc set a timeout for while loops that twi might get stuck in + * Input timeout value in microseconds (0 means never time out) + * Input reset_with_timeout: true causes timeout events to reset twi + * Output none + */ +void twi_setTimeoutInMicros(uint32_t timeout, bool reset_with_timeout){ + twi_timed_out_flag = false; + twi_timeout_us = timeout; + twi_do_reset_on_timeout = reset_with_timeout; +} + +/* + * Function twi_handleTimeout + * Desc this gets called whenever a while loop here has lasted longer than + * twi_timeout_us microseconds. always sets twi_timed_out_flag + * Input reset: true causes this function to reset the twi hardware interface + * Output none + */ +void twi_handleTimeout(bool reset){ + twi_timed_out_flag = true; + + if (reset) { + // remember bitrate and address settings + uint8_t previous_TWBR = TWBR; + uint8_t previous_TWAR = TWAR; + + // reset the interface + twi_disable(); + twi_init(); + + // reapply the previous register values + TWAR = previous_TWAR; + TWBR = previous_TWBR; + } +} + +/* + * Function twi_manageTimeoutFlag + * Desc returns true if twi has seen a timeout + * optionally clears the timeout flag + * Input clear_flag: true if we should reset the hardware + * Output none + */ +bool twi_manageTimeoutFlag(bool clear_flag){ + bool flag = twi_timed_out_flag; + if (clear_flag){ + twi_timed_out_flag = false; + } + return(flag); +} + ISR(TWI_vect) { switch(TW_STATUS){ @@ -416,16 +520,16 @@ ISR(TWI_vect) TWDR = twi_masterBuffer[twi_masterBufferIndex++]; twi_reply(1); }else{ - if (twi_sendStop) + if (twi_sendStop){ twi_stop(); - else { - twi_inRepStart = true; // we're gonna send the START - // don't enable the interrupt. We'll generate the start, but we - // avoid handling the interrupt until we're in the next transaction, - // at the point where we would normally issue the start. - TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ; - twi_state = TWI_READY; - } + } else { + twi_inRepStart = true; // we're gonna send the START + // don't enable the interrupt. We'll generate the start, but we + // avoid handling the interrupt until we're in the next transaction, + // at the point where we would normally issue the start. + TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ; + twi_state = TWI_READY; + } } break; case TW_MT_SLA_NACK: // address sent, nack received @@ -445,6 +549,7 @@ ISR(TWI_vect) case TW_MR_DATA_ACK: // data received, ack sent // put byte into buffer twi_masterBuffer[twi_masterBufferIndex++] = TWDR; + __attribute__ ((fallthrough)); case TW_MR_SLA_ACK: // address sent, ack received // ack if more bytes are expected, otherwise nack if(twi_masterBufferIndex < twi_masterBufferLength){ @@ -456,17 +561,17 @@ ISR(TWI_vect) case TW_MR_DATA_NACK: // data received, nack sent // put final byte into buffer twi_masterBuffer[twi_masterBufferIndex++] = TWDR; - if (twi_sendStop) - twi_stop(); - else { - twi_inRepStart = true; // we're gonna send the START - // don't enable the interrupt. We'll generate the start, but we - // avoid handling the interrupt until we're in the next transaction, - // at the point where we would normally issue the start. - TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ; - twi_state = TWI_READY; - } - break; + if (twi_sendStop){ + twi_stop(); + } else { + twi_inRepStart = true; // we're gonna send the START + // don't enable the interrupt. We'll generate the start, but we + // avoid handling the interrupt until we're in the next transaction, + // at the point where we would normally issue the start. + TWCR = _BV(TWINT) | _BV(TWSTA)| _BV(TWEN) ; + twi_state = TWI_READY; + } + break; case TW_MR_SLA_NACK: // address sent, nack received twi_stop(); break; @@ -530,6 +635,7 @@ ISR(TWI_vect) twi_txBufferLength = 1; twi_txBuffer[0] = 0x00; } + __attribute__ ((fallthrough)); // transmit first byte from buffer, fall case TW_ST_DATA_ACK: // byte sent, ack returned // copy data to output register @@ -558,4 +664,3 @@ ISR(TWI_vect) break; } } - diff --git a/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.h b/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.h index d27325e..85b9837 100644 --- a/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.h +++ b/arduino/hardware/arduino/avr/libraries/Wire/src/utility/twi.h @@ -15,6 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Modified 2020 by Greyson Christoforo (grey@christoforo.net) to implement timeouts */ #ifndef twi_h @@ -50,6 +52,8 @@ void twi_reply(uint8_t); void twi_stop(void); void twi_releaseBus(void); + void twi_setTimeoutInMicros(uint32_t, bool); + void twi_handleTimeout(bool); + bool twi_manageTimeoutFlag(bool); #endif - diff --git a/arduino/hardware/arduino/avr/platform.txt b/arduino/hardware/arduino/avr/platform.txt index cb48698..8f46fbc 100644 --- a/arduino/hardware/arduino/avr/platform.txt +++ b/arduino/hardware/arduino/avr/platform.txt @@ -6,7 +6,7 @@ # https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification name=Arduino AVR Boards -version=1.6.23 +version=1.8.3 # AVR compile variables # --------------------- @@ -33,6 +33,7 @@ compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc, compiler.elf2hex.flags=-O ihex -R .eeprom compiler.elf2hex.cmd=avr-objcopy compiler.ldflags= +compiler.libraries.ldflags= compiler.size.cmd=avr-size # This can be overridden in boards.txt @@ -65,7 +66,7 @@ archive_file_path={build.path}/{archive_file} recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" ## Combine gc-sections, archives, and objects -recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} "{build.path}/{archive_file}" "-L{build.path}" -lm ## Create output files (.eep and .hex) recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep" diff --git a/arduino/hardware/arduino/avr/programmers.txt b/arduino/hardware/arduino/avr/programmers.txt index d0d2cc1..69ddf69 100644 --- a/arduino/hardware/arduino/avr/programmers.txt +++ b/arduino/hardware/arduino/avr/programmers.txt @@ -43,13 +43,22 @@ parallel.program.extra_params=-F arduinoasisp.name=Arduino as ISP arduinoasisp.communication=serial -arduinoasisp.protocol=arduino +arduinoasisp.protocol=stk500v1 arduinoasisp.speed=19200 -arduinoasisp.program.protocol=arduino +arduinoasisp.program.protocol=stk500v1 arduinoasisp.program.speed=19200 arduinoasisp.program.tool=avrdude arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed} +arduinoasispatmega32u4.name=Arduino as ISP (ATmega32U4) +arduinoasispatmega32u4.communication=serial +arduinoasispatmega32u4.protocol=arduino +arduinoasispatmega32u4.speed=19200 +arduinoasispatmega32u4.program.protocol=arduino +arduinoasispatmega32u4.program.speed=19200 +arduinoasispatmega32u4.program.tool=avrdude +arduinoasispatmega32u4.program.extra_params=-P{serial.port} -b{program.speed} + usbGemma.name=Arduino Gemma usbGemma.protocol=arduinogemma usbGemma.program.tool=avrdude diff --git a/arduino/hardware/arduino/avr/variants/ethernet/pins_arduino.h b/arduino/hardware/arduino/avr/variants/ethernet/pins_arduino.h index 77fcc40..f12f321 100644 --- a/arduino/hardware/arduino/avr/variants/ethernet/pins_arduino.h +++ b/arduino/hardware/arduino/avr/variants/ethernet/pins_arduino.h @@ -250,5 +250,6 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { // pins are NOT connected to anything by default. #define SERIAL_PORT_HARDWARE Serial #define SERIAL_PORT_HARDWARE_OPEN Serial +#define SERIAL_PORT_MONITOR Serial #endif diff --git a/arduino/libraries/RF24/RF24.cpp b/arduino/libraries/RF24/RF24.cpp index 6689063..192f3c4 100644 --- a/arduino/libraries/RF24/RF24.cpp +++ b/arduino/libraries/RF24/RF24.cpp @@ -191,6 +191,17 @@ void RF24::print_status(uint8_t status) ((status >> RX_P_NO) & B111), (status & _BV(TX_FULL))?1:0 ); + + char arr1[128]; + sprintf_P(arr1, PSTR("STATUS\t\t = 0x%02x RX_DR=%x TX_DS=%x MAX_RT=%x RX_P_NO=%x TX_FULL=%x\r\n"), + status, + (status & _BV(RX_DR))?1:0, + (status & _BV(TX_DS))?1:0, + (status & _BV(MAX_RT))?1:0, + ((status >> RX_P_NO) & B111), + (status & _BV(TX_FULL))?1:0 + ); + Serial.write(arr1); } /****************************************************************************/ @@ -210,9 +221,20 @@ void RF24::print_byte_register(const char* name, uint8_t reg, uint8_t qty) { char extra_tab = strlen_P(name) < 8 ? '\t' : 0; printf_P(PSTR(PRIPSTR"\t%c ="),name,extra_tab); - while (qty--) - printf_P(PSTR(" 0x%02x"),read_register(reg++)); + char arr1[32]; + sprintf_P(arr1, PSTR(PRIPSTR"\t%c ="),name,extra_tab); + Serial.write(arr1); + + while (qty--) { + printf_P(PSTR(" 0x%02x"), read_register(reg++)); + char arr2[32]; + sprintf_P(arr2, PSTR(" 0x%02x"), read_register(reg++)); + Serial.write(arr2); + } printf_P(PSTR("\r\n")); + char arr3[32]; + sprintf_P(arr3, PSTR("\r\n")); + Serial.write(arr3); } /****************************************************************************/ @@ -222,6 +244,10 @@ void RF24::print_address_register(const char* name, uint8_t reg, uint8_t qty) char extra_tab = strlen_P(name) < 8 ? '\t' : 0; printf_P(PSTR(PRIPSTR"\t%c ="),name,extra_tab); + char arr1[32]; + sprintf_P(arr1, PSTR(PRIPSTR"\t%c ="),name,extra_tab); + Serial.write(arr1); + while (qty--) { uint8_t buffer[5]; @@ -231,9 +257,15 @@ void RF24::print_address_register(const char* name, uint8_t reg, uint8_t qty) uint8_t* bufptr = buffer + sizeof buffer; while( --bufptr >= buffer ) printf_P(PSTR("%02x"),*bufptr); + char arr2[32]; + sprintf_P(arr2, PSTR("%02x"),*bufptr); + Serial.write(arr2); } printf_P(PSTR("\r\n")); + char arr3[32]; + sprintf_P(arr3, PSTR("\r\n")); + Serial.write(arr3); } /****************************************************************************/ @@ -308,24 +340,42 @@ static const char * const rf24_pa_dbm_e_str_P[] PROGMEM = { void RF24::printDetails(void) { - print_status(get_status()); + print_status(get_status()); + + print_address_register(PSTR("RX_ADDR_P0-1"),RX_ADDR_P0,2); + print_byte_register(PSTR("RX_ADDR_P2-5"),RX_ADDR_P2,4); + print_address_register(PSTR("TX_ADDR"),TX_ADDR); + + print_byte_register(PSTR("RX_PW_P0-6"),RX_PW_P0,6); + print_byte_register(PSTR("EN_AA"),EN_AA); + print_byte_register(PSTR("EN_RXADDR"),EN_RXADDR); + print_byte_register(PSTR("RF_CH"),RF_CH); + print_byte_register(PSTR("RF_SETUP"),RF_SETUP); + print_byte_register(PSTR("CONFIG"),CONFIG); + print_byte_register(PSTR("DYNPD/FEATURE"),DYNPD,2); + + printf_P(PSTR("Data Rate\t = %S\r\n"),pgm_read_word(&rf24_datarate_e_str_P[getDataRate()])); + printf_P(PSTR("Model\t\t = %S\r\n"),pgm_read_word(&rf24_model_e_str_P[isPVariant()])); + printf_P(PSTR("CRC Length\t = %S\r\n"),pgm_read_word(&rf24_crclength_e_str_P[getCRCLength()])); + printf_P(PSTR("PA Power\t = %S\r\n"),pgm_read_word(&rf24_pa_dbm_e_str_P[getPALevel()])); + + char arr1[32]; + sprintf_P(arr1, PSTR("Data Rate\t = %S\r\n"),pgm_read_word(&rf24_datarate_e_str_P[getDataRate()])); + Serial.write(arr1); + + char arr2[32]; + sprintf_P(arr2, PSTR("Model\t\t = %S\r\n"),pgm_read_word(&rf24_model_e_str_P[isPVariant()])); + Serial.write(arr2); + + char arr3[32]; + sprintf_P(arr3, PSTR("CRC Length\t = %S\r\n"),pgm_read_word(&rf24_crclength_e_str_P[getCRCLength()])); + Serial.write(arr3); - print_address_register(PSTR("RX_ADDR_P0-1"),RX_ADDR_P0,2); - print_byte_register(PSTR("RX_ADDR_P2-5"),RX_ADDR_P2,4); - print_address_register(PSTR("TX_ADDR"),TX_ADDR); + char arr4[32]; + sprintf_P(arr4, PSTR("PA Power\t = %S\r\n"),pgm_read_word(&rf24_pa_dbm_e_str_P[getPALevel()])); + Serial.write(arr4); - print_byte_register(PSTR("RX_PW_P0-6"),RX_PW_P0,6); - print_byte_register(PSTR("EN_AA"),EN_AA); - print_byte_register(PSTR("EN_RXADDR"),EN_RXADDR); - print_byte_register(PSTR("RF_CH"),RF_CH); - print_byte_register(PSTR("RF_SETUP"),RF_SETUP); - print_byte_register(PSTR("CONFIG"),CONFIG); - print_byte_register(PSTR("DYNPD/FEATURE"),DYNPD,2); - printf_P(PSTR("Data Rate\t = %S\r\n"),pgm_read_word(&rf24_datarate_e_str_P[getDataRate()])); - printf_P(PSTR("Model\t\t = %S\r\n"),pgm_read_word(&rf24_model_e_str_P[isPVariant()])); - printf_P(PSTR("CRC Length\t = %S\r\n"),pgm_read_word(&rf24_crclength_e_str_P[getCRCLength()])); - printf_P(PSTR("PA Power\t = %S\r\n"),pgm_read_word(&rf24_pa_dbm_e_str_P[getPALevel()])); } /****************************************************************************/ diff --git a/arduino/libraries/SoftPWM/SoftPWM.cpp b/arduino/libraries/SoftPWM/SoftPWM.cpp index c254c21..eec8149 100644 --- a/arduino/libraries/SoftPWM/SoftPWM.cpp +++ b/arduino/libraries/SoftPWM/SoftPWM.cpp @@ -173,7 +173,10 @@ void SoftPWMSetPolarity(int8_t pin, uint8_t polarity) { } } - +void SoftPWMSetPercent(int8_t pin, uint8_t percent, uint8_t hardset) +{ + SoftPWMSet(pin, ((uint16_t)percent * 255) / 100, hardset); +} void SoftPWMSet(uint8_t pin, uint8_t value, uint8_t hardset) { diff --git a/arduino/libraries/SoftPWM/SoftPWM.h b/arduino/libraries/SoftPWM/SoftPWM.h index c754452..bed7724 100644 --- a/arduino/libraries/SoftPWM/SoftPWM.h +++ b/arduino/libraries/SoftPWM/SoftPWM.h @@ -49,7 +49,7 @@ void SoftPWMBegin(uint8_t defaultPolarity = SOFTPWM_NORMAL); -void SoftPWMSet(int8_t pin, uint8_t value, uint8_t hardset = 0); +void SoftPWMSet(uint8_t pin, uint8_t value, uint8_t hardset = 0); void SoftPWMEnd(int8_t pin); diff --git a/cad/IEbus/IEbus.kicad_pcb b/cad/IEbus/IEbus.kicad_pcb new file mode 100644 index 0000000..02c8ecb --- /dev/null +++ b/cad/IEbus/IEbus.kicad_pcb @@ -0,0 +1 @@ +(kicad_pcb (version 4) (host kicad "dummy file") ) diff --git a/cad/IEbus/IEbus.pro b/cad/IEbus/IEbus.pro new file mode 100644 index 0000000..152769c --- /dev/null +++ b/cad/IEbus/IEbus.pro @@ -0,0 +1,33 @@ +update=22/05/2015 07:44:53 +version=1 +last_client=kicad +[general] +version=1 +RootSch= +BoardNm= +[pcbnew] +version=1 +LastNetListRead= +UseCmpFile=1 +PadDrill=0.600000000000 +PadDrillOvalY=0.600000000000 +PadSizeH=1.500000000000 +PadSizeV=1.500000000000 +PcbTextSizeV=1.500000000000 +PcbTextSizeH=1.500000000000 +PcbTextThickness=0.300000000000 +ModuleTextSizeV=1.000000000000 +ModuleTextSizeH=1.000000000000 +ModuleTextSizeThickness=0.150000000000 +SolderMaskClearance=0.000000000000 +SolderMaskMinWidth=0.000000000000 +DrawSegmentWidth=0.200000000000 +BoardOutlineThickness=0.100000000000 +ModuleOutlineThickness=0.150000000000 +[cvpcb] +version=1 +NetIExt=net +[eeschema] +version=1 +LibDir= +[eeschema/libraries] diff --git a/cad/IEbus/IEbus.sch b/cad/IEbus/IEbus.sch new file mode 100644 index 0000000..fff8c68 --- /dev/null +++ b/cad/IEbus/IEbus.sch @@ -0,0 +1,4 @@ +EESchema Schematic File Version 2 +EELAYER 25 0 +EELAYER END +$EndSCHEMATC diff --git a/cad/files.zip b/cad/files.zip new file mode 100644 index 0000000..9fad339 Binary files /dev/null and b/cad/files.zip differ diff --git a/cad/n/cad-B_Cu.gbr b/cad/n/cad-B_Cu.gbr new file mode 100644 index 0000000..9b5cd69 --- /dev/null +++ b/cad/n/cad-B_Cu.gbr @@ -0,0 +1,380 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Copper,L2,Bot*% +%TF.FilePolarity,Positive*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%TA.AperFunction,ComponentPad*% +%ADD10O,1.800000X1.800000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD11R,1.800000X1.800000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD12C,1.524000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD13O,1.200000X2.000000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD14O,1.600000X1.600000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD15R,1.600000X1.600000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD16C,1.778000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD17C,2.286000*% +%TD*% +%TA.AperFunction,ViaPad*% +%ADD18C,0.800000*% +%TD*% +%TA.AperFunction,Conductor*% +%ADD19C,0.250000*% +%TD*% +G04 APERTURE END LIST* +D10* +%TO.P,D1,2*% +%TO.N,Net-(D1-Pad2)*% +X200406000Y-113030000D03* +D11* +%TO.P,D1,1*% +%TO.N,Net-(D1-Pad1)*% +X200406000Y-125730000D03* +%TD*% +D12* +%TO.P,U4,2*% +%TO.N,Net-(D1-Pad2)*% +X190174000Y-114300000D03* +%TO.P,U4,1*% +%TO.N,Net-(U2-Pad5)*% +X117674000Y-114300000D03* +%TD*% +D13* +%TO.P,U1,7*% +%TO.N,Net-(A1-Pad15)*% +X156210000Y-101600000D03* +%TO.P,U1,8*% +%TO.N,Net-(U1-Pad8)*% +X156210000Y-99060000D03* +%TO.P,U1,5*% +%TO.N,Net-(A1-Pad16)*% +X153670000Y-101600000D03* +%TO.P,U1,6*% +%TO.N,Net-(A1-Pad14)*% +X153670000Y-99060000D03* +%TO.P,U1,3*% +%TO.N,Net-(A1-Pad10)*% +X151130000Y-101600000D03* +%TO.P,U1,4*% +%TO.N,Net-(A1-Pad11)*% +X151130000Y-99060000D03* +%TO.P,U1,1*% +%TO.N,Net-(A1-Pad29)*% +X148590000Y-101600000D03* +%TO.P,U1,2*% +%TO.N,Net-(A1-Pad17)*% +X148590000Y-99060000D03* +%TD*% +D12* +%TO.P,U3,4*% +%TO.N,Net-(A1-Pad29)*% +X151120000Y-120590000D03* +%TO.P,U3,3*% +%TO.N,Net-(A1-Pad30)*% +X151120000Y-113090000D03* +%TO.P,U3,2*% +%TO.N,Net-(U2-Pad6)*% +X181620000Y-120590000D03* +%TO.P,U3,1*% +%TO.N,Net-(U2-Pad3)*% +X181620000Y-113090000D03* +%TD*% +%TO.P,U2,5*% +%TO.N,Net-(U2-Pad5)*% +X170240000Y-98900000D03* +%TO.P,U2,6*% +%TO.N,Net-(U2-Pad6)*% +X166990000Y-98900000D03* +%TO.P,U2,4*% +%TO.N,Net-(D1-Pad1)*% +X177740000Y-98900000D03* +%TO.P,U2,3*% +%TO.N,Net-(U2-Pad3)*% +X180990000Y-98900000D03* +%TO.P,U2,2*% +%TO.N,Net-(U2-Pad2)*% +X180990000Y-76400000D03* +%TO.P,U2,1*% +%TO.N,Net-(U2-Pad1)*% +X166990000Y-76400000D03* +%TD*% +D14* +%TO.P,A1,16*% +%TO.N,Net-(A1-Pad16)*% +X125730000Y-78740000D03* +%TO.P,A1,15*% +%TO.N,Net-(A1-Pad15)*% +X140970000Y-78740000D03* +%TO.P,A1,30*% +%TO.N,Net-(A1-Pad30)*% +X125730000Y-114300000D03* +%TO.P,A1,14*% +%TO.N,Net-(A1-Pad14)*% +X140970000Y-81280000D03* +%TO.P,A1,29*% +%TO.N,Net-(A1-Pad29)*% +X125730000Y-111760000D03* +%TO.P,A1,13*% +%TO.N,Net-(A1-Pad13)*% +X140970000Y-83820000D03* +%TO.P,A1,28*% +%TO.N,Net-(A1-Pad28)*% +X125730000Y-109220000D03* +%TO.P,A1,12*% +%TO.N,Net-(A1-Pad12)*% +X140970000Y-86360000D03* +%TO.P,A1,27*% +%TO.N,Net-(A1-Pad27)*% +X125730000Y-106680000D03* +%TO.P,A1,11*% +%TO.N,Net-(A1-Pad11)*% +X140970000Y-88900000D03* +%TO.P,A1,26*% +%TO.N,Net-(A1-Pad26)*% +X125730000Y-104140000D03* +%TO.P,A1,10*% +%TO.N,Net-(A1-Pad10)*% +X140970000Y-91440000D03* +%TO.P,A1,25*% +%TO.N,Net-(A1-Pad25)*% +X125730000Y-101600000D03* +%TO.P,A1,9*% +%TO.N,Net-(A1-Pad9)*% +X140970000Y-93980000D03* +%TO.P,A1,24*% +%TO.N,Net-(A1-Pad24)*% +X125730000Y-99060000D03* +%TO.P,A1,8*% +%TO.N,Net-(A1-Pad8)*% +X140970000Y-96520000D03* +%TO.P,A1,23*% +%TO.N,Net-(A1-Pad23)*% +X125730000Y-96520000D03* +%TO.P,A1,7*% +%TO.N,Net-(A1-Pad7)*% +X140970000Y-99060000D03* +%TO.P,A1,22*% +%TO.N,Net-(A1-Pad22)*% +X125730000Y-93980000D03* +%TO.P,A1,6*% +%TO.N,Net-(A1-Pad6)*% +X140970000Y-101600000D03* +%TO.P,A1,21*% +%TO.N,Net-(A1-Pad21)*% +X125730000Y-91440000D03* +%TO.P,A1,5*% +%TO.N,Net-(A1-Pad5)*% +X140970000Y-104140000D03* +%TO.P,A1,20*% +%TO.N,Net-(A1-Pad20)*% +X125730000Y-88900000D03* +%TO.P,A1,4*% +%TO.N,Net-(A1-Pad4)*% +X140970000Y-106680000D03* +%TO.P,A1,19*% +%TO.N,Net-(A1-Pad19)*% +X125730000Y-86360000D03* +%TO.P,A1,3*% +%TO.N,Net-(A1-Pad3)*% +X140970000Y-109220000D03* +%TO.P,A1,18*% +%TO.N,Net-(A1-Pad18)*% +X125730000Y-83820000D03* +%TO.P,A1,2*% +%TO.N,Net-(A1-Pad2)*% +X140970000Y-111760000D03* +%TO.P,A1,17*% +%TO.N,Net-(A1-Pad17)*% +X125730000Y-81280000D03* +D15* +%TO.P,A1,1*% +%TO.N,Net-(A1-Pad1)*% +X140970000Y-114300000D03* +%TD*% +D16* +%TO.P,J1,4*% +%TO.N,Net-(A1-Pad29)*% +X97950000Y-101610000D03* +%TO.P,J1,1*% +%TO.N,Net-(A1-Pad24)*% +X97950000Y-99060000D03* +%TO.P,J1,0*% +%TO.N,Net-(A1-Pad17)*% +X97948000Y-96510000D03* +D17* +%TO.P,J1,MOUN*% +%TO.N,N/C*% +X113005000Y-94060000D03* +X113005000Y-104060000D03* +%TO.P,J1,0*% +%TO.N,Net-(A1-Pad17)*% +X100355000Y-104060000D03* +%TO.P,J1,MOUN*% +%TO.N,N/C*% +X100355000Y-94060000D03* +D16* +%TO.P,J1,4*% +%TO.N,Net-(A1-Pad29)*% +X109230000Y-107790000D03* +%TO.P,J1,2*% +%TO.N,Net-(A1-Pad23)*% +X106680000Y-107790000D03* +%TO.P,J1,0*% +%TO.N,Net-(A1-Pad17)*% +X104130000Y-107790000D03* +%TO.P,J1,4*% +%TO.N,Net-(A1-Pad29)*% +X109930000Y-93310000D03* +X103430000Y-93310000D03* +%TO.P,J1,3*% +%TO.N,Net-(A1-Pad12)*% +X109930000Y-88810000D03* +X103430000Y-88810000D03* +%TD*% +%TO.P,J2,4*% +%TO.N,Net-(A1-Pad29)*% +X193200000Y-101610000D03* +%TO.P,J2,1*% +%TO.N,Net-(A1-Pad25)*% +X193200000Y-99060000D03* +%TO.P,J2,0*% +%TO.N,Net-(A1-Pad17)*% +X193198000Y-96510000D03* +D17* +%TO.P,J2,MOUN*% +%TO.N,N/C*% +X208255000Y-94060000D03* +X208255000Y-104060000D03* +%TO.P,J2,0*% +%TO.N,Net-(A1-Pad17)*% +X195605000Y-104060000D03* +%TO.P,J2,MOUN*% +%TO.N,N/C*% +X195605000Y-94060000D03* +D16* +%TO.P,J2,4*% +%TO.N,Net-(A1-Pad29)*% +X204480000Y-107790000D03* +%TO.P,J2,2*% +%TO.N,Net-(A1-Pad26)*% +X201930000Y-107790000D03* +%TO.P,J2,0*% +%TO.N,Net-(A1-Pad17)*% +X199380000Y-107790000D03* +%TO.P,J2,4*% +%TO.N,Net-(A1-Pad29)*% +X205180000Y-93310000D03* +X198680000Y-93310000D03* +%TO.P,J2,3*% +%TO.N,Net-(A1-Pad13)*% +X205180000Y-88810000D03* +X198680000Y-88810000D03* +%TD*% +D18* +%TO.N,Net-(A1-Pad15)*% +X157480000Y-78740000D03* +X147320000Y-78740000D03* +%TO.N,Net-(A1-Pad14)*% +X153670000Y-81280000D03* +X147320000Y-81280000D03* +%TO.N,Net-(A1-Pad29)*% +X190575000Y-98985000D03* +X204480000Y-99050000D03* +%TO.N,Net-(A1-Pad13)*% +X158750000Y-83820000D03* +X147320000Y-83820000D03* +%TO.N,Net-(A1-Pad11)*% +X147320000Y-88900000D03* +X151130000Y-88900000D03* +%TO.N,Net-(A1-Pad26)*% +X121920000Y-115570000D03* +X121920000Y-110490000D03* +%TO.N,Net-(A1-Pad10)*% +X147320000Y-91440000D03* +X152400000Y-91440000D03* +%TO.N,Net-(A1-Pad25)*% +X123190000Y-104140000D03* +X123190000Y-115570000D03* +%TO.N,Net-(A1-Pad24)*% +X120650000Y-110490000D03* +X120650000Y-115570000D03* +%TD*% +D19* +%TO.N,Net-(A1-Pad15)*% +X157480000Y-78740000D02* +X147320000Y-78740000D01* +%TO.N,Net-(A1-Pad14)*% +X147320000Y-81280000D02* +X153670000Y-81280000D01* +%TO.N,Net-(A1-Pad29)*% +X203275999Y-97845999D02* +X204480000Y-99050000D01* +X191714001Y-97845999D02* +X203275999Y-97845999D01* +X190575000Y-98985000D02* +X191714001Y-97845999D01* +%TO.N,Net-(A1-Pad13)*% +X158750000Y-83820000D02* +X147320000Y-83820000D01* +%TO.N,Net-(A1-Pad11)*% +X151130000Y-88900000D02* +X147320000Y-88900000D01* +%TO.N,Net-(A1-Pad26)*% +X121920000Y-115570000D02* +X121920000Y-110490000D01* +%TO.N,Net-(A1-Pad10)*% +X147320000Y-91440000D02* +X152400000Y-91440000D01* +%TO.N,Net-(A1-Pad25)*% +X123190000Y-104140000D02* +X123190000Y-115570000D01* +%TO.N,Net-(A1-Pad24)*% +X120650000Y-110490000D02* +X120650000Y-115570000D01* +X120650000Y-115570000D02* +X120650000Y-115570000D01* +%TO.N,Net-(U2-Pad5)*% +X170240000Y-113224000D02* +X170240000Y-98900000D01* +X117674000Y-114300000D02* +X117674000Y-116150000D01* +X164592000Y-118872000D02* +X170240000Y-113224000D01* +X120396000Y-118872000D02* +X164592000Y-118872000D01* +X117674000Y-116150000D02* +X120396000Y-118872000D01* +%TO.N,Net-(D1-Pad1)*% +X177740000Y-98900000D02* +X177740000Y-104842000D01* +X198628000Y-125730000D02* +X200406000Y-125730000D01* +X177740000Y-104842000D02* +X198628000Y-125730000D01* +%TO.N,Net-(D1-Pad2)*% +X191444000Y-113030000D02* +X190174000Y-114300000D01* +X200406000Y-113030000D02* +X191444000Y-113030000D01* +%TD*% +M02* diff --git a/cad/n/cad-B_Mask.gbr b/cad/n/cad-B_Mask.gbr new file mode 100644 index 0000000..d37ea99 --- /dev/null +++ b/cad/n/cad-B_Mask.gbr @@ -0,0 +1,106 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Soldermask,Bot*% +%TF.FilePolarity,Negative*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%ADD10O,1.900000X1.900000*% +%ADD11R,1.900000X1.900000*% +%ADD12C,1.624000*% +%ADD13C,4.100000*% +%ADD14O,1.300000X2.100000*% +%ADD15O,1.700000X1.700000*% +%ADD16R,1.700000X1.700000*% +G04 APERTURE END LIST* +D10* +%TO.C,D1*% +X200406000Y-113030000D03* +D11* +X200406000Y-125730000D03* +%TD*% +D12* +%TO.C,U4*% +X190174000Y-114300000D03* +X117674000Y-114300000D03* +%TD*% +D13* +%TO.C,REF\u002A\u002A*% +X208280000Y-123444000D03* +%TD*% +%TO.C,REF\u002A\u002A*% +X208280000Y-78740000D03* +%TD*% +%TO.C,REF\u002A\u002A*% +X98044000Y-123444000D03* +%TD*% +%TO.C,REF\u002A\u002A*% +X98044000Y-78740000D03* +%TD*% +D14* +%TO.C,U1*% +X156210000Y-101600000D03* +X156210000Y-99060000D03* +X153670000Y-101600000D03* +X153670000Y-99060000D03* +X151130000Y-101600000D03* +X151130000Y-99060000D03* +X148590000Y-101600000D03* +X148590000Y-99060000D03* +%TD*% +D12* +%TO.C,U3*% +X151120000Y-120590000D03* +X151120000Y-113090000D03* +X181620000Y-120590000D03* +X181620000Y-113090000D03* +%TD*% +%TO.C,U2*% +X170240000Y-98900000D03* +X166990000Y-98900000D03* +X177740000Y-98900000D03* +X180990000Y-98900000D03* +X180990000Y-76400000D03* +X166990000Y-76400000D03* +%TD*% +D15* +%TO.C,A1*% +X125730000Y-78740000D03* +X140970000Y-78740000D03* +X125730000Y-114300000D03* +X140970000Y-81280000D03* +X125730000Y-111760000D03* +X140970000Y-83820000D03* +X125730000Y-109220000D03* +X140970000Y-86360000D03* +X125730000Y-106680000D03* +X140970000Y-88900000D03* +X125730000Y-104140000D03* +X140970000Y-91440000D03* +X125730000Y-101600000D03* +X140970000Y-93980000D03* +X125730000Y-99060000D03* +X140970000Y-96520000D03* +X125730000Y-96520000D03* +X140970000Y-99060000D03* +X125730000Y-93980000D03* +X140970000Y-101600000D03* +X125730000Y-91440000D03* +X140970000Y-104140000D03* +X125730000Y-88900000D03* +X140970000Y-106680000D03* +X125730000Y-86360000D03* +X140970000Y-109220000D03* +X125730000Y-83820000D03* +X140970000Y-111760000D03* +X125730000Y-81280000D03* +D16* +X140970000Y-114300000D03* +%TD*% +M02* diff --git a/cad/n/cad-B_Paste.gbr b/cad/n/cad-B_Paste.gbr new file mode 100644 index 0000000..cb00e1a --- /dev/null +++ b/cad/n/cad-B_Paste.gbr @@ -0,0 +1,15 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Paste,Bot*% +%TF.FilePolarity,Positive*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +G04 APERTURE END LIST* +M02* diff --git a/cad/n/cad-B_SilkS.gbr b/cad/n/cad-B_SilkS.gbr new file mode 100644 index 0000000..67d6ef2 --- /dev/null +++ b/cad/n/cad-B_SilkS.gbr @@ -0,0 +1,272 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Legend,Bot*% +%TF.FilePolarity,Positive*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%ADD10C,0.120000*% +%ADD11C,0.203200*% +%ADD12C,0.101600*% +%ADD13C,0.150000*% +G04 APERTURE END LIST* +D10* +%TO.C,U4*% +X192424000Y-124800000D02* +X192424000Y-103800000D01* +X115424000Y-124800000D02* +X192424000Y-124800000D01* +X115424000Y-103800000D02* +X115424000Y-124800000D01* +X192424000Y-103800000D02* +X115424000Y-103800000D01* +D11* +%TO.C,J1*% +X112268000Y-87060000D02* +X101092000Y-87060000D01* +X111506000Y-110490000D02* +X101854000Y-110490000D01* +X111506000Y-110490000D02* +X111506000Y-107950000D01* +X101854000Y-110490000D02* +X101854000Y-107950000D01* +X111506000Y-107950000D02* +X114300000Y-107950000D01* +X101854000Y-107950000D02* +X99060000Y-107950000D01* +X116205000Y-94996000D02* +X116205000Y-103124000D01* +X114300000Y-94996000D02* +X114300000Y-92075000D01* +X114300000Y-103124000D02* +X114300000Y-107950000D01* +X114300000Y-94996000D02* +X116205000Y-94996000D01* +X114300000Y-103124000D02* +X116205000Y-103124000D01* +X114300000Y-92075000D02* +X112268000Y-92075000D01* +X101092000Y-92075000D02* +X99060000Y-92075000D01* +X112268000Y-87060000D02* +X112268000Y-92075000D01* +X101092000Y-87060000D02* +X101092000Y-92075000D01* +X99060000Y-94234000D02* +X95504000Y-94234000D01* +X99060000Y-103886000D02* +X95504000Y-103886000D01* +X95504000Y-94234000D02* +X95504000Y-103886000D01* +X99060000Y-94234000D02* +X99060000Y-92075000D01* +X99060000Y-103886000D02* +X99060000Y-107950000D01* +D12* +X107129013Y-99060000D02* +G75* +G03* +X107129013Y-99060000I-449013J0D01* +G01* +D11* +%TO.C,J2*% +X207518000Y-87060000D02* +X196342000Y-87060000D01* +X206756000Y-110490000D02* +X197104000Y-110490000D01* +X206756000Y-110490000D02* +X206756000Y-107950000D01* +X197104000Y-110490000D02* +X197104000Y-107950000D01* +X206756000Y-107950000D02* +X209550000Y-107950000D01* +X197104000Y-107950000D02* +X194310000Y-107950000D01* +X211455000Y-94996000D02* +X211455000Y-103124000D01* +X209550000Y-94996000D02* +X209550000Y-92075000D01* +X209550000Y-103124000D02* +X209550000Y-107950000D01* +X209550000Y-94996000D02* +X211455000Y-94996000D01* +X209550000Y-103124000D02* +X211455000Y-103124000D01* +X209550000Y-92075000D02* +X207518000Y-92075000D01* +X196342000Y-92075000D02* +X194310000Y-92075000D01* +X207518000Y-87060000D02* +X207518000Y-92075000D01* +X196342000Y-87060000D02* +X196342000Y-92075000D01* +X194310000Y-94234000D02* +X190754000Y-94234000D01* +X194310000Y-103886000D02* +X190754000Y-103886000D01* +X190754000Y-94234000D02* +X190754000Y-103886000D01* +X194310000Y-94234000D02* +X194310000Y-92075000D01* +X194310000Y-103886000D02* +X194310000Y-107950000D01* +D12* +X202379013Y-99060000D02* +G75* +G03* +X202379013Y-99060000I-449013J0D01* +G01* +%TO.C,U4*% +D13* +X157638285Y-106752380D02* +X158209714Y-106752380D01* +X157924000Y-106752380D02* +X157924000Y-105752380D01* +X158019238Y-105895238D01* +X158114476Y-105990476D01* +X158209714Y-106038095D01* +X157066857Y-106180952D02* +X157162095Y-106133333D01* +X157209714Y-106085714D01* +X157257333Y-105990476D01* +X157257333Y-105942857D01* +X157209714Y-105847619D01* +X157162095Y-105800000D01* +X157066857Y-105752380D01* +X156876380Y-105752380D01* +X156781142Y-105800000D01* +X156733523Y-105847619D01* +X156685904Y-105942857D01* +X156685904Y-105990476D01* +X156733523Y-106085714D01* +X156781142Y-106133333D01* +X156876380Y-106180952D01* +X157066857Y-106180952D01* +X157162095Y-106228571D01* +X157209714Y-106276190D01* +X157257333Y-106371428D01* +X157257333Y-106561904D01* +X157209714Y-106657142D01* +X157162095Y-106704761D01* +X157066857Y-106752380D01* +X156876380Y-106752380D01* +X156781142Y-106704761D01* +X156733523Y-106657142D01* +X156685904Y-106561904D01* +X156685904Y-106371428D01* +X156733523Y-106276190D01* +X156781142Y-106228571D01* +X156876380Y-106180952D01* +X155828761Y-105752380D02* +X156019238Y-105752380D01* +X156114476Y-105800000D01* +X156162095Y-105847619D01* +X156257333Y-105990476D01* +X156304952Y-106180952D01* +X156304952Y-106561904D01* +X156257333Y-106657142D01* +X156209714Y-106704761D01* +X156114476Y-106752380D01* +X155924000Y-106752380D01* +X155828761Y-106704761D01* +X155781142Y-106657142D01* +X155733523Y-106561904D01* +X155733523Y-106323809D01* +X155781142Y-106228571D01* +X155828761Y-106180952D01* +X155924000Y-106133333D01* +X156114476Y-106133333D01* +X156209714Y-106180952D01* +X156257333Y-106228571D01* +X156304952Y-106323809D01* +X154828761Y-105752380D02* +X155304952Y-105752380D01* +X155352571Y-106228571D01* +X155304952Y-106180952D01* +X155209714Y-106133333D01* +X154971619Y-106133333D01* +X154876380Y-106180952D01* +X154828761Y-106228571D01* +X154781142Y-106323809D01* +X154781142Y-106561904D01* +X154828761Y-106657142D01* +X154876380Y-106704761D01* +X154971619Y-106752380D01* +X155209714Y-106752380D01* +X155304952Y-106704761D01* +X155352571Y-106657142D01* +X154162095Y-105752380D02* +X154066857Y-105752380D01* +X153971619Y-105800000D01* +X153924000Y-105847619D01* +X153876380Y-105942857D01* +X153828761Y-106133333D01* +X153828761Y-106371428D01* +X153876380Y-106561904D01* +X153924000Y-106657142D01* +X153971619Y-106704761D01* +X154066857Y-106752380D01* +X154162095Y-106752380D01* +X154257333Y-106704761D01* +X154304952Y-106657142D01* +X154352571Y-106561904D01* +X154400190Y-106371428D01* +X154400190Y-106133333D01* +X154352571Y-105942857D01* +X154304952Y-105847619D01* +X154257333Y-105800000D01* +X154162095Y-105752380D01* +X153400190Y-106371428D02* +X152638285Y-106371428D01* +X152162095Y-106752380D02* +X152162095Y-105752380D01* +X152162095Y-106133333D02* +X152066857Y-106085714D01* +X151876380Y-106085714D01* +X151781142Y-106133333D01* +X151733523Y-106180952D01* +X151685904Y-106276190D01* +X151685904Y-106561904D01* +X151733523Y-106657142D01* +X151781142Y-106704761D01* +X151876380Y-106752380D01* +X152066857Y-106752380D01* +X152162095Y-106704761D01* +X150828761Y-106752380D02* +X150828761Y-106228571D01* +X150876380Y-106133333D01* +X150971619Y-106085714D01* +X151162095Y-106085714D01* +X151257333Y-106133333D01* +X150828761Y-106704761D02* +X150924000Y-106752380D01* +X151162095Y-106752380D01* +X151257333Y-106704761D01* +X151304952Y-106609523D01* +X151304952Y-106514285D01* +X151257333Y-106419047D01* +X151162095Y-106371428D01* +X150924000Y-106371428D01* +X150828761Y-106323809D01* +X150495428Y-106085714D02* +X150114476Y-106085714D01* +X150352571Y-105752380D02* +X150352571Y-106609523D01* +X150304952Y-106704761D01* +X150209714Y-106752380D01* +X150114476Y-106752380D01* +X149924000Y-106085714D02* +X149543047Y-106085714D01* +X149781142Y-105752380D02* +X149781142Y-106609523D01* +X149733523Y-106704761D01* +X149638285Y-106752380D01* +X149543047Y-106752380D01* +%TD*% +M02* diff --git a/cad/n/cad-Edge_Cuts.gbr b/cad/n/cad-Edge_Cuts.gbr new file mode 100644 index 0000000..a5b7be6 --- /dev/null +++ b/cad/n/cad-Edge_Cuts.gbr @@ -0,0 +1,26 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Profile,NP*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%TA.AperFunction,Profile*% +%ADD10C,0.050000*% +%TD*% +G04 APERTURE END LIST* +D10* +X93472000Y-128016000D02* +X93472000Y-74168000D01* +X212852000Y-128016000D02* +X93472000Y-128016000D01* +X212852000Y-74168000D02* +X212852000Y-128016000D01* +X93472000Y-74168000D02* +X212852000Y-74168000D01* +M02* diff --git a/cad/n/cad-F_Cu.gbr b/cad/n/cad-F_Cu.gbr new file mode 100644 index 0000000..42d4842 --- /dev/null +++ b/cad/n/cad-F_Cu.gbr @@ -0,0 +1,612 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Copper,L1,Top*% +%TF.FilePolarity,Positive*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%TA.AperFunction,ComponentPad*% +%ADD10O,1.800000X1.800000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD11R,1.800000X1.800000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD12C,1.524000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD13O,1.200000X2.000000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD14O,1.600000X1.600000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD15R,1.600000X1.600000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD16C,1.778000*% +%TD*% +%TA.AperFunction,ComponentPad*% +%ADD17C,2.286000*% +%TD*% +%TA.AperFunction,ViaPad*% +%ADD18C,0.800000*% +%TD*% +%TA.AperFunction,Conductor*% +%ADD19C,0.250000*% +%TD*% +G04 APERTURE END LIST* +D10* +%TO.P,D1,2*% +%TO.N,Net-(D1-Pad2)*% +X200406000Y-113030000D03* +D11* +%TO.P,D1,1*% +%TO.N,Net-(D1-Pad1)*% +X200406000Y-125730000D03* +%TD*% +D12* +%TO.P,U4,2*% +%TO.N,Net-(D1-Pad2)*% +X190174000Y-114300000D03* +%TO.P,U4,1*% +%TO.N,Net-(U2-Pad5)*% +X117674000Y-114300000D03* +%TD*% +D13* +%TO.P,U1,7*% +%TO.N,Net-(A1-Pad15)*% +X156210000Y-101600000D03* +%TO.P,U1,8*% +%TO.N,Net-(U1-Pad8)*% +X156210000Y-99060000D03* +%TO.P,U1,5*% +%TO.N,Net-(A1-Pad16)*% +X153670000Y-101600000D03* +%TO.P,U1,6*% +%TO.N,Net-(A1-Pad14)*% +X153670000Y-99060000D03* +%TO.P,U1,3*% +%TO.N,Net-(A1-Pad10)*% +X151130000Y-101600000D03* +%TO.P,U1,4*% +%TO.N,Net-(A1-Pad11)*% +X151130000Y-99060000D03* +%TO.P,U1,1*% +%TO.N,Net-(A1-Pad29)*% +X148590000Y-101600000D03* +%TO.P,U1,2*% +%TO.N,Net-(A1-Pad17)*% +X148590000Y-99060000D03* +%TD*% +D12* +%TO.P,U3,4*% +%TO.N,Net-(A1-Pad29)*% +X151120000Y-120590000D03* +%TO.P,U3,3*% +%TO.N,Net-(A1-Pad30)*% +X151120000Y-113090000D03* +%TO.P,U3,2*% +%TO.N,Net-(U2-Pad6)*% +X181620000Y-120590000D03* +%TO.P,U3,1*% +%TO.N,Net-(U2-Pad3)*% +X181620000Y-113090000D03* +%TD*% +%TO.P,U2,5*% +%TO.N,Net-(U2-Pad5)*% +X170240000Y-98900000D03* +%TO.P,U2,6*% +%TO.N,Net-(U2-Pad6)*% +X166990000Y-98900000D03* +%TO.P,U2,4*% +%TO.N,Net-(D1-Pad1)*% +X177740000Y-98900000D03* +%TO.P,U2,3*% +%TO.N,Net-(U2-Pad3)*% +X180990000Y-98900000D03* +%TO.P,U2,2*% +%TO.N,Net-(U2-Pad2)*% +X180990000Y-76400000D03* +%TO.P,U2,1*% +%TO.N,Net-(U2-Pad1)*% +X166990000Y-76400000D03* +%TD*% +D14* +%TO.P,A1,16*% +%TO.N,Net-(A1-Pad16)*% +X125730000Y-78740000D03* +%TO.P,A1,15*% +%TO.N,Net-(A1-Pad15)*% +X140970000Y-78740000D03* +%TO.P,A1,30*% +%TO.N,Net-(A1-Pad30)*% +X125730000Y-114300000D03* +%TO.P,A1,14*% +%TO.N,Net-(A1-Pad14)*% +X140970000Y-81280000D03* +%TO.P,A1,29*% +%TO.N,Net-(A1-Pad29)*% +X125730000Y-111760000D03* +%TO.P,A1,13*% +%TO.N,Net-(A1-Pad13)*% +X140970000Y-83820000D03* +%TO.P,A1,28*% +%TO.N,Net-(A1-Pad28)*% +X125730000Y-109220000D03* +%TO.P,A1,12*% +%TO.N,Net-(A1-Pad12)*% +X140970000Y-86360000D03* +%TO.P,A1,27*% +%TO.N,Net-(A1-Pad27)*% +X125730000Y-106680000D03* +%TO.P,A1,11*% +%TO.N,Net-(A1-Pad11)*% +X140970000Y-88900000D03* +%TO.P,A1,26*% +%TO.N,Net-(A1-Pad26)*% +X125730000Y-104140000D03* +%TO.P,A1,10*% +%TO.N,Net-(A1-Pad10)*% +X140970000Y-91440000D03* +%TO.P,A1,25*% +%TO.N,Net-(A1-Pad25)*% +X125730000Y-101600000D03* +%TO.P,A1,9*% +%TO.N,Net-(A1-Pad9)*% +X140970000Y-93980000D03* +%TO.P,A1,24*% +%TO.N,Net-(A1-Pad24)*% +X125730000Y-99060000D03* +%TO.P,A1,8*% +%TO.N,Net-(A1-Pad8)*% +X140970000Y-96520000D03* +%TO.P,A1,23*% +%TO.N,Net-(A1-Pad23)*% +X125730000Y-96520000D03* +%TO.P,A1,7*% +%TO.N,Net-(A1-Pad7)*% +X140970000Y-99060000D03* +%TO.P,A1,22*% +%TO.N,Net-(A1-Pad22)*% +X125730000Y-93980000D03* +%TO.P,A1,6*% +%TO.N,Net-(A1-Pad6)*% +X140970000Y-101600000D03* +%TO.P,A1,21*% +%TO.N,Net-(A1-Pad21)*% +X125730000Y-91440000D03* +%TO.P,A1,5*% +%TO.N,Net-(A1-Pad5)*% +X140970000Y-104140000D03* +%TO.P,A1,20*% +%TO.N,Net-(A1-Pad20)*% +X125730000Y-88900000D03* +%TO.P,A1,4*% +%TO.N,Net-(A1-Pad4)*% +X140970000Y-106680000D03* +%TO.P,A1,19*% +%TO.N,Net-(A1-Pad19)*% +X125730000Y-86360000D03* +%TO.P,A1,3*% +%TO.N,Net-(A1-Pad3)*% +X140970000Y-109220000D03* +%TO.P,A1,18*% +%TO.N,Net-(A1-Pad18)*% +X125730000Y-83820000D03* +%TO.P,A1,2*% +%TO.N,Net-(A1-Pad2)*% +X140970000Y-111760000D03* +%TO.P,A1,17*% +%TO.N,Net-(A1-Pad17)*% +X125730000Y-81280000D03* +D15* +%TO.P,A1,1*% +%TO.N,Net-(A1-Pad1)*% +X140970000Y-114300000D03* +%TD*% +D16* +%TO.P,J1,4*% +%TO.N,Net-(A1-Pad29)*% +X97950000Y-101610000D03* +%TO.P,J1,1*% +%TO.N,Net-(A1-Pad24)*% +X97950000Y-99060000D03* +%TO.P,J1,0*% +%TO.N,Net-(A1-Pad17)*% +X97948000Y-96510000D03* +D17* +%TO.P,J1,MOUN*% +%TO.N,N/C*% +X113005000Y-94060000D03* +X113005000Y-104060000D03* +%TO.P,J1,0*% +%TO.N,Net-(A1-Pad17)*% +X100355000Y-104060000D03* +%TO.P,J1,MOUN*% +%TO.N,N/C*% +X100355000Y-94060000D03* +D16* +%TO.P,J1,4*% +%TO.N,Net-(A1-Pad29)*% +X109230000Y-107790000D03* +%TO.P,J1,2*% +%TO.N,Net-(A1-Pad23)*% +X106680000Y-107790000D03* +%TO.P,J1,0*% +%TO.N,Net-(A1-Pad17)*% +X104130000Y-107790000D03* +%TO.P,J1,4*% +%TO.N,Net-(A1-Pad29)*% +X109930000Y-93310000D03* +X103430000Y-93310000D03* +%TO.P,J1,3*% +%TO.N,Net-(A1-Pad12)*% +X109930000Y-88810000D03* +X103430000Y-88810000D03* +%TD*% +%TO.P,J2,4*% +%TO.N,Net-(A1-Pad29)*% +X193200000Y-101610000D03* +%TO.P,J2,1*% +%TO.N,Net-(A1-Pad25)*% +X193200000Y-99060000D03* +%TO.P,J2,0*% +%TO.N,Net-(A1-Pad17)*% +X193198000Y-96510000D03* +D17* +%TO.P,J2,MOUN*% +%TO.N,N/C*% +X208255000Y-94060000D03* +X208255000Y-104060000D03* +%TO.P,J2,0*% +%TO.N,Net-(A1-Pad17)*% +X195605000Y-104060000D03* +%TO.P,J2,MOUN*% +%TO.N,N/C*% +X195605000Y-94060000D03* +D16* +%TO.P,J2,4*% +%TO.N,Net-(A1-Pad29)*% +X204480000Y-107790000D03* +%TO.P,J2,2*% +%TO.N,Net-(A1-Pad26)*% +X201930000Y-107790000D03* +%TO.P,J2,0*% +%TO.N,Net-(A1-Pad17)*% +X199380000Y-107790000D03* +%TO.P,J2,4*% +%TO.N,Net-(A1-Pad29)*% +X205180000Y-93310000D03* +X198680000Y-93310000D03* +%TO.P,J2,3*% +%TO.N,Net-(A1-Pad13)*% +X205180000Y-88810000D03* +X198680000Y-88810000D03* +%TD*% +D18* +%TO.N,Net-(A1-Pad15)*% +X157480000Y-78740000D03* +X147320000Y-78740000D03* +%TO.N,Net-(A1-Pad14)*% +X153670000Y-81280000D03* +X147320000Y-81280000D03* +%TO.N,Net-(A1-Pad29)*% +X190575000Y-98985000D03* +X204480000Y-99050000D03* +%TO.N,Net-(A1-Pad13)*% +X158750000Y-83820000D03* +X147320000Y-83820000D03* +%TO.N,Net-(A1-Pad11)*% +X147320000Y-88900000D03* +X151130000Y-88900000D03* +%TO.N,Net-(A1-Pad26)*% +X121920000Y-115570000D03* +X121920000Y-110490000D03* +%TO.N,Net-(A1-Pad10)*% +X147320000Y-91440000D03* +X152400000Y-91440000D03* +%TO.N,Net-(A1-Pad25)*% +X123190000Y-104140000D03* +X123190000Y-115570000D03* +%TO.N,Net-(A1-Pad24)*% +X120650000Y-110490000D03* +X120650000Y-115570000D03* +%TD*% +D19* +%TO.N,Net-(A1-Pad16)*% +X153670000Y-101600000D02* +X154940000Y-100330000D01* +X154940000Y-100330000D02* +X154940000Y-86360000D01* +X154940000Y-86360000D02* +X154940000Y-78740000D01* +X154940000Y-78740000D02* +X154940000Y-77470000D01* +X154940000Y-77470000D02* +X153670000Y-76200000D01* +X125730000Y-78740000D02* +X127000000Y-78740000D01* +X127000000Y-78740000D02* +X129540000Y-76200000D01* +X129540000Y-76200000D02* +X153670000Y-76200000D01* +%TO.N,Net-(A1-Pad15)*% +X156210000Y-101600000D02* +X157480000Y-100330000D01* +X157480000Y-100330000D02* +X157480000Y-95250000D01* +X157480000Y-95250000D02* +X157480000Y-78740000D01* +X140970000Y-78740000D02* +X147320000Y-78740000D01* +X157480000Y-78740000D02* +X157480000Y-78740000D01* +X147320000Y-78740000D02* +X147320000Y-78740000D01* +%TO.N,Net-(A1-Pad30)*% +X132080000Y-123190000D02* +X125730000Y-116840000D01* +X125730000Y-114300000D02* +X125730000Y-116840000D01* +X132080000Y-123190000D02* +X152400000Y-123190000D01* +X152400000Y-114370000D02* +X151120000Y-113090000D01* +X152400000Y-123190000D02* +X152400000Y-114370000D01* +%TO.N,Net-(A1-Pad14)*% +X153670000Y-99060000D02* +X153670000Y-81280000D01* +X140970000Y-81280000D02* +X147320000Y-81280000D01* +X153670000Y-81280000D02* +X153670000Y-81280000D01* +X147320000Y-81280000D02* +X147320000Y-81280000D01* +%TO.N,Net-(A1-Pad29)*% +X97950000Y-103827642D02* +X103126359Y-109004001D01* +X108015999Y-109004001D02* +X109230000Y-107790000D01* +X97950000Y-101610000D02* +X97950000Y-103827642D01* +X109930000Y-93310000D02* +X103430000Y-93310000D01* +X198680000Y-93310000D02* +X205180000Y-93310000D01* +X204480000Y-94010000D02* +X205180000Y-93310000D01* +X204480000Y-107790000D02* +X204480000Y-99050000D01* +X133350000Y-121920000D02* +X147320000Y-121920000D01* +X109230000Y-107790000D02* +X112870000Y-107790000D01* +X112870000Y-107790000D02* +X113030000Y-107950000D01* +X105344001Y-108854001D02* +X105194001Y-109004001D01* +X105344001Y-97895999D02* +X105344001Y-108854001D01* +X109930000Y-93310000D02* +X105344001Y-97895999D01* +X103126359Y-109004001D02* +X105194001Y-109004001D01* +X105194001Y-109004001D02* +X108015999Y-109004001D01* +X125730000Y-111760000D02* +X116840000Y-111760000D01* +X116840000Y-111760000D02* +X113030000Y-107950000D01* +X133350000Y-119380000D02* +X133350000Y-121920000D01* +X125730000Y-111760000D02* +X133350000Y-119380000D01* +X149040009Y-104590009D02* +X148590000Y-104140000D01* +X148590000Y-101600000D02* +X148590000Y-104140000D01* +X193200000Y-101610000D02* +X190575000Y-98985000D01* +X188550010Y-96960010D02* +X165296400Y-96960010D01* +X165296400Y-96960010D02* +X157666401Y-104590009D01* +X157666401Y-104590009D02* +X149040009Y-104590009D01* +X148590000Y-118060000D02* +X151120000Y-120590000D01* +X148590000Y-104140000D02* +X148590000Y-118060000D01* +X151120000Y-120590000D02* +X148650000Y-120590000D01* +X148650000Y-120590000D02* +X147320000Y-121920000D01* +X190575000Y-98985000D02* +X188550010Y-96960010D01* +X204480000Y-99050000D02* +X204480000Y-94010000D01* +%TO.N,Net-(A1-Pad13)*% +X205180000Y-88810000D02* +X198680000Y-88810000D01* +X140970000Y-83820000D02* +X147320000Y-83820000D01* +X198680000Y-88810000D02* +X163740000Y-88810000D01* +X163740000Y-88810000D02* +X158750000Y-83820000D01* +X158750000Y-83820000D02* +X158750000Y-83820000D01* +X147320000Y-83820000D02* +X147320000Y-83820000D01* +%TO.N,Net-(A1-Pad12)*% +X103430000Y-88810000D02* +X109930000Y-88810000D01* +X139844999Y-87485001D02* +X140970000Y-86360000D01* +X111254999Y-87485001D02* +X139844999Y-87485001D01* +X109930000Y-88810000D02* +X111254999Y-87485001D01* +%TO.N,Net-(A1-Pad11)*% +X140970000Y-88900000D02* +X147320000Y-88900000D01* +X151130000Y-99060000D02* +X151130000Y-88900000D01* +X147320000Y-88900000D02* +X147320000Y-88900000D01* +X151130000Y-88900000D02* +X151130000Y-88900000D01* +%TO.N,Net-(A1-Pad26)*% +X201930000Y-107790000D02* +X182720000Y-127000000D01* +X182720000Y-127000000D02* +X129540000Y-127000000D01* +X129540000Y-127000000D02* +X121920000Y-119380000D01* +X121920000Y-119380000D02* +X121920000Y-115570000D01* +X121920000Y-107950000D02* +X121920000Y-110490000D01* +X121920000Y-115570000D02* +X121920000Y-115570000D01* +X121920000Y-107950000D02* +X125730000Y-104140000D01* +%TO.N,Net-(A1-Pad10)*% +X151130000Y-101600000D02* +X152400000Y-100330000D01* +X152400000Y-100330000D02* +X152400000Y-92710000D01* +X152400000Y-92710000D02* +X152400000Y-91440000D01* +X140970000Y-91440000D02* +X147320000Y-91440000D01* +X147320000Y-91440000D02* +X147320000Y-91440000D01* +X152400000Y-91440000D02* +X152400000Y-91440000D01* +%TO.N,Net-(A1-Pad25)*% +X193200000Y-99060000D02* +X194414001Y-100274001D01* +X194414001Y-103078357D02* +X186690000Y-110802358D01* +X194414001Y-100274001D02* +X194414001Y-103078357D01* +X186690000Y-110802358D02* +X186690000Y-119380000D01* +X186690000Y-119380000D02* +X184392999Y-121677001D01* +X184392999Y-121677001D02* +X181610000Y-124460000D01* +X181610000Y-124460000D02* +X180340000Y-125730000D01* +X180340000Y-125730000D02* +X132080000Y-125730000D01* +X132080000Y-125730000D02* +X125730000Y-119380000D01* +X125730000Y-119380000D02* +X123190000Y-116840000D01* +X123190000Y-116840000D02* +X123190000Y-115570000D01* +X123190000Y-115570000D02* +X123190000Y-115570000D01* +X123190000Y-104140000D02* +X125730000Y-101600000D01* +%TO.N,Net-(A1-Pad24)*% +X120650000Y-102870000D02* +X120650000Y-110490000D01* +X120650000Y-115570000D02* +X120650000Y-115570000D01* +X120650000Y-102870000D02* +X124460000Y-99060000D01* +X124460000Y-99060000D02* +X125730000Y-99060000D01* +X96520000Y-99060000D02* +X97950000Y-99060000D01* +X120650000Y-116586000D02* +X119888000Y-117348000D01* +X120650000Y-115570000D02* +X120650000Y-116586000D01* +X119888000Y-117348000D02* +X105918000Y-117348000D01* +X105918000Y-117348000D02* +X95250000Y-106680000D01* +X95250000Y-100330000D02* +X96520000Y-99060000D01* +X95250000Y-106680000D02* +X95250000Y-100330000D01* +%TO.N,Net-(A1-Pad23)*% +X107950000Y-99060000D02* +X106680000Y-100330000D01* +X106680000Y-100330000D02* +X106680000Y-107790000D01* +X125730000Y-96520000D02* +X110490000Y-96520000D01* +X110490000Y-96520000D02* +X107950000Y-99060000D01* +%TO.N,Net-(A1-Pad17)*% +X195605000Y-98917000D02* +X195605000Y-104060000D01* +X193198000Y-96510000D02* +X195605000Y-98917000D01* +X199335000Y-107790000D02* +X199380000Y-107790000D01* +X195605000Y-104060000D02* +X199335000Y-107790000D01* +X102870000Y-83820000D02* +X97790000Y-88900000D01* +X97948000Y-89058000D02* +X97948000Y-96510000D01* +X97790000Y-88900000D02* +X97948000Y-89058000D01* +X100400000Y-104060000D02* +X100355000Y-104060000D01* +X104130000Y-107790000D02* +X100400000Y-104060000D01* +X100355000Y-98917000D02* +X100355000Y-104060000D01* +X97948000Y-96510000D02* +X100355000Y-98917000D01* +X165110000Y-96510000D02* +X193198000Y-96510000D01* +X157480000Y-104140000D02* +X165110000Y-96510000D01* +X151130000Y-104140000D02* +X157480000Y-104140000D01* +X123190000Y-83820000D02* +X125730000Y-81280000D01* +X102870000Y-83820000D02* +X123190000Y-83820000D01* +X151130000Y-104140000D02* +X149860000Y-102870000D01* +X149860000Y-100330000D02* +X148590000Y-99060000D01* +X149860000Y-102870000D02* +X149860000Y-100330000D01* +X148590000Y-99060000D02* +X148590000Y-82550000D01* +X127000000Y-82550000D02* +X125730000Y-81280000D01* +X148590000Y-82550000D02* +X127000000Y-82550000D01* +%TO.N,Net-(U2-Pad3)*% +X180990000Y-112460000D02* +X181620000Y-113090000D01* +X180990000Y-98900000D02* +X180990000Y-112460000D01* +%TO.N,Net-(U2-Pad6)*% +X167430000Y-98900000D02* +X166990000Y-98900000D01* +X166990000Y-105960000D02* +X181620000Y-120590000D01* +X166990000Y-98900000D02* +X166990000Y-105960000D01* +%TD*% +M02* diff --git a/cad/n/cad-F_Mask.gbr b/cad/n/cad-F_Mask.gbr new file mode 100644 index 0000000..d4033f2 --- /dev/null +++ b/cad/n/cad-F_Mask.gbr @@ -0,0 +1,145 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Soldermask,Top*% +%TF.FilePolarity,Negative*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%ADD10O,1.900000X1.900000*% +%ADD11R,1.900000X1.900000*% +%ADD12C,1.624000*% +%ADD13C,4.100000*% +%ADD14O,1.300000X2.100000*% +%ADD15O,1.700000X1.700000*% +%ADD16R,1.700000X1.700000*% +%ADD17C,1.878000*% +%ADD18C,2.386000*% +G04 APERTURE END LIST* +D10* +%TO.C,D1*% +X200406000Y-113030000D03* +D11* +X200406000Y-125730000D03* +%TD*% +D12* +%TO.C,U4*% +X190174000Y-114300000D03* +X117674000Y-114300000D03* +%TD*% +D13* +%TO.C,REF\u002A\u002A*% +X208280000Y-123444000D03* +%TD*% +%TO.C,REF\u002A\u002A*% +X208280000Y-78740000D03* +%TD*% +%TO.C,REF\u002A\u002A*% +X98044000Y-123444000D03* +%TD*% +%TO.C,REF\u002A\u002A*% +X98044000Y-78740000D03* +%TD*% +D14* +%TO.C,U1*% +X156210000Y-101600000D03* +X156210000Y-99060000D03* +X153670000Y-101600000D03* +X153670000Y-99060000D03* +X151130000Y-101600000D03* +X151130000Y-99060000D03* +X148590000Y-101600000D03* +X148590000Y-99060000D03* +%TD*% +D12* +%TO.C,U3*% +X151120000Y-120590000D03* +X151120000Y-113090000D03* +X181620000Y-120590000D03* +X181620000Y-113090000D03* +%TD*% +%TO.C,U2*% +X170240000Y-98900000D03* +X166990000Y-98900000D03* +X177740000Y-98900000D03* +X180990000Y-98900000D03* +X180990000Y-76400000D03* +X166990000Y-76400000D03* +%TD*% +D15* +%TO.C,A1*% +X125730000Y-78740000D03* +X140970000Y-78740000D03* +X125730000Y-114300000D03* +X140970000Y-81280000D03* +X125730000Y-111760000D03* +X140970000Y-83820000D03* +X125730000Y-109220000D03* +X140970000Y-86360000D03* +X125730000Y-106680000D03* +X140970000Y-88900000D03* +X125730000Y-104140000D03* +X140970000Y-91440000D03* +X125730000Y-101600000D03* +X140970000Y-93980000D03* +X125730000Y-99060000D03* +X140970000Y-96520000D03* +X125730000Y-96520000D03* +X140970000Y-99060000D03* +X125730000Y-93980000D03* +X140970000Y-101600000D03* +X125730000Y-91440000D03* +X140970000Y-104140000D03* +X125730000Y-88900000D03* +X140970000Y-106680000D03* +X125730000Y-86360000D03* +X140970000Y-109220000D03* +X125730000Y-83820000D03* +X140970000Y-111760000D03* +X125730000Y-81280000D03* +D16* +X140970000Y-114300000D03* +%TD*% +D17* +%TO.C,J1*% +X97950000Y-101610000D03* +X97950000Y-99060000D03* +X97948000Y-96510000D03* +D18* +X113005000Y-94060000D03* +X113005000Y-104060000D03* +X100355000Y-104060000D03* +X100355000Y-94060000D03* +D17* +X109230000Y-107790000D03* +X106680000Y-107790000D03* +X104130000Y-107790000D03* +X109930000Y-93310000D03* +X103430000Y-93310000D03* +X109930000Y-88810000D03* +X103430000Y-88810000D03* +%TD*% +%TO.C,J2*% +X193200000Y-101610000D03* +X193200000Y-99060000D03* +X193198000Y-96510000D03* +D18* +X208255000Y-94060000D03* +X208255000Y-104060000D03* +X195605000Y-104060000D03* +X195605000Y-94060000D03* +D17* +X204480000Y-107790000D03* +X201930000Y-107790000D03* +X199380000Y-107790000D03* +X205180000Y-93310000D03* +X198680000Y-93310000D03* +X205180000Y-88810000D03* +X198680000Y-88810000D03* +%TD*% +M02* diff --git a/cad/n/cad-F_Paste.gbr b/cad/n/cad-F_Paste.gbr new file mode 100644 index 0000000..0c9baaa --- /dev/null +++ b/cad/n/cad-F_Paste.gbr @@ -0,0 +1,54 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Paste,Top*% +%TF.FilePolarity,Positive*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%ADD10C,1.778000*% +%ADD11C,2.286000*% +G04 APERTURE END LIST* +D10* +%TO.C,J1*% +X97950000Y-101610000D03* +X97950000Y-99060000D03* +X97948000Y-96510000D03* +D11* +X113005000Y-94060000D03* +X113005000Y-104060000D03* +X100355000Y-104060000D03* +X100355000Y-94060000D03* +D10* +X109230000Y-107790000D03* +X106680000Y-107790000D03* +X104130000Y-107790000D03* +X109930000Y-93310000D03* +X103430000Y-93310000D03* +X109930000Y-88810000D03* +X103430000Y-88810000D03* +%TD*% +%TO.C,J2*% +X193200000Y-101610000D03* +X193200000Y-99060000D03* +X193198000Y-96510000D03* +D11* +X208255000Y-94060000D03* +X208255000Y-104060000D03* +X195605000Y-104060000D03* +X195605000Y-94060000D03* +D10* +X204480000Y-107790000D03* +X201930000Y-107790000D03* +X199380000Y-107790000D03* +X205180000Y-93310000D03* +X198680000Y-93310000D03* +X205180000Y-88810000D03* +X198680000Y-88810000D03* +%TD*% +M02* diff --git a/cad/n/cad-F_SilkS.gbr b/cad/n/cad-F_SilkS.gbr new file mode 100644 index 0000000..56ebe18 --- /dev/null +++ b/cad/n/cad-F_SilkS.gbr @@ -0,0 +1,175 @@ +%TF.GenerationSoftware,KiCad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1*% +%TF.CreationDate,2020-09-20T23:53:53-07:00*% +%TF.ProjectId,cad,6361642e-6b69-4636-9164-5f7063625858,rev?*% +%TF.SameCoordinates,Original*% +%TF.FileFunction,Legend,Top*% +%TF.FilePolarity,Positive*% +%FSLAX46Y46*% +G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* +G04 Created by KiCad (PCBNEW 5.1.6-c6e7f7d~87~ubuntu18.04.1) date 2020-09-20 23:53:53* +%MOMM*% +%LPD*% +G01* +G04 APERTURE LIST* +%ADD10C,0.120000*% +%ADD11C,0.203200*% +%ADD12C,0.101600*% +%ADD13C,0.150000*% +G04 APERTURE END LIST* +D10* +%TO.C,D1*% +X198936000Y-121320000D02* +X201876000Y-121320000D01* +X198936000Y-121080000D02* +X201876000Y-121080000D01* +X198936000Y-121200000D02* +X201876000Y-121200000D01* +X200406000Y-114170000D02* +X200406000Y-116660000D01* +X200406000Y-124590000D02* +X200406000Y-122100000D01* +X198936000Y-116660000D02* +X198936000Y-122100000D01* +X201876000Y-116660000D02* +X198936000Y-116660000D01* +X201876000Y-122100000D02* +X201876000Y-116660000D01* +X198936000Y-122100000D02* +X201876000Y-122100000D01* +%TO.C,U1*% +X146900000Y-102830000D02* +X146900000Y-103330000D01* +X146900000Y-103330000D02* +X160900000Y-103330000D01* +X160900000Y-103330000D02* +X160900000Y-75330000D01* +X146900000Y-102830000D02* +X146900000Y-75330000D01* +X146900000Y-75330000D02* +X160900000Y-75330000D01* +%TO.C,U3*% +X148120000Y-124840000D02* +X184620000Y-124840000D01* +X148120000Y-108340000D02* +X148120000Y-124840000D01* +X184620000Y-108340000D02* +X184620000Y-124840000D01* +X148120000Y-108340000D02* +X184620000Y-108340000D01* +%TO.C,U2*% +X182490000Y-102900000D02* +X165490000Y-102900000D01* +X182490000Y-74900000D02* +X182490000Y-102900000D01* +X165490000Y-74900000D02* +X165490000Y-102900000D01* +X173990000Y-74900000D02* +X165490000Y-74900000D01* +X182490000Y-74900000D02* +X173990000Y-74900000D01* +X173990000Y-74900000D02* +X182490000Y-74900000D01* +%TO.C,A1*% +X124330000Y-118240000D02* +X142370000Y-118240000D01* +X124330000Y-74800000D02* +X124330000Y-118240000D01* +X142370000Y-74800000D02* +X124330000Y-74800000D01* +X139700000Y-77470000D02* +X142370000Y-77470000D01* +X139700000Y-113030000D02* +X139700000Y-77470000D01* +X139700000Y-113030000D02* +X142370000Y-113030000D01* +X127000000Y-77470000D02* +X124330000Y-77470000D01* +X127000000Y-115570000D02* +X127000000Y-77470000D01* +X127000000Y-115570000D02* +X124330000Y-115570000D01* +X142370000Y-118240000D02* +X142370000Y-115570000D01* +X142370000Y-113030000D02* +X142370000Y-74800000D01* +X139700000Y-115570000D02* +X142370000Y-115570000D01* +X139700000Y-113030000D02* +X139700000Y-115570000D01* +D11* +%TO.C,J1*% +X104775000Y-93220000D02* +X106045000Y-93220000D01* +X106045000Y-93220000D02* +X107315000Y-92585000D01* +X107315000Y-93220000D02* +X108585000Y-93220000D01* +D12* +X115660256Y-99060000D02* +G75* +G03* +X115660256Y-99060000I-8980256J0D01* +G01* +D11* +%TO.C,J2*% +X200025000Y-93220000D02* +X201295000Y-93220000D01* +X201295000Y-93220000D02* +X202565000Y-92585000D01* +X202565000Y-93220000D02* +X203835000Y-93220000D01* +D12* +X210910256Y-99060000D02* +G75* +G03* +X210910256Y-99060000I-8980256J0D01* +G01* +%TO.C,D1*% +D13* +X198388380Y-120118095D02* +X197388380Y-120118095D01* +X197388380Y-119880000D01* +X197436000Y-119737142D01* +X197531238Y-119641904D01* +X197626476Y-119594285D01* +X197816952Y-119546666D01* +X197959809Y-119546666D01* +X198150285Y-119594285D01* +X198245523Y-119641904D01* +X198340761Y-119737142D01* +X198388380Y-119880000D01* +X198388380Y-120118095D01* +X198388380Y-118594285D02* +X198388380Y-119165714D01* +X198388380Y-118880000D02* +X197388380Y-118880000D01* +X197531238Y-118975238D01* +X197626476Y-119070476D01* +X197674095Y-119165714D01* +X198958380Y-125991904D02* +X197958380Y-125991904D01* +X198958380Y-125420476D02* +X198386952Y-125849047D01* +X197958380Y-125420476D02* +X198529809Y-125991904D01* +%TO.C,J2*% +D12* +X199601666Y-102809523D02* +X199601666Y-103716666D01* +X199541190Y-103898095D01* +X199420238Y-104019047D01* +X199238809Y-104079523D01* +X199117857Y-104079523D01* +X200145952Y-102930476D02* +X200206428Y-102870000D01* +X200327380Y-102809523D01* +X200629761Y-102809523D01* +X200750714Y-102870000D01* +X200811190Y-102930476D01* +X200871666Y-103051428D01* +X200871666Y-103172380D01* +X200811190Y-103353809D01* +X200085476Y-104079523D01* +X200871666Y-104079523D01* +%TD*% +M02* diff --git a/cad/n/cad-NPTH.drl b/cad/n/cad-NPTH.drl new file mode 100644 index 0000000..a7cdf42 --- /dev/null +++ b/cad/n/cad-NPTH.drl @@ -0,0 +1,19 @@ +M48 +; DRILL file {KiCad 5.1.6-c6e7f7d~87~ubuntu18.04.1} date Sun Sep 20 23:52:09 2020 +; FORMAT={-:-/ absolute / inch / decimal} +; #@! TF.CreationDate,2020-09-20T23:52:09-07:00 +; #@! TF.GenerationSoftware,Kicad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1 +; #@! TF.FileFunction,NonPlated,1,2,NPTH +FMAT,2 +INCH +T1C0.1575 +% +G90 +G05 +T1 +X3.86Y-3.1 +X3.86Y-4.86 +X8.2Y-3.1 +X8.2Y-4.86 +T0 +M30 diff --git a/cad/n/cad-PTH.drl b/cad/n/cad-PTH.drl new file mode 100644 index 0000000..a6f9413 --- /dev/null +++ b/cad/n/cad-PTH.drl @@ -0,0 +1,125 @@ +M48 +; DRILL file {KiCad 5.1.6-c6e7f7d~87~ubuntu18.04.1} date Sun Sep 20 23:52:09 2020 +; FORMAT={-:-/ absolute / inch / decimal} +; #@! TF.CreationDate,2020-09-20T23:52:09-07:00 +; #@! TF.GenerationSoftware,Kicad,Pcbnew,5.1.6-c6e7f7d~87~ubuntu18.04.1 +; #@! TF.FileFunction,Plated,1,2,PTH +FMAT,2 +INCH +T1C0.0157 +T2C0.0300 +T3C0.0315 +T4C0.0354 +T5C0.0394 +T6C0.0472 +T7C0.0591 +% +G90 +G05 +T1 +X4.75Y-4.35 +X4.75Y-4.55 +X4.8Y-4.35 +X4.8Y-4.55 +X4.85Y-4.1 +X4.85Y-4.55 +X5.8Y-3.1 +X5.8Y-3.2 +X5.8Y-3.3 +X5.8Y-3.5 +X5.8Y-3.6 +X5.95Y-3.5 +X6.0Y-3.6 +X6.05Y-3.2 +X6.2Y-3.1 +X6.25Y-3.3 +X7.503Y-3.897 +X8.0504Y-3.8996 +T2 +X6.5744Y-3.0079 +X6.5744Y-3.8937 +X6.7024Y-3.8937 +X6.9976Y-3.8937 +X7.1256Y-3.0079 +X7.1256Y-3.8937 +X5.9496Y-4.4524 +X5.9496Y-4.7476 +X7.1504Y-4.4524 +X7.1504Y-4.7476 +X4.6328Y-4.5 +X7.4872Y-4.5 +T3 +X5.85Y-3.9 +X5.85Y-4.0 +X5.95Y-3.9 +X5.95Y-4.0 +X6.05Y-3.9 +X6.05Y-4.0 +X6.15Y-3.9 +X6.15Y-4.0 +T4 +X7.89Y-4.45 +X7.89Y-4.95 +T5 +X3.8562Y-3.7996 +X3.8563Y-3.9 +X3.8563Y-4.0004 +X4.0996Y-4.2437 +X4.2Y-4.2437 +X4.3004Y-4.2437 +X4.95Y-3.1 +X4.95Y-3.2 +X4.95Y-3.3 +X4.95Y-3.4 +X4.95Y-3.5 +X4.95Y-3.6 +X4.95Y-3.7 +X4.95Y-3.8 +X4.95Y-3.9 +X4.95Y-4.0 +X4.95Y-4.1 +X4.95Y-4.2 +X4.95Y-4.3 +X4.95Y-4.4 +X4.95Y-4.5 +X5.55Y-3.1 +X5.55Y-3.2 +X5.55Y-3.3 +X5.55Y-3.4 +X5.55Y-3.5 +X5.55Y-3.6 +X5.55Y-3.7 +X5.55Y-3.8 +X5.55Y-3.9 +X5.55Y-4.0 +X5.55Y-4.1 +X5.55Y-4.2 +X5.55Y-4.3 +X5.55Y-4.4 +X5.55Y-4.5 +X7.6062Y-3.7996 +X7.6063Y-3.9 +X7.6063Y-4.0004 +X7.8496Y-4.2437 +X7.95Y-4.2437 +X8.0504Y-4.2437 +T6 +X4.072Y-3.4965 +X4.072Y-3.6736 +X4.328Y-3.4965 +X4.328Y-3.6736 +X7.822Y-3.4965 +X7.822Y-3.6736 +X8.078Y-3.4965 +X8.078Y-3.6736 +T7 +X3.951Y-3.7031 +X3.951Y-4.0969 +X4.449Y-3.7031 +X4.449Y-4.0969 +X7.701Y-3.7031 +X7.701Y-4.0969 +X8.199Y-3.7031 +X8.199Y-4.0969 +T0 +M30 diff --git a/cad/n/cad-job.gbrjob b/cad/n/cad-job.gbrjob new file mode 100644 index 0000000..bfa672f --- /dev/null +++ b/cad/n/cad-job.gbrjob @@ -0,0 +1,126 @@ +{ + "Header": + { + "GenerationSoftware": + { + "Vendor": "KiCad", + "Application": "Pcbnew", + "Version": "5.1.6-c6e7f7d~87~ubuntu18.04.1" + }, + "CreationDate": "2020-09-20T23:53:53-07:00" + }, + "GeneralSpecs": + { + "ProjectId": + { + "Name": "cad", + "GUID": "6361642e-6b69-4636-9164-5f7063625858", + "Revision": "rev?" + }, + "Size": + { + "X": 119.430, + "Y": 53.898 + }, + "LayerNumber": 2, + "BoardThickness": 1.600 + }, + "DesignRules": + [ + { + "Layers": "Outer", + "PadToPad": 0.200, + "PadToTrack": 0.200, + "TrackToTrack": 0.200, + "MinLineWidth": 0.250 + } + ], + "FilesAttributes": + [ + { + "Path": "cad-F_Cu.gbr", + "FileFunction": "Copper,L1,Top", + "FilePolarity": "Positive" + }, + { + "Path": "cad-B_Cu.gbr", + "FileFunction": "Copper,L2,Bot", + "FilePolarity": "Positive" + }, + { + "Path": "cad-F_Paste.gbr", + "FileFunction": "SolderPaste,Top", + "FilePolarity": "Positive" + }, + { + "Path": "cad-B_Paste.gbr", + "FileFunction": "SolderPaste,Bot", + "FilePolarity": "Positive" + }, + { + "Path": "cad-F_SilkS.gbr", + "FileFunction": "Legend,Top", + "FilePolarity": "Positive" + }, + { + "Path": "cad-B_SilkS.gbr", + "FileFunction": "Legend,Bot", + "FilePolarity": "Positive" + }, + { + "Path": "cad-F_Mask.gbr", + "FileFunction": "SolderMask,Top", + "FilePolarity": "Negative" + }, + { + "Path": "cad-B_Mask.gbr", + "FileFunction": "SolderMask,Bot", + "FilePolarity": "Negative" + }, + { + "Path": "cad-Edge_Cuts.gbr", + "FileFunction": "Profile", + "FilePolarity": "Positive" + } + ], + "MaterialStackup": + [ + { + "Type": "Legend", + "Notes": "Layer F.SilkS" + }, + { + "Type": "SolderPaste", + "Notes": "Layer F.Paste" + }, + { + "Type": "SolderMask", + "Notes": "Layer F.Mask" + }, + { + "Type": "Copper", + "Notes": "Layer F.Cu" + }, + { + "Type": "Dielectric", + "Material": "FR4", + "Notes": "Layers L1/L2" + }, + { + "Type": "Copper", + "Notes": "Layer B.Cu" + }, + { + "Type": "SolderMask", + "Notes": "Layer B.Mask" + }, + { + "Type": "SolderPaste", + "Notes": "Layer B.Paste" + }, + { + "Type": "Legend", + "Notes": "Layer B.SilkS" + } + ] +} diff --git a/dozer_main.cpp b/dozer_main.cpp index ebdfcd7..a0c2453 100644 --- a/dozer_main.cpp +++ b/dozer_main.cpp @@ -5,7 +5,7 @@ #include #include #include -#include "SoftPWM.h" +#include #include #include @@ -33,70 +33,267 @@ public: const uint64_t dozer_pipe = 0xF0F0F0F0D2LL; const uint64_t remote_pipe = 0xF0F0F0F0E1LL; +#pragma pack(8) struct StickValues { - uint32_t stick_1_a; - uint32_t stick_1_b; - uint32_t stick_2_a; - uint32_t stick_2_b; + int16_t stick_1_y; + int16_t stick_1_x; + int16_t stick_2_y; + int16_t stick_2_x; }; +#define R_TRK_FWD 18 +#define L_TRK_FWD 17 +#define R_TRK_BKW 19 +#define L_TRK_BKW 16 +#define BKT_FWD 14 +#define BKT_BKW 15 + +#define PI 3.141592654 +#define DEG(rad) (rad*180.0/PI) + +#define FULL_SPEED_ZONE 5 +#define MAGIC_45_2_100 2.22222 +#define MAG_SCALER_H 200 +#define MAG_SCALER_L 290 + int main() { + init(); + initVariant(); + SPI.begin(); + Serial.begin(9600); - pinMode(4, OUTPUT); - pinMode(5, OUTPUT); + pinMode(GREEN, OUTPUT); + pinMode(RED, OUTPUT); - uart_init(); SoftPWMBegin(); RF24 radio(CE_PIN, CS_PIN); radio.begin(); + radio.setPALevel (RF24_PA_MAX); + radio.setChannel(100); + radio.setDataRate(RF24_1MBPS); radio.openWritingPipe(dozer_pipe); radio.openReadingPipe(1, remote_pipe); radio.startListening(); - //digitalWrite(18, HIGH); - // SoftPWMSet(18, 255, 1); - - - digitalWrite(GREEN, HIGH); - _delay_ms(2000); - digitalWrite(GREEN, LOW); - bool breaking = false; int cycles = 0; + while (!breaking) { - //unsigned long start_wait = micros(); bool timeout = false; while (!radio.available()) { + delay(5); if (cycles++ > 10) { - digitalWrite(RED, HIGH); - _delay_ms(50); - digitalWrite(RED, LOW); - _delay_ms(50); + // digitalWrite(RED, HIGH); + _delay_ms(1); + // digitalWrite(RED, LOW); + _delay_ms(1); timeout = true; cycles = 0; break; } - } if (timeout) { -// SoftPWMSet(17, 0); -// SoftPWMSet(18, 0); + SoftPWMSet(14, 0); // bucket + SoftPWMSet(15, 0); // bucket + SoftPWMSet(16, 0); // left track backward + SoftPWMSet(17, 0); // left track forward + SoftPWMSet(19, 0); // right track backward + SoftPWMSet(18, 0); // right track forward } else { + cycles = 0; + StickValues stick_values{}; + if (radio.read(&stick_values, sizeof(int16_t)*4)) { +// digitalWrite(GREEN, HIGH); +// _delay_ms(5); +// digitalWrite(GREEN, LOW); +// _delay_ms(5); + //Serial.println((int16_t)stick_values.stick_1_y); + } - StickValues stick_values; - radio.read(&stick_values, sizeof(uint32_t)*4); radio.flush_rx(); - radio.flush_tx(); -// SoftPWMSet(17, stick_values.stick_1_a); -// SoftPWMSet(18, stick_values.stick_1_b); - } + if (stick_values.stick_1_y > 10) { + digitalWrite(GREEN, HIGH); + digitalWrite(RED, LOW); + } else if (stick_values.stick_1_y < -10) { + digitalWrite(RED, HIGH); + digitalWrite(GREEN, LOW); + } else { + digitalWrite(RED, LOW); + digitalWrite(GREEN, LOW); + } + + + float mag = sqrt(pow(stick_values.stick_1_x, 2) + pow(stick_values.stick_1_y, 2)); + float ang = DEG(atan2((float)stick_values.stick_1_x, (float)stick_values.stick_1_y)) + 180; + + int right_track = 0; + int left_track = 0; + + if (ang >= 0 && ang < 90 && mag > 1) { // Bottom to Left Quad. RT:F + if (ang < 0 + FULL_SPEED_ZONE) + right_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + else if (ang > 90 - FULL_SPEED_ZONE) + right_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else // split it (and mult) so it's ranged between -100, 100 then mag it + right_track = ((0 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + + left_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + } + if (ang >= 90 && ang < 180 && mag > 1) { // Top to Left Quad. RT:F, LT:S + right_track = (int)(100.0 * (mag/MAG_SCALER_H)); + + if (ang < 90 + FULL_SPEED_ZONE) + left_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + else if (ang > 180 - FULL_SPEED_ZONE) + left_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else + left_track = ((90 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + } + if (ang >= 180 && ang < 270 && mag > 1) { // Top to Right Quad + if (ang < 180 + FULL_SPEED_ZONE) + right_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else if (ang > 270 - FULL_SPEED_ZONE) + right_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + else + right_track = ((180 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); - SoftPWMSet(17, 80); - SoftPWMSet(18, 120); + left_track = (int)(100.0 * (mag/MAG_SCALER_H)); + } + if (ang >= 270 && ang <= 360 && mag > 1) { // Bottom to Right Quad + right_track = (int)(100.0 * (mag/MAG_SCALER_H)) * -1; + + if (ang < 270 + FULL_SPEED_ZONE) + left_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else if (ang > 360 - FULL_SPEED_ZONE) + left_track = (int)(100.0 * (mag/MAG_SCALER_H)) * -1; + else + left_track = ((270 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + } + +// if (ang >= 0 && ang < 90 && mag > 1) { +// if (ang < 0 + FULL_SPEED_ZONE) +// right_track = left_track = -100; +//// else if (ang > 90 - FULL_SPEED_ZONE) +//// right_track = left_track = -100; +// else +// right_track = ((270 + 45) - ang) * 2 * (mag/290); +// +// left_track = -100 * (int)(mag/290); +// } +// if (ang >= 90 && ang < 180 && mag > 1) { +// right_track = 100 * (mag/290); +// if (ang > 90 - FULL_SPEED_ZONE) { +// right_track = 100; +// left_track = -100; +// } +// else +// left_track = (135 - ang) * -2 * (mag/290); +// } +// if (ang >= 180 && ang < 270 && mag > 1) { +// if (ang > 180 - FULL_SPEED_ZONE) +// right_track = 100 * (mag/290); +// else +// right_track = ((180 + 45) - ang) * 2 * (mag/290); +// left_track = 100 * (mag/290); +// } +// if (ang >= 270 && ang <= 360 && mag > 1) { +// right_track = -100 * (mag/290); +// if (ang > 270 - FULL_SPEED_ZONE) { +// left_track = -100 * (mag/290); +// } else { +// left_track = ((270 + 45) - ang) * 2 * (mag/290); +// } +// } + + if (left_track > 0) { + SoftPWMSet(L_TRK_FWD, max(0, min(255, left_track))); + } else if (left_track < 0) { + SoftPWMSet(L_TRK_BKW, max(0, min(255, abs(left_track)))); + } else if (left_track == 0) { + SoftPWMSet(L_TRK_BKW, 0); + SoftPWMSet(L_TRK_FWD, 0); + } + + if (right_track > 0) { + SoftPWMSet(R_TRK_FWD, max(0, min(255, right_track))); + } else if (right_track < 0) { + SoftPWMSet(R_TRK_BKW, max(0, min(255, abs(right_track)))); + } else if (right_track == 0) { + SoftPWMSet(R_TRK_FWD, 0); + SoftPWMSet(R_TRK_BKW, 0); + } + + +// int forward_delta = 0; +// if (stick_values.stick_1_x > 10) { +// forward_delta = min(max(0, stick_values.stick_1_x), 255); +// +// } else if (stick_values.stick_1_x < -10) { +// forward_delta = min(max(-255, stick_values.stick_1_x), 0); +// } +// +// if (stick_values.stick_1_y > 10) { +// int delta = min(max(0, stick_values.stick_1_y), 255); +// if (forward_delta > 0) { +// SoftPWMSet(R_TRK_FWD, delta + forward_delta); +// } else if (forward_delta <= 0) { +// SoftPWMSet(R_TRK_BKW, delta + forward_delta); +// } +// SoftPWMSet(L_TRK_FWD, delta); +// } else if (stick_values.stick_1_y < -10) { +// int delta = min(max(0, abs(stick_values.stick_1_y)), 255); +// if (forward_delta > 0) { +// SoftPWMSet(L_TRK_FWD, delta + forward_delta); +// } else if (forward_delta <= 0) { +// SoftPWMSet(L_TRK_BKW, delta + forward_delta); +// } +// SoftPWMSet(R_TRK_FWD, delta); +// } else { +// +// if (forward_delta > 10) { +// SoftPWMSet(L_TRK_FWD, forward_delta); +// SoftPWMSet(R_TRK_FWD, forward_delta); +// } else if (forward_delta < 10) { +// SoftPWMSet(L_TRK_BKW, forward_delta); +// SoftPWMSet(R_TRK_BKW, forward_delta); +// } else { +// SoftPWMSet(R_TRK_FWD, 0); +// SoftPWMSet(R_TRK_BKW, 0); +// SoftPWMSet(L_TRK_BKW, 0); +// SoftPWMSet(L_TRK_FWD, 0); +// } +// } + + if (serialEventRun) serialEventRun(); + + } } } + + + + + + + + + + +//SoftPWMSet(14, 255); // bucket +//SoftPWMSet(15, 10); // bucket +//SoftPWMSet(16, 255); // left track backward +//SoftPWMSet(17, 255); // left track forward +//SoftPWMSet(19, 255); // right track backward +//SoftPWMSet(18, 255); // right track forward + +// SoftPWMSet(17, stick_values.stick_1_y); +// SoftPWMSet(18, stick_values.stick_1_x); +// SoftPWMSet(19, stick_values.stick_2_y); +// SoftPWMSet(20, stick_values.stick_2_x); +// SoftPWMSet(21, stick_values.stick_3_a); +// SoftPWMSet(22, stick_values.stick_3_b); \ No newline at end of file diff --git a/lib.h b/lib.h index 4727406..712c110 100644 --- a/lib.h +++ b/lib.h @@ -1,4 +1,12 @@ +#define PI 3.141592654 +#define DEG(rad) (rad*180.0/PI) + +#define FULL_SPEED_ZONE 5 +#define MAGIC_45_2_100 2.22222 +#define MAG_SCALER_H 200 +#define MAG_SCALER_L 290 + void uart_init() { // Upper and lower bytes of the calculated prescaler value for baud. UBRR0H = UBRRH_VALUE; diff --git a/listen-python b/listen-python index f02d8ab..cb3c672 100644 --- a/listen-python +++ b/listen-python @@ -3,10 +3,10 @@ import serial, string output = " " -ser = serial.Serial('/dev/ttyUSB0', 9600, 8, 'N', 1, timeout=1) +ser = serial.Serial('/dev/ttyUSB1', 9600, 8, 'N', 1, timeout=1) while True: while output != "": - output = ser.read(1) + output = ser.read(4) print len(output) try: print int(output) diff --git a/remote_main.cpp b/remote_main.cpp index 328c9d1..d45372e 100644 --- a/remote_main.cpp +++ b/remote_main.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include #include #include @@ -11,10 +11,8 @@ #include #include -#define CE_PIN 3 -#define CS_PIN 2 -#define RED 4 -#define GREEN 5 +#define CE_PIN 7 +#define CS_PIN 8 class Radio { @@ -32,44 +30,126 @@ public: const uint64_t dozer_pipe = 0xF0F0F0F0D2LL; const uint64_t remote_pipe = 0xF0F0F0F0E1LL; +#pragma pack(8) struct StickValues { - uint32_t stick_1_a; - uint32_t stick_1_b; - uint32_t stick_2_a; - uint32_t stick_2_b; + int16_t stick_1_y; + int16_t stick_1_x; + int16_t stick_2_y; + int16_t stick_2_x; }; -int main() { +#define PI 3.141592654 +#define DEG(rad) (rad*180.0/PI) - pinMode(4, OUTPUT); - pinMode(5, OUTPUT); +int main() { - uart_init(); + init(); + initVariant(); + SPI.begin(); + Serial.begin(9600); RF24 radio(CE_PIN, CS_PIN); radio.begin(); + radio.setChannel(100); + radio.setPALevel (RF24_PA_MAX); + radio.setDataRate(RF24_1MBPS); radio.openWritingPipe(remote_pipe); radio.openReadingPipe(1, dozer_pipe); radio.startListening(); - bool breaking = false; - while (!breaking) { + delay(1000); - _delay_ms(100); + int16_t ref_stick_1_y = analogRead(A4); // RY + int16_t ref_stick_1_x = analogRead(A5); // RX + int16_t ref_stick_2_y = analogRead(A6); // LY + int16_t ref_stick_2_x = analogRead(A7); // LX - // Get input + while (true) { // Parse into a struct StickValues stick_values; - stick_values.stick_1_a = 100; - stick_values.stick_1_b = 50; - stick_values.stick_2_a = 0; - stick_values.stick_2_b = 0; + stick_values.stick_1_y = analogRead(A5); // RY + stick_values.stick_1_x = analogRead(A4); // RX + stick_values.stick_2_y = analogRead(A6); // LY + stick_values.stick_2_x = analogRead(A7); // LX + + int16_t delta_1_y = stick_values.stick_1_y - ref_stick_1_y; + int16_t delta_1_x = ref_stick_1_x - stick_values.stick_1_x; + int16_t delta_2_y = stick_values.stick_2_y - ref_stick_2_y; + int16_t delta_2_x = stick_values.stick_2_x - ref_stick_2_x; + + stick_values.stick_1_y = delta_1_y / 2; + stick_values.stick_1_x = delta_1_x / 2; + stick_values.stick_2_y = delta_2_y / 2; + stick_values.stick_2_x = delta_2_x / 2; // Send to dozer radio.stopListening(); - radio.write(&stick_values, sizeof(uint32_t)*4); + delay(10); + if (radio.write(&stick_values, sizeof(int16_t)*4)) + { + float mag = sqrt(pow(stick_values.stick_1_x, 2) + pow(stick_values.stick_1_y, 2)); + float ang = DEG(atan2((float)stick_values.stick_1_x, (float)stick_values.stick_1_y)) + 180; + + int right_track = 0; + int left_track = 0; + + if (ang >= 0 && ang < 90 && mag > 1) { // Bottom to Left Quad. RT:F + if (ang < 0 + FULL_SPEED_ZONE) + right_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + else if (ang > 90 - FULL_SPEED_ZONE) + right_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else // split it (and mult) so it's ranged between -100, 100 then mag it + right_track = ((0 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + + left_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + } + if (ang >= 90 && ang < 180 && mag > 1) { // Top to Left Quad. RT:F, LT:S + right_track = (int)(100.0 * (mag/MAG_SCALER_H)); + + if (ang < 90 + FULL_SPEED_ZONE) + left_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + else if (ang > 180 - FULL_SPEED_ZONE) + left_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else + left_track = ((90 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + } + if (ang >= 180 && ang < 270 && mag > 1) { // Top to Right Quad + if (ang < 180 + FULL_SPEED_ZONE) + right_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else if (ang > 270 - FULL_SPEED_ZONE) + right_track = (int)(-100.0 * (mag/MAG_SCALER_H)); + else + right_track = ((180 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + + left_track = (int)(100.0 * (mag/MAG_SCALER_H)); + } + if (ang >= 270 && ang <= 360 && mag > 1) { // Bottom to Right Quad + right_track = (int)(100.0 * (mag/MAG_SCALER_H)) * -1; + + if (ang < 270 + FULL_SPEED_ZONE) + left_track = (int)(100.0 * (mag/MAG_SCALER_H)); + else if (ang > 360 - FULL_SPEED_ZONE) + left_track = (int)(100.0 * (mag/MAG_SCALER_H)) * -1; + else + left_track = ((270 + 45) - ang) * MAGIC_45_2_100 * (mag/MAG_SCALER_H); + } + + + //Serial.println(mag); + Serial.print(ang); + Serial.print(" : "); + Serial.print(mag); + Serial.print(" : ["); + Serial.print(left_track); + Serial.print(", "); + Serial.print(right_track); + Serial.println("]"); + + //Serial.println(""); + } radio.startListening(); + if (serialEventRun) serialEventRun(); } }