void GpioInit(void) { // Set to inputs FIO0DIR = \ FIO1DIR = \ FIO2DIR = \ FIO3DIR = \ FIO4DIR = 0;
// clear mask registers FIO0MASK =\ FIO1MASK =\ FIO2MASK =\ FIO3MASK =\ FIO4MASK = 0;
// Reset all GPIO pins to default primary function PINSEL0 =\ PINSEL1 =\ PINSEL2 =\ PINSEL3 =\ PINSEL4 =\ PINSEL7 =\ PINSEL8 =\ PINSEL9 =\ PINSEL10 = 0; }
How can I change PINSEL1 with this code?
You girls are so smart.
But you have now taken a second look at the requirements/needs for the \ character when used last on a text line? And how the requirements differs between preprocessor lines like a long #define and a really long C expression that is too long to fit on a single line?
But why even do that?
Well, it isn't too common that a C expression might be long.
But the OP should by now have figured out that the C compiler does not need any \ at the end of the lines to concatenate individual text lines into a single line. Not even when someone needs to print a very long text string is it needed to use any \ to split the text string over multiple lines.
I feel increasingly superfluous to this discussion. You are free to discuss it amongst yourselves.
We are.
It is very pleasing to hear you acknowledge the fact. You two are sure to both learn something new from your discussion.
And have you learned anything - like how to deal with compiler messages, where the backspace is & isn't used for line continuation, and whether those huge long expressions are necessary or desirable...?
Actually, I rather doubt that backspace is used anywhere for line continuation!!
(yawn)
you two carry on without me.
K Panjaab,
You should first remove all spaces behind \.
void GpioInit(void) { // Set to inputs FIO0DIR = \ // ^ A space at above position.
Then
PINSEL0 =\ PINSEL1 =55;
You set both PINSEL0 and PINSEL1 to 55. (0x37)
As Per Westermark already told you. But the OP should by now have figured out that the C compiler does not need any \ at the end of the lines to concatenate individual text lines into a single line. Not even when someone needs to print a very long text string is it needed to use any \ to split the text string over multiple lines.
This also works.
void GpioInit(void) { // Set to inputs FIO0DIR = FIO1DIR = FIO2DIR = FIO3DIR = FIO4DIR = 0; // clear mask registers FIO0MASK = FIO1MASK = FIO2MASK = FIO3MASK = FIO4MASK = 0; // Reset all GPIO pins to default primary function PINSEL0 = PINSEL1 = 55; PINSEL2 = PINSEL3 = PINSEL4 = PINSEL7 = PINSEL8 = PINSEL9 = PINSEL10 = 0; }
Thanku John Linq. With that post, the lazy OP got what he was searching for - a direct working answer.
And the guy ( or girl - the gender is stochastic here) has got a serious attitudinal problem.
by the way, k panjaab, which part of India do you hail from?
That is very true; but not in the way you thought.
The responses here are very good material for my research.
Some contributors discuss the unmentioned portion of the OP's question to better understand the question, and to provide better help to the OP. I think this fine.
However, doing a community behavior research might be OK here. But fooling people is very bad.
With that post, the lazy OP got what he was searching for - a direct working answer.
If you ever come to my town, stop me and ask "can you tell me the way to the station?", I'll be sure to just reply "yes" and carry on walking.