curtis63 5 Posted February 8, 2017 Share Posted February 8, 2017 I'm writing my own i2c library and need to be able to simultaneously change PinMode on 2 pins. One for SCL and one for SDA. Is there a way to change PinMode on 2 pins simultaneously? I want the behavior of the follwing: PinMode(14,OUTPUT); PinMode(15,INPUT); without the 2.5microsecond delay between the 2 calls above. Quote Link to post Share on other sites
veryalive 49 Posted February 8, 2017 Share Posted February 8, 2017 Hi, I've been following your bit-bang I2C efforts. If you are making a custom version, perhaps using direct port I/O would be useful? As follows: P1DIR |= BIT7 + BIT6; // make these outputs P1OUT |= BIT7 + BIT6; // make them simultaneously go hi P1OUT &= ~(BIT7+BIT6); // ditto, but go low The only thing is that it departs from energia statements. I suspect you must have a scope / logic analyser or you wouldn't have known / measured the delay between the two PinMode statements you tried? Is this OK for your app? Cheers, energia 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.