void rotenc_rotate_cb(EXTDriver *extp, expchannel_t channel) { (void)extp; (void)channel; chSysLockFromISR(); if(GPTD3.tim->CR1 & STM32_TIM_CR1_DIR) { chEvtBroadcastFlagsI(&rotenc_es, ROTENC_LEFT_FLAG); } else { chEvtBroadcastFlagsI(&rotenc_es, ROTENC_RIGHT_FLAG); } chSysUnlockFromISR(); }
/** * @brief Signals all the Event Listeners registered on the specified Event * Source. * @details This function variants ORs the specified event flags to all the * threads registered on the @p event_source_t in addition to the * event flags specified by the threads themselves in the * @p event_listener_t objects. * * @param[in] esp pointer to the @p event_source_t structure * @param[in] flags the flags set to be added to the listener flags mask * * @api */ void chEvtBroadcastFlags(event_source_t *esp, eventflags_t flags) { chSysLock(); chEvtBroadcastFlagsI(esp, flags); chSchRescheduleS(); chSysUnlock(); }
/** * @brief Signals all the Event Listeners registered on the specified Event * Source. * @details This function variants ORs the specified event flags to all the * threads registered on the @p EventSource in addition to the event * flags specified by the threads themselves in the * @p EventListener objects. * * @param[in] esp pointer to the @p EventSource structure * @param[in] mask the event flags set to be ORed * * @api */ void chEvtBroadcastFlags(EventSource *esp, eventmask_t mask) { chSysLock(); chEvtBroadcastFlagsI(esp, mask); chSchRescheduleS(); chSysUnlock(); }
/** * @brief Signals all the Event Listeners registered on the specified Event * Source. * @details This function variants ORs the specified event flags to all the * threads registered on the @p EventSource in addition to the event * flags specified by the threads themselves in the * @p EventListener objects. * * @param[in] esp pointer to the @p EventSource structure * @param[in] flags the flags set to be added to the listener flags mask * * @api */ void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags) { chSysLock(); chEvtBroadcastFlagsI(esp, flags); chSchRescheduleS(); chSysUnlock(); }
void mpu6050_interrupt_handler(EXTDriver *extp, expchannel_t channel) { (void)extp; (void)channel; chSysLockFromIsr(); chEvtBroadcastFlagsI(&imu_event, EVENT_MASK(0)); chSysUnlockFromIsr(); }
void mpu6050_interrupt_handler(EXTDriver *extp, expchannel_t channel) { (void) extp; (void) channel; chSysLockFromIsr(); chEvtBroadcastFlagsI(&eventImuIrq, EVT_IMU_IRQ); chSysUnlockFromIsr(); }
void hmc5883l_interrupt_handler(EXTDriver *extp, expchannel_t channel) { (void) extp; (void) channel; chSysLockFromIsr(); chEvtBroadcastFlagsI(&eventMagnIrq, EVT_MAGN_IRQ); chSysUnlockFromIsr(); }
/* * data Received Callback * Does nothing but signal the RX thread that the current receive is completed */ void dataReceived(USBDriver *usbp, usbep_t ep){ (void) usbp; (void) ep; //Signals that the current RX is finished chSysLockFromIsr(); chEvtBroadcastFlagsI(&esUsbRxComplete, (flagsmask_t)0); chSysUnlockFromIsr(); }
/** * @brief Common RX ISR handler. * * @param[in] canp pointer to the @p CANDriver object * @param[in] status * @notapi */ static void can_lld_rx_handler(CANDriver *canp, uint32_t status) { /* No more receive events until the queue 0 has been emptied.*/ canp->can->IER &= ~CANIER_RIE; chSysLockFromIsr(); while (chSemGetCounterI(&canp->rxsem) < 0) chSemSignalI(&canp->rxsem); chEvtBroadcastFlagsI(&canp->rxfull_event, CAN_MAILBOX_TO_MASK(1)); chSysUnlockFromIsr(); if (( status & CANICR_DOI) > 0) { /* Overflow events handling.*/ canp->can->CMR = CANCMR_CDO; chSysLockFromIsr(); chEvtBroadcastFlagsI(&canp->error_event, CAN_OVERFLOW_ERROR); chSysUnlockFromIsr(); } }
/* * Handles the USB driver global events. * These events are triggered by the USB driver. */ static void usb_event(USBDriver *usbp, usbevent_t event) { (void) usbp; switch (event) { case USB_EVENT_RESET: /* Signals when a USB reset event has occurred. * Typically this will happen at startup and when the cable * is connected or disconnected. * After a reset, the usb system will not be operational * until it is configured. */ chSysLockFromIsr(); chEvtBroadcastFlagsI(&esUsbReset, (flagsmask_t)0); chSysUnlockFromIsr(); return; case USB_EVENT_ADDRESS: return; case USB_EVENT_CONFIGURED: /* Enables the endpoints specified into the configuration. * Note, this callback is invoked from an ISR so I-Class functions * must be used. */ chSysLockFromIsr(); usbInitEndpointI(usbp, 1, &ep1config); usbInitEndpointI(usbp, 2, &ep2config); /* Signals that the configuration is complete, and the USB system * is ready to be used. */ chEvtBroadcastFlagsI(&esUsbConfigured, (flagsmask_t)0); chSysUnlockFromIsr(); return; case USB_EVENT_SUSPEND: return; case USB_EVENT_WAKEUP: return; case USB_EVENT_STALLED: return; } return; }
void rotenc_push_cb(EXTDriver *extp, expchannel_t channel) { (void)extp; (void)channel; if(ST2MS(chVTTimeElapsedSinceX(rotenc_press_time)) > 500) { chSysLockFromISR(); chEvtBroadcastFlagsI(&rotenc_es, ROTENC_PRESS_FLAG); rotenc_press_time = chVTGetSystemTimeX(); chSysUnlockFromISR(); } }
/** * @brief Common TX ISR handler. * * @param[in] canp pointer to the @p CANDriver object * * @notapi */ static void can_lld_tx_handler(CANDriver *canp) { /* All transmit buffers are available.*/ if (canp->can->GSR & CANGSR_TBS) { chSysLockFromIsr(); while (chSemGetCounterI(&canp->txsem) < 0) chSemSignalI(&canp->txsem); chEvtBroadcastFlagsI(&canp->txempty_event, CAN_MAILBOX_TO_MASK(1)); chSysUnlockFromIsr(); } }
/** * @brief Error ISR handler. * * @param[in] canp pointer to the @p CANDriver object * @param[in] flags * * @notapi */ static void can_lld_error_handler(CANDriver *canp, uint32_t status) { uint32_t flags; /* Error event.*/ /* The high 16-bits of the ICR register (error codes for bus error) is copied unchanged in the upper half word of the listener flags mask.*/ flags = status & 0xFFFF0000; if (status & CANICR_EI) flags |= CAN_WARNING_ERROR; if (status & CANICR_EPI) flags |= CAN_PASSIVE_ERROR; if (status & CANICR_BEI) flags |= CAN_BUS_ERROR; chSysLockFromIsr(); chEvtBroadcastFlagsI(&canp->error_event, flags); chSysUnlockFromIsr(); }
void EvtSource::broadcastFlagsI(flagsmask_t flags) { chEvtBroadcastFlagsI(&ev_source, flags); }
void EvtSource::broadcastFlagsI(eventflags_t flags) { chEvtBroadcastFlagsI(&ev_source, flags); }