示例#1
0
/**
 * Set the default action for a slot
 * @param slot the slot offset
 * @param action the action to use as the default
 */
void SetDefaultAction(unsigned int slot,
                      Action *rising_action,
                      Action *falling_action) {
  CheckSlotOffset(slot);
  slot--;  // convert from 1 to 0 indexed slots
  Slot *slots = LookupSlot(slot);
  if (rising_action) {
    if (slots->SetDefaultRisingAction(rising_action)) {
      OLA_FATAL << "Multiple default rising actions defined for slot " <<
        slot + 1 << ", line " << yylineno;
      exit(ola::EXIT_DATAERR);
    }
  }
  if (falling_action) {
    if (slots->SetDefaultFallingAction(falling_action)) {
      OLA_FATAL << "Multiple default falling actions defined for slot " <<
        slot + 1 << ", line " << yylineno;
      exit(ola::EXIT_DATAERR);
    }
  }
}