I have to control external devices via GPIO pins on my MODM7AE70 and it is critical to not have any unexpected glitches.
Looking at the Netburner GPIO examples I see that pin configuration is done like this:
Code: Select all
// first initialize the pin as ouput:
P2[15].setFn( PinIO::PIN_FN_OUT);
// then set it HIGH
P2[15] = 1;
So my question is how to prevent the pin from going LOW first when I want it to be HIGH as soon as I set it to output?
I tested to set the pin to HIGH first and then set it to output like this:
Code: Select all
// first set it HIGH
P2[15] = 1;
// then initialize the pin as output:
P2[15].setFn( PinIO::PIN_FN_OUT);
Looking at the Microchip ASF code examples I see that they do everything in one single line and also allow to define additional pin parameters in a single step:
Code: Select all
void pio_set_output ( Pio * p_pio,
const uint32_t ul_mask,
const uint32_t ul_default_level,
const uint32_t ul_multidrive_enable,
const uint32_t ul_pull_up_enable
)
Code: Select all
pio_set_output(PIOA, PIO_PA23, LOW, DISABLE, ENABLE);
Thanks in advance,
Anguel