How to use 1-wire library with DS2406

I'm spending some time on these 1-wire devices... so far I managed to get the DS18B20 working, which is pretty easy since there's code in the Playground.
But unfortunately there is (or i didn't find) any documentation of the 1-wire library.

I'm trying to use the DS2406 switch, it's detected but can't get it turn off/on.
This is the datasheet http://pdfserv.maxim-ic.com/en/ds/DS2406.pdf

Based on what I read here http://support.embeddeddatasystems.com/archives/6#more-6
to turn off or on the PIOA I have to write to bit 5 of location memory 07 through the Write Status (55h) command.

How can I do this using the 1-wire library?

EDIT: I saw select subroutine in OneWire.cpp performs a Write Status(55h) then select the address.
But I don't know in which format I have to pass the address 7.
I do these commands:

ds.reset();
ds.select(addr);
ds.select(7);
ds.write(20);
delay(1000);
ds.select(7);
ds.write(0);
delay(1000);

7 is the memory location in Status memory map, 20 is the hexadecimal value to turn bit 5 on (PIO-A channel flip-flop)

PLEASE HELP... THERE'S NO DOCUMENTATION IN THE WHOLE INTERNET :frowning:

Apparently, the one wire library is a bit incomplete since the people that worked on it seem to have focused mainly on the initial hard part... the data signaling and on the temperature sensors. The only option open to you (and me) with regards to other 1-wire chips is to read the Dallas/Maxim Data sheets. The methods used to get useful responses from the 1-wire chips is unique to each device. The hard part (signaling) is done... but you/I need to do the rest.

I've sort of been stuck at that point too.

Hmm I saw ds.select issues the 55h command and sends a one byte array called rom.
So I suppose the sequence of commands is:

  1. select device
  2. select memory location to write
  3. send data to write
    I would spend some time on this but the hardest part is that I'm a C++ noob and I get stuck on data formats and that stuff.
    Hope someone who wrote the OneWire library help us...

I MADE IT WORKING!!!! WOHOOOOOOO!!!!
I had to spend two nights CAREFULLY reading the datasheet.

By default the PIO A is turned on. To turn it off, use this command sequence:

  ds.reset();
  ds.select(addr);
  ds.write(0x55);
  ds.write(0x07);
  ds.write(0);
  ds.write(0x3F);
  for ( i = 0; i < 6; i++) {
    data[i] = ds.read();
  }
  ds.write(0xFF);

To turn it on again, just reset it, or replace 3F with 1F