aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Madison <dmadison@users.noreply.github.com>2020-02-01 05:46:15 -0500
committerGitHub <noreply@github.com>2020-02-01 05:46:15 -0500
commit924299c159b619852d4c5eb1fc106db8a459d661 (patch)
tree39aad14af9ba55cc9f26f2920f6ff873552f4c62
parent59dd6085ec8ec0a5438c1019e982fefb77f485d3 (diff)
parent923b4441fed740c5ff1e42bb8f2f58ea87d4eaf7 (diff)
Merge pull request #6 from dmadison/upstream-updatesv1.0.1
Arduino Core 1.8.2
-rw-r--r--boards.txt18
-rw-r--r--bootloaders/caterina/Caterina-Genuino-Micro.hex257
-rw-r--r--bootloaders/caterina/Caterina-Genuino-Micro.txt19
-rw-r--r--cores/arduino/Arduino.h19
-rw-r--r--cores/arduino/Stream.cpp1
-rw-r--r--cores/arduino/USBAPI.h2
-rw-r--r--cores/arduino/USBCore.cpp6
-rw-r--r--cores/arduino/USBCore.h5
-rw-r--r--cores/arduino/WInterrupts.c85
-rw-r--r--cores/arduino/WString.cpp2
-rw-r--r--cores/arduino/new.cpp5
-rw-r--r--cores/arduino/new.h1
-rw-r--r--cores/arduino/wiring_shift.c11
-rw-r--r--libraries/SoftwareSerial/src/SoftwareSerial.cpp4
-rw-r--r--libraries/SoftwareSerial/src/SoftwareSerial.h9
-rw-r--r--libraries/Wire/examples/i2c_scanner/i2c_scanner.ino75
-rw-r--r--libraries/Wire/src/utility/twi.c2
17 files changed, 187 insertions, 334 deletions
diff --git a/boards.txt b/boards.txt
index a91e1a7..a860efb 100644
--- a/boards.txt
+++ b/boards.txt
@@ -120,7 +120,7 @@ leonardoeth.build.extra_flags={build.usb_flags}
##############################################################
-micro.name=Arduino/Genuino Micro w/ XInput
+micro.name=Arduino Micro w/ XInput
micro.vid.0=0x2341
micro.pid.0=0x0037
@@ -130,24 +130,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=0x045E
-micro.vid.4.build.pid=0x028E
-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=0x045E
-micro.vid.5.build.pid=0x028E
-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
@@ -382,7 +368,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/bootloaders/caterina/Caterina-Genuino-Micro.hex b/bootloaders/caterina/Caterina-Genuino-Micro.hex
deleted file mode 100644
index b658b28..0000000
--- a/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/bootloaders/caterina/Caterina-Genuino-Micro.txt b/bootloaders/caterina/Caterina-Genuino-Micro.txt
deleted file mode 100644
index fd29bd8..0000000
--- a/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/cores/arduino/Arduino.h b/cores/arduino/Arduino.h
index 09c1448..91eeb16 100644
--- a/cores/arduino/Arduino.h
+++ b/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/cores/arduino/Stream.cpp b/cores/arduino/Stream.cpp
index d284631..9eff663 100644
--- a/cores/arduino/Stream.cpp
+++ b/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/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index 0f7d171..47221b8 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -66,6 +66,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/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index 6e820a1..b384984 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -825,4 +825,10 @@ bool USBDevice_::wakeupHost()
return false;
}
+bool USBDevice_::isSuspended()
+{
+ return (_usbSuspendState & (1 << SUSPI));
+}
+
+
#endif /* if defined(USBCON) */
diff --git a/cores/arduino/USBCore.h b/cores/arduino/USBCore.h
index eafdbe5..578e1b8 100644
--- a/cores/arduino/USBCore.h
+++ b/cores/arduino/USBCore.h
@@ -87,6 +87,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
@@ -166,7 +169,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/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c
index cef1106..38ea158 100644
--- a/cores/arduino/WInterrupts.c
+++ b/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<<ISC60) | (1<<ISC61))) | (mode << ISC60);
EIMSK |= (1<<INT6);
break;
+#elif defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)
+ case 0:
+ EICRA = (EICRA & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00);
+ EIMSK |= (1 << INT0);
+ break;
+ case 1:
+ EICRA = (EICRA & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10);
+ EIMSK |= (1 << INT1);
+ break;
+ case 2:
+ EICRA = (EICRA & ~((1 << ISC20) | (1 << ISC21))) | (mode << ISC20);
+ EIMSK |= (1 << INT2);
+ break;
+ case 3:
+ EICRA = (EICRA & ~((1 << ISC30) | (1 << ISC31))) | (mode << ISC30);
+ EIMSK |= (1 << INT3);
+ break;
+ case 4:
+ EICRB = (EICRB & ~((1 << ISC40) | (1 << ISC41))) | (mode << ISC40);
+ EIMSK |= (1 << INT4);
+ break;
+ case 5:
+ EICRB = (EICRB & ~((1 << ISC50) | (1 << ISC51))) | (mode << ISC50);
+ EIMSK |= (1 << INT5);
+ break;
+ case 6:
+ EICRB = (EICRB & ~((1 << ISC60) | (1 << ISC61))) | (mode << ISC60);
+ EIMSK |= (1 << INT6);
+ break;
+ case 7:
+ EICRB = (EICRB & ~((1 << ISC70) | (1 << ISC71))) | (mode << ISC70);
+ EIMSK |= (1 << INT7);
+ break;
#elif defined(EICRA) && defined(EICRB) && defined(EIMSK)
case 2:
EICRA = (EICRA & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00);
@@ -205,7 +237,32 @@ void detachInterrupt(uint8_t interruptNum) {
break;
case 4:
EIMSK &= ~(1<<INT6);
- break;
+ break;
+#elif defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)
+ case 0:
+ EIMSK &= ~(1 << INT0);
+ break;
+ case 1:
+ EIMSK &= ~(1 << INT1);
+ break;
+ case 2:
+ EIMSK &= ~(1 << INT2);
+ break;
+ case 3:
+ EIMSK &= ~(1 << INT3);
+ break;
+ case 4:
+ EIMSK &= ~(1 << INT4);
+ break;
+ case 5:
+ EIMSK &= ~(1 << INT5);
+ break;
+ case 6:
+ EIMSK &= ~(1 << INT6);
+ break;
+ case 7:
+ EIMSK &= ~(1 << INT7);
+ break;
#elif defined(EICRA) && defined(EICRB) && defined(EIMSK)
case 2:
EIMSK &= ~(1 << INT0);
@@ -274,11 +331,6 @@ void detachInterrupt(uint8_t interruptNum) {
}
}
-/*
-void attachInterruptTwi(void (*userFunc)(void) ) {
- twiIntFunc = userFunc;
-}
-*/
#define IMPLEMENT_ISR(vect, interrupt) \
ISR(vect) { \
@@ -293,6 +345,17 @@ IMPLEMENT_ISR(INT2_vect, EXTERNAL_INT_2)
IMPLEMENT_ISR(INT3_vect, EXTERNAL_INT_3)
IMPLEMENT_ISR(INT6_vect, EXTERNAL_INT_4)
+#elif defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)
+
+IMPLEMENT_ISR(INT0_vect, EXTERNAL_INT_0)
+IMPLEMENT_ISR(INT1_vect, EXTERNAL_INT_1)
+IMPLEMENT_ISR(INT2_vect, EXTERNAL_INT_2)
+IMPLEMENT_ISR(INT3_vect, EXTERNAL_INT_3)
+IMPLEMENT_ISR(INT4_vect, EXTERNAL_INT_4)
+IMPLEMENT_ISR(INT5_vect, EXTERNAL_INT_5)
+IMPLEMENT_ISR(INT6_vect, EXTERNAL_INT_6)
+IMPLEMENT_ISR(INT7_vect, EXTERNAL_INT_7)
+
#elif defined(EICRA) && defined(EICRB)
IMPLEMENT_ISR(INT0_vect, EXTERNAL_INT_2)
@@ -314,11 +377,3 @@ IMPLEMENT_ISR(INT2_vect, EXTERNAL_INT_2)
#endif
#endif
-
-/*
-ISR(TWI_vect) {
- if(twiIntFunc)
- twiIntFunc();
-}
-*/
-
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index f2572d6..043fda7 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -121,7 +121,7 @@ String::String(double value, unsigned char decimalPlaces)
String::~String()
{
- free(buffer);
+ if (buffer) free(buffer);
}
/*********************************************/
diff --git a/cores/arduino/new.cpp b/cores/arduino/new.cpp
index cf6f89c..fc30cf8 100644
--- a/cores/arduino/new.cpp
+++ b/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/cores/arduino/new.h b/cores/arduino/new.h
index 6e1b68f..763f5cc 100644
--- a/cores/arduino/new.h
+++ b/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/cores/arduino/wiring_shift.c b/cores/arduino/wiring_shift.c
index 2b6f7a8..a9b3be5 100644
--- a/cores/arduino/wiring_shift.c
+++ b/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/libraries/SoftwareSerial/src/SoftwareSerial.cpp b/libraries/SoftwareSerial/src/SoftwareSerial.cpp
index 474fe4a..3163d7a 100644
--- a/libraries/SoftwareSerial/src/SoftwareSerial.cpp
+++ b/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/libraries/SoftwareSerial/src/SoftwareSerial.h b/libraries/SoftwareSerial/src/SoftwareSerial.h
index b1a37c4..d8b88ce 100644
--- a/libraries/SoftwareSerial/src/SoftwareSerial.h
+++ b/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/libraries/Wire/examples/i2c_scanner/i2c_scanner.ino b/libraries/Wire/examples/i2c_scanner/i2c_scanner.ino
new file mode 100644
index 0000000..3febbf4
--- /dev/null
+++ b/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 <Wire.h>
+
+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/libraries/Wire/src/utility/twi.c b/libraries/Wire/src/utility/twi.c
index 171af73..1a35146 100644
--- a/libraries/Wire/src/utility/twi.c
+++ b/libraries/Wire/src/utility/twi.c
@@ -445,6 +445,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){
@@ -530,6 +531,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