understanding some code lines

Hello to every arduino fans.

I was trying to understand some line codes took from a nunchuck code i found on internet...

static void nunchuck_setpowerpins()
{
#define pwrpin PORTC3
#define gndpin PORTC2
    DDRC |= _BV(pwrpin) | _BV(gndpin);
    PORTC &=~ _BV(gndpin);
    PORTC |=  _BV(pwrpin);
    delay(100);        
}

They set the analog pin 2,3 of arduino as power and gnd for the protocol. My problem is understanding all of the assignment: what are the central lines saying? And to who? I tried to look in atmega datasheet but I didn't find anything: can anyone help me? Thanks and have a good day.

what are the central lines saying?

The are the inclusive OR operation

DDRC |=

This says make the register called DDRC equal to what is was and inclusive ORed with what follows.

Generally what you are doing is setting individual bit is a register or variable.

DDRC is the data direction register of port C, it defines what bits of the port are inputs and which are outputs.

That code will expand out to something like:

static void nunchuck_setpowerpins()
{
// #define pwrpin 3  -   pwrpin mask is 0x08 (bit 3)
// #define gndpin 2  -  gndpin mask is 0x04 (bit 2)
    DDRC |= 0x0C ;   // set both pins as OUTPUT
    PORTC &= ~0x04 ;  // force gndpin LOW
    PORTC |=  0x08 ;   // force pwrpin HIGH
    delay(100);        
}