AnsweredAssumed Answered

ODR IDR question

Question asked by delos_reyes.kristian on Jan 21, 2013
Latest reply on Jan 21, 2013 by Clive One
Hi guys,

I have this question,

/* GPIOA Periph clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);

  /* Configure PA0 .. PA7 in output pushpull mode */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  /* Configure PA8 .. PA15 in input, pulled up mode */
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  GPIOA->ODR = GPIOA->IDR >> 8; // Mirror high ordered inputs to low ordered outputs

could you explain to me the bold one especially "8" and IDR

for example I want to mirror only the first four bits from high ordered to low ordered
or last four bits from high ordered to low ordered.

Thank you very much!

Outcomes