5 Replies Latest reply on Apr 11, 2014 12:56 AM by mdelgert

    OneWire library compatibility


      I started to use galileo and I encountered my first problem: I want to use the Onewire library to test temperature sensor ds18b20, but compilation of simple test program returns an error on I/O definitions section because the include file obviously doesn't include a specific Galileo section.

      This is the AVR section:

      #if defined(__AVR__)

      #define PIN_TO_BASEREG(pin)             (portInputRegister(digitalPinToPort(pin)))

      #define PIN_TO_BITMASK(pin)             (digitalPinToBitMask(pin))

      #define IO_REG_TYPE uint8_t

      #define IO_REG_ASM asm("r30")

      #define DIRECT_READ(base, mask)         (((*(base)) & (mask)) ? 1 : 0)

      #define DIRECT_MODE_INPUT(base, mask)   ((*((base)+1)) &= ~(mask))

      #define DIRECT_MODE_OUTPUT(base, mask)  ((*((base)+1)) |= (mask))

      #define DIRECT_WRITE_LOW(base, mask)    ((*((base)+2)) &= ~(mask))

      #define DIRECT_WRITE_HIGH(base, mask)   ((*((base)+2)) |= (mask))

      What could be the correct translation for the x86 platform ?