/* * A simple interrupt handler for CAN message reception */ void canHandler(void) { if (canReady(CAN_PORT_1)) { canRead(CAN_PORT_1, &can1RxBuffer); can1RxDone = true; } if (canReady(CAN_PORT_2)) { canRead(CAN_PORT_2, &can2RxBuffer); can2RxDone = true; } }
/* * An interrupt handler for CAN message reception on CAN1 * When a message is recieved the ID is checked and local * variables are updated within the conveyor sub-system. */ static void canHandler(void) { if (canReady(CAN_PORT_1)) { interfaceLedToggle(D1_LED); canRead(CAN_PORT_1, &can1RxBuf); canMessage_t msg; msg = can1RxBuf; if (msg.id == PICKED_UP_PAD1){ checkForInputBlock = true; stopConveyorForLoad = true; } if(msg.id == EMERGENCY_STOP){ emergencyStop = true; } if(msg.id == PAUSE){ paused = true; } if(msg.id == RESUME){ paused = false; conveyorSetState(pausedState); } if(msg.id == RESET){ __iar_program_start(); } if(msg.id == START){ stopped = false; } if(msg.id == STOP){ stopped = true; } } }
/* * A simple interrupt handler for CAN message reception on CAN1 */ static void canHandler(void) { if (canReady(CAN_PORT_1)) { interfaceLedToggle(D1_LED); canRead(CAN_PORT_1, &can1RxBuf); canMessage_t msg; msg = can1RxBuf; if (msg.id == READY_TO_PICKUP_CONVEYOR) { moveBlock = true; } if(msg.id == PAD2_CLEAR) { padClear = true; } if(msg.id == PICKED_UP_CONVEYOR) { pickupAttempts = 0; } if(msg.id == EMERGENCY_STOP) { emergencyStop = true; } if(msg.id == RESET) { __iar_program_start(); } if(msg.id == PAUSE) { paused = true; } if(msg.id == RESUME) { paused = false; } if(msg.id == START) { stopped = false; } if(msg.id == STOP) { stopped = true; } } }
bool Slot::setItem(Item* item) { if(mItem == item) return false; if (item) { if (isAllowed(item) && isEmpty()) { item->removeOldState(); item->setOwner(mOwner); item->setParentSlot(this); if (canReady(item)) item->setState(GOS_READY); else item->setState(GOS_HELD); mItem = item; } else { LOG_ERROR(Logger::RULES, "Item '" + item->getName() + "' konnte nicht in den Slot '" + mName + "' gelegt werden: " + (isAllowed(item) ? "'falscher Typ' " : "") + (isEmpty() ? "'Slot schon belegt'" : "") + "!"); return false; } } else { // this is the case, if the item is removed automatically // don't change this without looking at Item::setState mItem->removeOldState(); mItem = NULL; } return true; }
/* * A simple interrupt handler for CAN message reception on CAN1 */ static void canHandler(void) { if (canReady(CAN_PORT_1)) { canRead(CAN_PORT_1, &can1RxBuf); OSSemPost(can1RxSem); } }