Before my brain melts, can anyone clarify the port/pin registers for this?
As far as I can make out:
FB_D0 = PTH6 = Pin51
FB_D1 = PTH7 = Pin50
FB_D2 = PTH0 = Pin47
FB_D3 = PTH1 = Pin46
FB_D4 = PTH2 = Pin1
FB_D5 = PTH3 = Pin140
FB_D6 = PTH4 = Pin139
FB_D7 = PTH5 = Pin138
And the config registers are organised in differing orders:
MCF_GPIO_PTHPAR_ is in FB_Dx order where FB_D0 is BIT0&1 and FB_D7 is BIT14&15
MCF_GPIO_DDRTH_ is in PTHx order where DDRTH0 is BIT0 and DDRTH7 is BIT7
MCF_GPIO_SETTH_ is in PTHx order where SETTH0 is BIT0 and SETTH7 is BIT7
MCF_GPIO_CLRTH_ is in PTHx order where CLRTH0 is BIT0 and CLRTH7 is BIT7
So the question is, say I want to set pin 138 as an output and toggle it, do I set PTHPAR7 = GPIO to assign it but then set DDRTH5 to make it an output, and write MCF_GPIO_PORTTH ^= MCF_GPIO_PORTTH_PORTTH5 to toggle it.