PaulStoffregen / OneWire

Library for Dallas/Maxim 1-Wire Chips
http://www.pjrc.com/teensy/td_libs_OneWire.html
579 stars 382 forks source link

pin-access voodoo #23

Open orgua opened 7 years ago

orgua commented 7 years ago

Hi paul,

i'm writing a lib to emulate several onewire-slaves. some parts (platform-dependency) share code with this lib. i noticed a lot of legacy Studt-code, wanted to do a cleanup and have two questions for now:

IO_REG_TYPE mask = bitmask;
volatile IO_REG_TYPE *reg IO_REG_ASM = baseReg;
noInterrupts();
DIRECT_WRITE_LOW(reg, mask);
DIRECT_MODE_OUTPUT(reg, mask);  // drive output low
interrupts();

There are some more points that could be optimized. but one step after the other. i am happy to supply some pullrequests.