/* Sets the given bit(s) in a register in the IO expander.  */
uint32_t BOARD_picRegBitsSet(uint8_t addr, bool set, uint8_t bitMask)
/* Sets the given bit(s) in a register in the IO expander.  */
uint32_t BOARD_picRegBitsSet(uint8_t addr, bool set, uint8_t bitMask)
{
   uint32_t status;
   uint8_t  value;
   picWake();
   status = picReadReg( addr, &value );
   if( status != BOARD_OK ) {
      goto cleanup;
   }
   if( set ) {
      value |= bitMask;
   }
   else {
      value &= ~bitMask;
   }
   status = picWriteReg( addr, value );
   picSleep();
cleanup:
   return status;
}