GPIO mux routing
Posted: Sat Sep 16, 2017 7:00 pm
Hi there,
i think it should be possible to connect any gpio to another logical gpio.
i use the W1TS and W1TC functions to set and clear the gpio levels.
I have 14 bit values and those values i give out as binary to the gpios.
I do this by clearing all necessary bits with WITC and then calculating the new value with OR and AND and bitshift. Then I set the value .
This all needs time, so i would like to know, if there is a better way.
Could someone tell me, how to logical swap the Pins?
for now i use 4,5,13,14,15,16,17,18,19,21,22,23,26,27 because they are in the same register and not needed to boot.
i do it like this:
uint32_t GPIO_w1ts = GPIO_OUT_W1TS_REG;
uint32_t GPIO_w1tc = GPIO_OUT_W1TC_REG;
uint32_t SetBits (uint16_t bits)
{
return ( (bits & 0b11000000000000)<<14) | ((bits & 0b00111000000000)<<12)|((bits & 00000111111100)<<11) | ((bits & 0b....
}
main:
int counter=1;
while(1)
{
count++;
GPIO_w1tc=0b1100111011111110000000110000; //clear em all
GPIO_w1ts= SetBits(counter);
}
///////////////////////////////////////////////////////////////
Now i would like to use another gpio setting, that i could do the following:
GPIO_w1ts = counter;
You see, i would like to swap the numbers of the logical connected pins.
Also I would like to know, if there is a way to set a value without resetting the register.
Sorry for my bad english!
i think it should be possible to connect any gpio to another logical gpio.
i use the W1TS and W1TC functions to set and clear the gpio levels.
I have 14 bit values and those values i give out as binary to the gpios.
I do this by clearing all necessary bits with WITC and then calculating the new value with OR and AND and bitshift. Then I set the value .
This all needs time, so i would like to know, if there is a better way.
Could someone tell me, how to logical swap the Pins?
for now i use 4,5,13,14,15,16,17,18,19,21,22,23,26,27 because they are in the same register and not needed to boot.
i do it like this:
uint32_t GPIO_w1ts = GPIO_OUT_W1TS_REG;
uint32_t GPIO_w1tc = GPIO_OUT_W1TC_REG;
uint32_t SetBits (uint16_t bits)
{
return ( (bits & 0b11000000000000)<<14) | ((bits & 0b00111000000000)<<12)|((bits & 00000111111100)<<11) | ((bits & 0b....
}
main:
int counter=1;
while(1)
{
count++;
GPIO_w1tc=0b1100111011111110000000110000; //clear em all
GPIO_w1ts= SetBits(counter);
}
///////////////////////////////////////////////////////////////
Now i would like to use another gpio setting, that i could do the following:
GPIO_w1ts = counter;
You see, i would like to swap the numbers of the logical connected pins.
Also I would like to know, if there is a way to set a value without resetting the register.
Sorry for my bad english!