In looking over the code for the NRF905 radio module (Nick Gammon library) I have come across the following:
void nRF905_irq_on(uint8_t origVal)
{
#if NRF905_INTERRUPTS != 0
#ifdef ARDUINO
((void)(origVal));
if(isrState_local > 0)
isrState_local--;
if(isrState_local == 0)
{
attachInterrupt(digitalPinToInterrupt(NRF905_DR), nRF905_SERVICE_DR, RISING);
#if NRF905_INTERRUPTS_AM
attachInterrupt(digitalPinToInterrupt(NRF905_AM), nRF905_SERVICE_AM, CHANGE);
#endif
}
#else
if(origVal)
{
NRF905_REG_EXTERNAL_INT_DR |= _BV(NRF905_BIT_EXTERNAL_INT_DR);
#if NRF905_INTERRUPTS_AM
NRF905_REG_EXTERNAL_INT_AM |= _BV(NRF905_BIT_EXTERNAL_INT_AM);
#endif
}
#endif
#else
((void)(origVal));
#endif
}
Now if one processes the #ifdef for Arduino and assuming NRF905_INTERRUPTS_AM is set and using interrupts (NRF905_INTERRUPTS is set) we get the following:
void nRF905_irq_on(uint8_t origVal)
{
** ((void)(origVal));**
if(isrState_local > 0)
isrState_local--;
if(isrState_local == 0)
{
attachInterrupt(digitalPinToInterrupt(NRF905_DR), nRF905_SERVICE_DR, RISING);
attachInterrupt(digitalPinToInterrupt(NRF905_AM), nRF905_SERVICE_AM, CHANGE);
}
}
The question is what is going on with this line:
((void) (origVal));
origVal is an unsigned 8 bit quantity and is a passed parameter but it is being executed it looks like.
When nrf905_irq_on is called later on in the code we have the following:
** nRF905_irq_on(1);**
So the passed parameter will be a 1 and the line bolded will become:
((void) 1);
I cannot fathom what this does. Can anyone help ???
It seems really bizarre.