can't understand this ARM CMSIS code

Status
Not open for further replies.

behzadmsl

Junior Member level 2
Joined
Dec 18, 2010
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,432
hi

I'm trying to learn ARM nxp lpc1768,and i also attempting to use CMSIS library in my projects.So i downloaded lpc17xx CMSIS Driver Library Manual to read.

I'm bit confused with code,and unfortunately i can't compile the code in order to make it clear for myself..

what does "1<<21" mean?? is "<<" a shift operator? or it's an assignment operator??

GPIO_SetDir(0,1<<21,1);

thanks in advance
 

what does "1<<21" mean?? is "<<" a shift operator? or it's an assignment operator??

GPIO_SetDir(0,1<<21,1);
Yes, "<<" is a shift operator. For more details read any C tutorial, example - Bitwise operation - Wikipedia, the free encyclopedia
I'm using CMSIS for LPC11xx but it probably the same. Please take a look into gpio.c file for GPIOSetDir() function description
Code:
/*****************************************************************************
** Function name:		GPIOSetDir
**
** Descriptions:		Set the direction in GPIO port
**
** parameters:			port num, bit position, direction (1 out, 0 input)
** Returned value:		None
**
*****************************************************************************/
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…