Disabling internal pull-ups on Arduino Due.

Hi, i'm working on a project, but recently acquired an arduino due-board and want to make my code work with this board too. I had this little code-snippet to run in the setup function, to disable internal pull-ups which the wire library enables by default:

#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega328P__)
    // deactivates internal pull-up 
    // atmega8 manual p. 167
    cbi(PORTC, 4);
    cbi(PORTC, 5);
    // deactivates internal pull-up
    // atmega128 manual p. 204
    cbi(PORTD, 0);
    cbi(PORTD, 1);

cbi is defined:

#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))

This used to work with the previous arduino-boards but it obviously doesn't work with the new Arduino Due which uses an ARM-chip instead of Atmega.

So i guess i can add something to that first code-snippet to make it work with the Arduino Due too, but i'm kind of lost what to put there? I googled "disabling internal pullup arduino due", but could not find an answer. Does someone have a quick code snippet, that disables internal pull-ups on the arduino due's SCL and SDA port?

Have a look in the PIO_PUDR (Pull Up Disable Register) page 666 datasheet of SAM3X. You should probably use something like this: REG_PIOB_PUDR = 0xFFFFFFFF (same for PIOA?). Check also PIO_CODR (Clear Output Data Register), not sure if you have to set this also.

These also might be useful for you: arduino-1.5.2\hardware\arduino\sam\system\libsam\source\pio.c arduino-1.5.2\hardware\arduino\sam\system\libsam\include\pio.h arduino-1.5.2\hardware\arduino\sam\sam\cores\arduino\wiring_digital.c

Hello. Thanks a lot for the reply. I ended up continuing to work on the project with the old arduino-board, but i will look into this now :)