The code you have given it is self explanatory.
but also
Code:
#define LED1 (1 << 10) //LED1 poistion on port pin
#define LED2 (1 << 11) //LED2 poistion on port pin
#define BUTTON1 (1 << 15) //BUTTON1 poistion on port pin
#define BUTTON2 (1 << 16) //BUTTON2 poistion on port pin
int main(void)
{
// Set buttons as input
GPIO0_IODIR &= ~(BUTTON1 | BUTTON2);
// Set LEDs as output
GPIO0_IODIR |= (LED1 | LED2);
// Turn both LEDS off (set them 'high')
GPIO0_IOSET |= (LED1 | LED2);
or operation is performed with the values of button1 and button2 and its inverse is done and with value in GPIO0_IODIR and assigned back to GPIO0_IODIR.
is like shifting the zero for 10 times so still it is zero only so it does not have any meaning
what we need is
Code C - [expand]
1
2
3
4
5
6
7
8
~(1<<10)[syntax][code]11111111111111111111101111111111[/code]
to get the 10 th bit o and to AND with the DIR register. so that the 10th bit will be low and it will be configured as input
[syntax=c]
DIR &= ~(1<<10);