Fix for issue #292
Fix for issue #292

Replaced direct register manipulation with calls to bitWrite(). Fixed TIMSK5 usage on Leonardo (as well as some other preprocessor statements).
steamboating/Arduino,ricklon/Arduino,zaiexx/Arduino,ari-analytics/Arduino,sanyaade-iot/Arduino-1,nkolban/Arduino,zederson/Arduino,smily77/Arduino,NeuralSpaz/Arduino,eduardocasarin/Arduino,jaimemaretoli/Arduino,NicoHood/Arduino,tomkrus007/Arduino,zaiexx/Arduino,smily77/Arduino,weera00/Arduino,chaveiro/Arduino,jmgonzalez00449/Arduino,stevemayhew/Arduino,ricklon/Arduino,adafruit/ESP8266-Arduino,probonopd/Arduino,majenkotech/Arduino,noahchense/Arduino-1,eggfly/arduino,gonium/Arduino,karlitxo/Arduino,mattvenn/Arduino,tskurauskas/Arduino,pdNor/Arduino,mangelajo/Arduino,jabezGit/Arduino,aichi/Arduino-2,bsmr-arduino/Arduino,danielchalef/Arduino,kidswong999/Arduino,shannonshsu/Arduino,damellis/Arduino,Protoneer/Arduino,ogferreiro/Arduino,laylthe/Arduino,steamboating/Arduino,ForestNymph/Arduino_sources,wdoganowski/Arduino,wayoda/Arduino,majenkotech/Arduino,henningpohl/Arduino,PeterVH/Arduino,eggfly/arduino,lukeWal/Arduino,eeijcea/Arduino-1,mangelajo/Arduino,HCastano/Arduino,jmgonzalez00449/Arduino,jmgonzalez00449/Arduino,lulufei/Arduino,PaoloP74/Arduino,cscenter/Arduino,me-no-dev/Arduino-1,cscenter/Arduino,koltegirish/Arduino,ntruchsess/Arduino-1,tomkrus007/Arduino,NicoHood/Arduino,jabezGit/Arduino,ssvs111/Arduino,ogahara/Arduino,stevemayhew/Arduino,mattvenn/Arduino,Cloudino/Arduino,jomolinare/Arduino,pdNor/Arduino,ikbelkirasan/Arduino,ogferreiro/Arduino,ikbelkirasan/Arduino,laylthe/Arduino,pdNor/Arduino,majenkotech/Arduino,smily77/Arduino,zaiexx/Arduino,shannonshsu/Arduino,fungxu/Arduino,ogferreiro/Arduino,jabezGit/Arduino,HCastano/Arduino,ThoughtWorksIoTGurgaon/Arduino,gberl001/Arduino,tommyli2014/Arduino,wilhelmryan/Arduino,bsmr-arduino/Arduino,kidswong999/Arduino,jaimemaretoli/Arduino,ashwin713/Arduino,ntruchsess/Arduino-1,stickbreaker/Arduino,tannewt/Arduino,jabezGit/Arduino,wdoganowski/Arduino,ogferreiro/Arduino,jmgonzalez00449/Arduino,PaoloP74/Arduino,Protoneer/Arduino,NeuralSpaz/Arduino,niggor/Arduino_cc,wilhelmryan/Arduino,tommyli2014/Arduino,raimohanska/Arduino,wilhelmryan/Arduino,EmuxEvans/Arduino,raimohanska/Arduino,adafruit/ESP8266-Arduino,bsmr-arduino/Arduino,gestrem/Arduino,ashwin713/Arduino,mangelajo/Arduino,gberl001/Arduino,ogahara/Arduino,paulmand3l/Arduino,byran/Arduino,drpjk/Arduino,talhaburak/Arduino,Alfredynho/AgroSis,Cloudino/Arduino,shiitakeo/Arduino,wayoda/Arduino,leftbrainstrain/Arduino-ESP8266,mateuszdw/Arduino,paulo-raca/ESP8266-Arduino,eduardocasarin/Arduino,byran/Arduino,tommyli2014/Arduino,ThoughtWorksIoTGurgaon/Arduino,laylthe/Arduino,jomolinare/Arduino,shannonshsu/Arduino,eggfly/arduino,vbextreme/Arduino,ricklon/Arduino,eduardocasarin/Arduino,ari-analytics/Arduino,jabezGit/Arduino,zederson/Arduino,henningpohl/Arduino,leftbrainstrain/Arduino-ESP8266,jamesrob4/Arduino,snargledorf/Arduino,tbowmo/Arduino,paulo-raca/ESP8266-Arduino,spapadim/Arduino,probonopd/Arduino,wilhelmryan/Arduino,bsmr-arduino/Arduino,adafruit/ESP8266-Arduino,ogferreiro/Arduino,lukeWal/Arduino,gonium/Arduino,jaimemaretoli/Arduino,smily77/Arduino,tannewt/Arduino,lulufei/Arduino,KlaasDeNys/Arduino,ektor5/Arduino,adamkh/Arduino,talhaburak/Arduino,nkolban/Arduino,chaveiro/Arduino,SmartArduino/Arduino-1,ektor5/Arduino,stickbreaker/Arduino,jomolinare/Arduino,jaimemaretoli/Arduino,Protoneer/Arduino,myrtleTree33/Arduino,NeuralSpaz/Arduino,jamesrob4/Arduino,Cloudino/Cloudino-Arduino-IDE,pdNor/Arduino,radut/Arduino,spapadim/Arduino,ForestNymph/Arduino_sources,stevemayhew/Arduino,vbextreme/Arduino,ogahara/Arduino,laylthe/Arduino,HCastano/Arduino,mateuszdw/Arduino,eggfly/arduino,tbowmo/Arduino,wdoganowski/Arduino,OpenDevice/Arduino,danielchalef/Arduino,NaSymbol/Arduino,adamkh/Arduino,jaimemaretoli/Arduino,nandojve/Arduino,NaSymbol/Arduino,nkolban/Arduino,ari-analytics/Arduino,karlitxo/Arduino,bsmr-arduino/Arduino,xxxajk/Arduino-1,gberl001/Arduino,ogferreiro/Arduino,koltegirish/Arduino,chaveiro/Arduino,wdoganowski/Arduino,Chris--A/Arduino,jamesrob4/Arduino,aichi/Arduino-2,leftbrainstrain/Arduino-ESP8266,lulufei/Arduino,tomkrus007/Arduino,jaimemaretoli/Arduino,zederson/Arduino,zederson/Arduino,karlitxo/Arduino,sanyaade-iot/Arduino-1,superboonie/Arduino,acosinwork/Arduino,garci66/Arduino,Cloudino/Arduino,lukeWal/Arduino,jomolinare/Arduino,damellis/Arduino,tannewt/Arduino,ektor5/Arduino,NeuralSpaz/Arduino,tommyli2014/Arduino,OpenDevice/Arduino,andyvand/Arduino-1,eddyst/Arduino-SourceCode,lulufei/Arduino,cscenter/Arduino,jmgonzalez00449/Arduino,zenmanenergy/Arduino,karlitxo/Arduino,pdNor/Arduino,probonopd/Arduino,snargledorf/Arduino,ntruchsess/Arduino-1,vbextreme/Arduino,superboonie/Arduino,ccoenen/Arduino,PeterVH/Arduino,ashwin713/Arduino,garci66/Arduino,byran/Arduino,eeijcea/Arduino-1,weera00/Arduino,chaveiro/Arduino,OpenDevice/Arduino,stickbreaker/Arduino,lukeWal/Arduino,karlitxo/Arduino,mateuszdw/Arduino,mangelajo/Arduino,xxxajk/Arduino-1,SmartArduino/Arduino-1,zenmanenergy/Arduino,jmgonzalez00449/Arduino,Protoneer/Arduino,PaoloP74/Arduino,spapadim/Arduino,OpenDevice/Arduino,jabezGit/Arduino,adamkh/Arduino,steamboating/Arduino,cscenter/Arduino,xxxajk/Arduino-1,eeijcea/Arduino-1,smily77/Arduino,henningpohl/Arduino,ikbelkirasan/Arduino,ccoenen/Arduino,tbowmo/Arduino,gestrem/Arduino,majenkotech/Arduino,ForestNymph/Arduino_sources,shiitakeo/Arduino,me-no-dev/Arduino-1,lulufei/Arduino,OpenDevice/Arduino,jabezGit/Arduino,adafruit/ESP8266-Arduino,majenkotech/Arduino,ikbelkirasan/Arduino,adafruit/ESP8266-Arduino,drpjk/Arduino,koltegirish/Arduino,ssvs111/Arduino,jaehong/Xmegaduino,danielchalef/Arduino,laylthe/Arduino,NicoHood/Arduino,Alfredynho/AgroSis,andyvand/Arduino-1,majenkotech/Arduino,Cloudino/Cloudino-Arduino-IDE,mattvenn/Arduino,eduardocasarin/Arduino,lulufei/Arduino,zaiexx/Arduino,henningpohl/Arduino,ssvs111/Arduino,weera00/Arduino,nandojve/Arduino,byran/Arduino,laylthe/Arduino,ikbelkirasan/Arduino,jomolinare/Arduino,adafruit/ESP8266-Arduino,smily77/Arduino,probonopd/Arduino,steamboating/Arduino,noahchense/Arduino-1,Cloudino/Cloudino-Arduino-IDE,zenmanenergy/Arduino,niggor/Arduino_cc,stevemayhew/Arduino,zenmanenergy/Arduino,garci66/Arduino,fungxu/Arduino,NeuralSpaz/Arduino,probonopd/Arduino,cscenter/Arduino,EmuxEvans/Arduino,ektor5/Arduino,ccoenen/Arduino,Cloudino/Cloudino-Arduino-IDE,onovy/Arduino,ikbelkirasan/Arduino,KlaasDeNys/Arduino,jaimemaretoli/Arduino,PeterVH/Arduino,lukeWal/Arduino,drpjk/Arduino,aichi/Arduino-2,tskurauskas/Arduino,eduardocasarin/Arduino,OpenDevice/Arduino,jamesrob4/Arduino,HCastano/Arduino,me-no-dev/Arduino-1,damellis/Arduino,ntruchsess/Arduino-1,ssvs111/Arduino,arunkuttiyara/Arduino,tskurauskas/Arduino,jabezGit/Arduino,tskurauskas/Arduino,gestrem/Arduino,arunkuttiyara/Arduino,bigjosh/Arduino,NaSymbol/Arduino,drpjk/Arduino,superboonie/Arduino,ThoughtWorksIoTGurgaon/Arduino,niggor/Arduino_cc,eduardocasarin/Arduino,wayoda/Arduino,talhaburak/Arduino,weera00/Arduino,myrtleTree33/Arduino,myrtleTree33/Arduino,vbextreme/Arduino,garci66/Arduino,wilhelmryan/Arduino,nkolban/Arduino,tskurauskas/Arduino,snargledorf/Arduino,snargledorf/Arduino,niggor/Arduino_cc,acosinwork/Arduino,gestrem/Arduino,acosinwork/Arduino,henningpohl/Arduino,pdNor/Arduino,EmuxEvans/Arduino,tommyli2014/Arduino,me-no-dev/Arduino-1,Cloudino/Cloudino-Arduino-IDE,ari-analytics/Arduino,jomolinare/Arduino,garci66/Arduino,ntruchsess/Arduino-1,tannewt/Arduino,tbowmo/Arduino,KlaasDeNys/Arduino,PaoloP74/Arduino,gonium/Arduino,bigjosh/Arduino,PaoloP74/Arduino,SmartArduino/Arduino-1,superboonie/Arduino,Gourav2906/Arduino,wdoganowski/Arduino,snargledorf/Arduino,nkolban/Arduino,NicoHood/Arduino,ogferreiro/Arduino,tskurauskas/Arduino,ogahara/Arduino,KlaasDeNys/Arduino,jmgonzalez00449/Arduino,eggfly/arduino,spapadim/Arduino,xxxajk/Arduino-1,andyvand/Arduino-1,cscenter/Arduino,HCastano/Arduino,nandojve/Arduino,radut/Arduino,jaehong/Xmegaduino,vbextreme/Arduino,adafruit/ESP8266-Arduino,ccoenen/Arduino,bigjosh/Arduino,eddyst/Arduino-SourceCode,karlitxo/Arduino,chaveiro/Arduino,raimohanska/Arduino,HCastano/Arduino,onovy/Arduino,superboonie/Arduino,arunkuttiyara/Arduino,leftbrainstrain/Arduino-ESP8266,Cloudino/Cloudino-Arduino-IDE,Gourav2906/Arduino,eddyst/Arduino-SourceCode,wilhelmryan/Arduino,eeijcea/Arduino-1,paulo-raca/ESP8266-Arduino,stevemayhew/Arduino,shannonshsu/Arduino,PaoloP74/Arduino,gonium/Arduino,jaimemaretoli/Arduino,adamkh/Arduino,paulo-raca/ESP8266-Arduino,paulmand3l/Arduino,leftbrainstrain/Arduino-ESP8266,gestrem/Arduino,onovy/Arduino,tbowmo/Arduino,nandojve/Arduino,eeijcea/Arduino-1,byran/Arduino,eeijcea/Arduino-1,pdNor/Arduino,bigjosh/Arduino,Alfredynho/AgroSis,wdoganowski/Arduino,sanyaade-iot/Arduino-1,mattvenn/Arduino,ogahara/Arduino,wayoda/Arduino,PaoloP74/Arduino,mateuszdw/Arduino,lukeWal/Arduino,garci66/Arduino,ntruchsess/Arduino-1,Cloudino/Cloudino-Arduino-IDE,myrtleTree33/Arduino,mangelajo/Arduino,cscenter/Arduino,snargledorf/Arduino,Gourav2906/Arduino,paulmand3l/Arduino,tomkrus007/Arduino,eddyst/Arduino-SourceCode,zederson/Arduino,NaSymbol/Arduino,ogahara/Arduino,gberl001/Arduino,ikbelkirasan/Arduino,drpjk/Arduino,Protoneer/Arduino,ashwin713/Arduino,damellis/Arduino,drpjk/Arduino,radut/Arduino,tomkrus007/Arduino,ari-analytics/Arduino,leftbrainstrain/Arduino-ESP8266,spapadim/Arduino,lukeWal/Arduino,wayoda/Arduino,pdNor/Arduino,mattvenn/Arduino,ashwin713/Arduino,tannewt/Arduino,Alfredynho/AgroSis,acosinwork/Arduino,arunkuttiyara/Arduino,eddyst/Arduino-SourceCode,NaSymbol/Arduino,ccoenen/Arduino,mattvenn/Arduino,PeterVH/Arduino,danielchalef/Arduino,gestrem/Arduino,kidswong999/Arduino,weera00/Arduino,ForestNymph/Arduino_sources,kidswong999/Arduino,ashwin713/Arduino,eggfly/arduino,niggor/Arduino_cc,ari-analytics/Arduino,probonopd/Arduino,lulufei/Arduino,ricklon/Arduino,ricklon/Arduino,wayoda/Arduino,stevemayhew/Arduino,fungxu/Arduino,tommyli2014/Arduino,jomolinare/Arduino,radut/Arduino,mateuszdw/Arduino,mateuszdw/Arduino,NaSymbol/Arduino,radut/Arduino,steamboating/Arduino,ari-analytics/Arduino,zenmanenergy/Arduino,byran/Arduino,danielchalef/Arduino,noahchense/Arduino-1,eduardocasarin/Arduino,nkolban/Arduino,onovy/Arduino,fungxu/Arduino,fungxu/Arduino,byran/Arduino,andyvand/Arduino-1,NicoHood/Arduino,laylthe/Arduino,bsmr-arduino/Arduino,Chris--A/Arduino,spapadim/Arduino,tbowmo/Arduino,fungxu/Arduino,niggor/Arduino_cc,tomkrus007/Arduino,stickbreaker/Arduino,jaehong/Xmegaduino,xxxajk/Arduino-1,Gourav2906/Arduino,talhaburak/Arduino,acosinwork/Arduino,nandojve/Arduino,bigjosh/Arduino,sanyaade-iot/Arduino-1,byran/Arduino,raimohanska/Arduino,PeterVH/Arduino,NeuralSpaz/Arduino,radut/Arduino,zederson/Arduino,ikbelkirasan/Arduino,NaSymbol/Arduino,ccoenen/Arduino,tskurauskas/Arduino,noahchense/Arduino-1,eggfly/arduino,koltegirish/Arduino,sanyaade-iot/Arduino-1,zederson/Arduino,HCastano/Arduino,superboonie/Arduino,ThoughtWorksIoTGurgaon/Arduino,wdoganowski/Arduino,eddyst/Arduino-SourceCode,acosinwork/Arduino,ccoenen/Arduino,paulmand3l/Arduino,ricklon/Arduino,zenmanenergy/Arduino,bigjosh/Arduino,danielchalef/Arduino,mangelajo/Arduino,talhaburak/Arduino,NicoHood/Arduino,majenkotech/Arduino,sanyaade-iot/Arduino-1,shiitakeo/Arduino,EmuxEvans/Arduino,jamesrob4/Arduino,mateuszdw/Arduino,PaoloP74/Arduino,paulmand3l/Arduino,aichi/Arduino-2,jamesrob4/Arduino,koltegirish/Arduino,andyvand/Arduino-1,zaiexx/Arduino,xxxajk/Arduino-1,Alfredynho/AgroSis,zenmanenergy/Arduino,damellis/Arduino,KlaasDeNys/Arduino,vbextreme/Arduino,acosinwork/Arduino,ssvs111/Arduino,kidswong999/Arduino,radut/Arduino,KlaasDeNys/Arduino,nandojve/Arduino,jmgonzalez00449/Arduino,Gourav2906/Arduino,paulo-raca/ESP8266-Arduino,ThoughtWorksIoTGurgaon/Arduino,stickbreaker/Arduino,stickbreaker/Arduino,ssvs111/Arduino,Gourav2906/Arduino,vbextreme/Arduino,SmartArduino/Arduino-1,PeterVH/Arduino,weera00/Arduino,raimohanska/Arduino,aichi/Arduino-2,kidswong999/Arduino,bsmr-arduino/Arduino,Chris--A/Arduino,Chris--A/Arduino,SmartArduino/Arduino-1,onovy/Arduino,NicoHood/Arduino,aichi/Arduino-2,sanyaade-iot/Arduino-1,noahchense/Arduino-1,niggor/Arduino_cc,ForestNymph/Arduino_sources,me-no-dev/Arduino-1,tskurauskas/Arduino,gberl001/Arduino,Protoneer/Arduino,superboonie/Arduino,nandojve/Arduino,bsmr-arduino/Arduino,gonium/Arduino,shiitakeo/Arduino,gberl001/Arduino,acosinwork/Arduino,ektor5/Arduino,Cloudino/Arduino,zaiexx/Arduino,ashwin713/Arduino,wayoda/Arduino,onovy/Arduino,tbowmo/Arduino,stickbreaker/Arduino,talhaburak/Arduino,ccoenen/Arduino,paulo-raca/ESP8266-Arduino,wilhelmryan/Arduino,ntruchsess/Arduino-1,karlitxo/Arduino,zaiexx/Arduino,superboonie/Arduino,xxxajk/Arduino-1,fungxu/Arduino,myrtleTree33/Arduino,paulmand3l/Arduino,SmartArduino/Arduino-1,andyvand/Arduino-1,wayoda/Arduino,me-no-dev/Arduino-1,eggfly/arduino,probonopd/Arduino,adamkh/Arduino,KlaasDeNys/Arduino,Cloudino/Arduino,steamboating/Arduino,xxxajk/Arduino-1,ashwin713/Arduino,jaehong/Xmegaduino,Gourav2906/Arduino,Chris--A/Arduino,ThoughtWorksIoTGurgaon/Arduino,weera00/Arduino,Chris--A/Arduino,OpenDevice/Arduino,henningpohl/Arduino,myrtleTree33/Arduino,ThoughtWorksIoTGurgaon/Arduino,ForestNymph/Arduino_sources,chaveiro/Arduino,aichi/Arduino-2,me-no-dev/Arduino-1,gestrem/Arduino,nandojve/Arduino,garci66/Arduino,koltegirish/Arduino,arunkuttiyara/Arduino,ektor5/Arduino,noahchense/Arduino-1,Gourav2906/Arduino,damellis/Arduino,EmuxEvans/Arduino,stevemayhew/Arduino,gonium/Arduino,henningpohl/Arduino,jamesrob4/Arduino,tommyli2014/Arduino,arunkuttiyara/Arduino,ThoughtWorksIoTGurgaon/Arduino,me-no-dev/Arduino-1,shannonshsu/Arduino,KlaasDeNys/Arduino,talhaburak/Arduino,SmartArduino/Arduino-1,Alfredynho/AgroSis,HCastano/Arduino,ari-analytics/Arduino,tannewt/Arduino,eddyst/Arduino-SourceCode,spapadim/Arduino,paulmand3l/Arduino,bigjosh/Arduino,danielchalef/Arduino,damellis/Arduino,ForestNymph/Arduino_sources,henningpohl/Arduino,jaehong/Xmegaduino,shiitakeo/Arduino,adamkh/Arduino,snargledorf/Arduino,talhaburak/Arduino,ogahara/Arduino,garci66/Arduino,jaehong/Xmegaduino,PeterVH/Arduino,gberl001/Arduino,arunkuttiyara/Arduino,gonium/Arduino,Protoneer/Arduino,myrtleTree33/Arduino,shiitakeo/Arduino,EmuxEvans/Arduino,nkolban/Arduino,mattvenn/Arduino,niggor/Arduino_cc,kidswong999/Arduino,eeijcea/Arduino-1,PeterVH/Arduino,zaiexx/Arduino,ssvs111/Arduino,Chris--A/Arduino,koltegirish/Arduino,shannonshsu/Arduino,mangelajo/Arduino,stevemayhew/Arduino,cscenter/Arduino,steamboating/Arduino,smily77/Arduino,kidswong999/Arduino,NicoHood/Arduino,NaSymbol/Arduino,vbextreme/Arduino,raimohanska/Arduino,shannonshsu/Arduino,adamkh/Arduino,EmuxEvans/Arduino,NeuralSpaz/Arduino,Alfredynho/AgroSis,Cloudino/Arduino,jaehong/Xmegaduino,chaveiro/Arduino,tbowmo/Arduino,raimohanska/Arduino,adamkh/Arduino,niggor/Arduino_cc,leftbrainstrain/Arduino-ESP8266,noahchense/Arduino-1,eddyst/Arduino-SourceCode,chaveiro/Arduino,tomkrus007/Arduino,drpjk/Arduino,paulo-raca/ESP8266-Arduino,lukeWal/Arduino,andyvand/Arduino-1,tannewt/Arduino,Chris--A/Arduino,ricklon/Arduino,bigjosh/Arduino,shannonshsu/Arduino,onovy/Arduino,Cloudino/Arduino,ntruchsess/Arduino-1,tomkrus007/Arduino,shiitakeo/Arduino