本文整理汇总了C++中QACTIVE_POST函数的典型用法代码示例。如果您正苦于以下问题:C++ QACTIVE_POST函数的具体用法?C++ QACTIVE_POST怎么用?C++ QACTIVE_POST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QACTIVE_POST函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Missile_flying
/*..........................................................................*/
QState Missile_flying(Missile *me, QEvt const *e) {
switch (e->sig) {
case TIME_TICK_SIG: {
ObjectImageEvt *oie;
if (me->x + GAME_MISSILE_SPEED_X < GAME_SCREEN_WIDTH) {
me->x += GAME_MISSILE_SPEED_X;
/*tell the Tunnel to draw the Missile and test for wall hits*/
oie = Q_NEW(ObjectImageEvt, MISSILE_IMG_SIG);
oie->x = me->x;
oie->y = me->y;
oie->bmp = MISSILE_BMP;
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
}
else { /* Missile outside the range, make it ready to fire again*/
return Q_TRAN(&Missile_armed);
}
return Q_HANDLED();
}
case HIT_WALL_SIG: {
return Q_TRAN(&Missile_exploding);
}
case DESTROYED_MINE_SIG: {
/* tell the Ship the score for destroing this Mine */
QACTIVE_POST(AO_Ship, e, me);
/* re-arm immediately & let the destroyed Mine do the exploding */
return Q_TRAN(&Missile_armed);
}
}
return Q_SUPER(&QHsm_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:32,代码来源:missile.c
示例2: Ship_exploding
/* ${AOs::Ship::SM::active::exploding} */
static QState Ship_exploding(Ship * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Ship::SM::active::exploding::TIME_TICK} */
case TIME_TICK_SIG: {
/* ${AOs::Ship::SM::active::exploding::TIME_TICK::[me->exp_ctr<1~]} */
if (me->exp_ctr < 15U) {
ObjectImageEvt *oie;
++me->exp_ctr;
/* tell the Tunnel to draw the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
oie->x = me->x; /* x of explosion */
oie->y = (int8_t)((int)me->y - 4U + SHIP_HEIGHT);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
status_ = QM_HANDLED();
}
/* ${AOs::Ship::SM::active::exploding::TIME_TICK::[else]} */
else {
static QMTranActTable const tatbl_ = { /* transition-action table */
&Ship_parked_s,
{
Q_ACTION_CAST(0) /* zero terminator */
}
};
ScoreEvt *gameOver = Q_NEW(ScoreEvt, GAME_OVER_SIG);
gameOver->score = me->score;
QACTIVE_POST(AO_Tunnel, (QEvt *)gameOver, me);
status_ = QM_TRAN(&tatbl_);
}
break;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:33,代码来源:ship.c
示例3: QF_publish_
void QF_publish_(QEvt const * const e, void const * const sender)
#endif
{
QF_CRIT_STAT_
/* make sure that the published signal is within the configured range */
Q_REQUIRE(e->sig < (QSignal)QF_maxSignal_);
QF_CRIT_ENTRY_();
QS_BEGIN_NOCRIT_(QS_QF_PUBLISH, (void *)0, (void *)0)
QS_TIME_(); /* the timestamp */
QS_OBJ_(sender); /* the sender object */
QS_SIG_(e->sig); /* the signal of the event */
QS_2U8_(e->poolId_, e->refCtr_);/* pool Id & ref Count of the event */
QS_END_NOCRIT_()
if (e->poolId_ != (uint8_t)0) { /* is it a dynamic event? */
QF_EVT_REF_CTR_INC_(e); /* increment reference counter, NOTE01 */
}
QF_CRIT_EXIT_();
#if (QF_MAX_ACTIVE <= 8)
{
uint8_t tmp = QF_subscrList_[e->sig].bits[0];
while (tmp != (uint8_t)0) {
uint8_t p = QF_LOG2(tmp);
tmp &= Q_ROM_BYTE(QF_invPwr2Lkup[p]); /* clear subscriber bit */
Q_ASSERT(QF_active_[p] != (QActive *)0); /* must be registered */
/* QACTIVE_POST() asserts internally if the queue overflows */
QACTIVE_POST(QF_active_[p], e, sender);
}
}
#else
{
uint_t i = (uint_t)Q_DIM(QF_subscrList_[0].bits);
do { /* go through all bytes in the subscription list */
uint8_t tmp;
--i;
tmp = QF_PTR_AT_(QF_subscrList_, e->sig).bits[i];
while (tmp != (uint8_t)0) {
uint8_t p = QF_LOG2(tmp);
tmp &= Q_ROM_BYTE(QF_invPwr2Lkup[p]);/*clear subscriber bit */
p = (uint8_t)(p + (uint8_t)(i << 3));/* adjust the priority */
Q_ASSERT(QF_active_[p] != (QActive *)0);/*must be registered*/
/* QACTIVE_POST() asserts internally if the queue overflows */
QACTIVE_POST(QF_active_[p], e, sender);
}
} while (i != (uint_t)0);
}
#endif
QF_gc(e); /* run the garbage collector, see NOTE01 */
}
开发者ID:ATmega8,项目名称:STM32F3_example,代码行数:56,代码来源:qf_pspub.c
示例4: Cruncher_processing
/*..........................................................................*/
QState Cruncher_processing(Cruncher * const me, QEvt const * const e) {
QState status;
switch (e->sig) {
case Q_ENTRY_SIG: {
ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG);
reminder->iter = 0;
QACTIVE_POST((QActive *)me, (QEvt const *)reminder, me);
me->sum = 0.0;
status = Q_HANDLED();
break;
}
case CRUNCH_SIG: {
uint32_t i = ((ReminderEvt const *)e)->iter;
uint32_t n = i;
i += 100;
for (; n < i; ++n) {
if ((n & 1) == 0) {
me->sum += 1.0/(2*n + 1);
}
else {
me->sum -= 1.0/(2*n + 1);
}
}
if (i < 0x07000000) {
ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG);
reminder->iter = i;
QACTIVE_POST((QActive *)me, (QEvt const *)reminder, me);
status = Q_HANDLED();
}
else {
printf("pi=%16.14f\n", 4.0*me->sum);
status = Q_TRAN(&Cruncher_processing);
}
break;
}
case ECHO_SIG: {
printf("Echo! pi=%16.14f\n", 4.0*me->sum);
status = Q_HANDLED();
break;
}
case TERMINATE_SIG: {
status = Q_TRAN(&Cruncher_final);
break;
}
default: {
status = Q_SUPER(&QHsm_top);
break;
}
}
return status;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:52,代码来源:reminder2.c
示例5: Missile_exploding
/*..........................................................................*/
QState Missile_exploding(Missile *me, QEvt const *e) {
switch (e->sig) {
case Q_ENTRY_SIG: {
me->exp_ctr = 0;
return Q_HANDLED();
}
case TIME_TICK_SIG: {
if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15)) {
ObjectImageEvt *oie;
++me->exp_ctr; /* advance the explosion counter */
me->x -= GAME_SPEED_X; /* move the explosion by one step */
/* tell the Tunnel to render the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->x = me->x + 3; /* x-pos of explosion */
oie->y = (int8_t)((int)me->y - 4); /* y-pos */
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
}
else { /* explosion finished or moved outside the game */
return Q_TRAN(&Missile_armed);
}
return Q_HANDLED();
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:26,代码来源:missile.c
示例6: Philo_hungry
/*${AOs::Philo::SM::hungry} ................................................*/
QState Philo_hungry(Philo * const me) {
QState status_;
switch (Q_SIG(me)) {
/*${AOs::Philo::SM::hungry} */
case Q_ENTRY_SIG: {
QACTIVE_POST(&AO_Table, HUNGRY_SIG, me->num);
status_ = Q_HANDLED();
break;
}
/*${AOs::Philo::SM::hungry::EAT} */
case EAT_SIG: {
status_ = Q_TRAN(&Philo_eating);
break;
}
/*${AOs::Philo::SM::hungry::DONE} */
case DONE_SIG: {
Q_ERROR(); /* this event should never arrive in this state */
status_ = Q_HANDLED();
break;
}
default: {
status_ = Q_SUPER(&QHsm_top);
break;
}
}
return status_;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:28,代码来源:philo.c
示例7: Philo_eating
/*${AOs::Philo::SM::eating} ................................................*/
QState Philo_eating(Philo * const me) {
QState status_;
switch (Q_SIG(me)) {
/*${AOs::Philo::SM::eating} */
case Q_ENTRY_SIG: {
me->tickCtr = EAT_TIME;
status_ = Q_HANDLED();
break;
}
/*${AOs::Philo::SM::eating} */
case Q_EXIT_SIG: {
me->tickCtr = 0U;
QACTIVE_POST(QF_ACTIVE_CAST(&AO_Table), DONE_SIG, me->num);
status_ = Q_HANDLED();
break;
}
/*${AOs::Philo::SM::eating::Q_TIMEOUT} */
case Q_TIMEOUT_SIG: {
status_ = Q_TRAN(&Philo_thinking);
break;
}
/*${AOs::Philo::SM::eating::EAT, DONE} */
case EAT_SIG: /* intentionally fall through */
case DONE_SIG: {
Q_ERROR(); /* these events should never arrive in this state */
status_ = Q_HANDLED();
break;
}
default: {
status_ = Q_SUPER(&QHsm_top);
break;
}
}
return status_;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:36,代码来源:philo.c
示例8: Ship_exploding
/* @(/2/1/4/1/4) ...........................................................*/
static QState Ship_exploding(Ship * const me, QEvt const * const e) {
QState status;
switch (e->sig) {
/* @(/2/1/4/1/4) */
case Q_ENTRY_SIG: {
me->exp_ctr = 0U;
status = Q_HANDLED();
break;
}
/* @(/2/1/4/1/4/0) */
case TIME_TICK_SIG: {
/* @(/2/1/4/1/4/0/0) */
if (me->exp_ctr < 15U) {
++me->exp_ctr;
/* tell the Tunnel to draw the current stage of Explosion */
QACTIVE_POST(AO_Tunnel,
(QEvt *)Q_NEW(ObjectImageEvt, EXPLOSION_SIG,
me->x,
(int8_t)((int)me->y - 4 + SHIP_HEIGHT),
EXPLOSION0_BMP + (me->exp_ctr >> 2)),
me);
status = Q_HANDLED();
}
/* @(/2/1/4/1/4/0/1) */
else {
QACTIVE_POST(AO_Tunnel,
(QEvt *)Q_NEW(ScoreEvt, GAME_OVER_SIG, me->score),
me);
status = Q_TRAN(&Ship_parked);
}
break;
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:33,代码来源:ship.c
示例9: Mine2_exploding
/* ${AOs::Mine2::SM::used::exploding} */
static QState Mine2_exploding(Mine2 * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Mine2::SM::used::exploding::TIME_TICK} */
case TIME_TICK_SIG: {
/* ${AOs::Mine2::SM::used::exploding::TIME_TICK::[stillonscreen?]} */
if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15U)) {
ObjectImageEvt *oie;
++me->exp_ctr; /* advance the explosion counter */
me->x -= GAME_SPEED_X; /* move explosion by 1 step */
/* tell the Game to render the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->x = me->x + 1U; /* x of explosion */
oie->y = (int8_t)((int)me->y - 4 + 2); /* y of explosion */
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
status_ = QM_HANDLED();
}
/* ${AOs::Mine2::SM::used::exploding::TIME_TICK::[else]} */
else {
static struct {
QMState const *target;
QActionHandler act[2];
} const tatbl_ = { /* transition-action table */
&Mine2_unused_s, /* target state */
{
Q_ACTION_CAST(&Mine2_used_x), /* exit */
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
}
break;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:36,代码来源:mine2.c
示例10: INT_Excep_IRQ9
//;0x0124 IRQ9
void INT_Excep_IRQ9(void) {
QF_ISR_ENTRY(); /* inform the QF Vanilla kernel about entering the ISR */
QACTIVE_POST(AO_Philo[1], Q_NEW(QEvt, MAX_PUB_SIG), /* for testing... */
&QS_Excep_IRQ9);
QF_ISR_EXIT(); /* inform the QF Vanilla kernel about exiting the ISR */
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:8,代码来源:interrupt_handlers.c
示例11: Missile_exploding
/* ${AOs::Missile::SM::exploding} */
static QState Missile_exploding(Missile * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::Missile::SM::exploding::TIME_TICK} */
case TIME_TICK_SIG: {
/* ${AOs::Missile::SM::exploding::TIME_TICK::[(me->x>=GAME_SPEED_X)&&(me->exp~} */
if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15U)) {
ObjectImageEvt *oie;
++me->exp_ctr; /* advance the explosion counter */
me->x -= GAME_SPEED_X; /* move the explosion by one step */
/* tell the Tunnel to render the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->x = me->x + 3U; /* x-pos of explosion */
oie->y = (int8_t)((int)me->y - 4U); /* y-pos */
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
status_ = QM_HANDLED();
}
/* ${AOs::Missile::SM::exploding::TIME_TICK::[else]} */
else {
static QMTranActTable const tatbl_ = { /* transition-action table */
&Missile_armed_s,
{
Q_ACTION_CAST(0) /* zero terminator */
}
};
status_ = QM_TRAN(&tatbl_);
}
break;
}
开发者ID:juhnowski,项目名称:LM3S811,代码行数:33,代码来源:missile.c
示例12: Mine2_exploding
/*..........................................................................*/
QState Mine2_exploding(Mine2 *me, QEvt const *e) {
switch (e->sig) {
case Q_ENTRY_SIG: {
me->exp_ctr = 0;
return Q_HANDLED();
}
case TIME_TICK_SIG: {
if ((me->x >= GAME_SPEED_X) && (me->exp_ctr < 15)) {
ObjectImageEvt *oie;
++me->exp_ctr; /* advance the explosion counter */
me->x -= GAME_SPEED_X; /* move explosion by 1 step */
/* tell the Game to render the current stage of Explosion */
oie = Q_NEW(ObjectImageEvt, EXPLOSION_SIG);
oie->x = me->x + 1; /* x of explosion */
oie->y = (int8_t)((int)me->y - 4 + 2); /* y of explosion */
oie->bmp = EXPLOSION0_BMP + (me->exp_ctr >> 2);
QACTIVE_POST(AO_Tunnel, (QEvt *)oie, me);
}
else {
return Q_TRAN(&Mine2_unused);
}
return Q_HANDLED();
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:26,代码来源:mine2.c
示例13: Philo_hungry
/* @(/2/0/2/2) .............................................................*/
QState Philo_hungry(Philo *me, QEvent const *e) {
switch (e->sig) {
/* @(/2/0/2/2) */
case Q_ENTRY_SIG: {
TableEvt *pe = Q_NEW(TableEvt, HUNGRY_SIG);
pe->philoNum = PHILO_ID(me);
QACTIVE_POST(AO_Table, (QEvent const *)pe, me);
return Q_HANDLED();
}
/* @(/2/0/2/2/0) */
case EAT_SIG: {
/* @(/2/0/2/2/0/0) */
if (((TableEvt const *)e)->philoNum == PHILO_ID(me)) {
BSP_busyDelay();
return Q_TRAN(&Philo_eating);
}
break;
}
/* @(/2/0/2/2/1) */
case TERMINATE_SIG: /* intentionally fall through */
case DONE_SIG: {
Q_ERROR();
return Q_HANDLED();
}
}
return Q_SUPER(&QHsm_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:28,代码来源:philo.c
示例14: INT_Excep_IRQ10
//;0x0128 IRQ10
void INT_Excep_IRQ10(void) {
QK_ISR_ENTRY(); /* inform the QK kernel about entering the ISR */
QACTIVE_POST(AO_Table, Q_NEW(QEvt, MAX_PUB_SIG), /* for testing... */
&QS_Excep_IRQ10);
QK_ISR_EXIT(); /* inform the QK kernel about exiting the ISR */
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:8,代码来源:interrupt_handlers.c
示例15: QF_tick
void QF_tick(void) { /* see NOTE01 */
#else
void QF_tick(void const *sender) {
#endif
QTimeEvt *t;
QF_CRIT_STAT_
QF_CRIT_ENTRY_();
QS_BEGIN_NOCRIT_(QS_QF_TICK, (void *)0, (void *)0)
QS_TEC_((QTimeEvtCtr)(++QS_tickCtr_)); /* the tick counter */
QS_END_NOCRIT_()
t = QF_timeEvtListHead_;
while (t != (QTimeEvt *)0) {
--t->ctr;
if (t->ctr == (QTimeEvtCtr)0) { /* is time evt about to expire? */
if (t->interval != (QTimeEvtCtr)0) { /* is it periodic timeout? */
t->ctr = t->interval; /* rearm the time event */
}
else { /* one-shot timeout, disarm by removing it from the list */
if (t == QF_timeEvtListHead_) {
QF_timeEvtListHead_ = t->next;
}
else {
if (t->next != (QTimeEvt *)0) { /* not the last event? */
t->next->prev = t->prev;
}
t->prev->next = t->next;
}
t->prev = (QTimeEvt *)0; /* mark the event disarmed */
QS_BEGIN_NOCRIT_(QS_QF_TIMEEVT_AUTO_DISARM, QS_teObj_, t)
QS_OBJ_(t); /* this time event object */
QS_OBJ_(t->act); /* the active object */
QS_END_NOCRIT_()
}
QS_BEGIN_NOCRIT_(QS_QF_TIMEEVT_POST, QS_teObj_, t)
QS_TIME_(); /* timestamp */
QS_OBJ_(t); /* the time event object */
QS_SIG_(t->super.sig); /* signal of this time event */
QS_OBJ_(t->act); /* the active object */
QS_END_NOCRIT_()
QF_CRIT_EXIT_();/* exit crit. section before calling QF service */
/* QACTIVE_POST() asserts internally if the queue overflows */
QACTIVE_POST(t->act, &t->super, sender);
}
else {
static uint8_t volatile dummy;
QF_CRIT_EXIT_();
dummy = (uint8_t)0; /* execute a few instructions, see NOTE02 */
}
QF_CRIT_ENTRY_(); /* enter crit. section again to advance the link */
t = t->next;
}
开发者ID:voileravi,项目名称:zen,代码行数:60,代码来源:qf_tick.c
示例16: Cruncher_processing
/*..........................................................................*/
QState Cruncher_processing(Cruncher * const me) {
QState status;
switch (Q_SIG(me)) {
case Q_ENTRY_SIG: {
QACTIVE_POST(&me->super, CRUNCH_SIG, 0);
me->sum = 0.0;
status = Q_HANDLED();
break;
}
case CRUNCH_SIG: {
uint32_t i = Q_PAR(me);
uint32_t n = i;
i += 100U;
for (; n < i; ++n) {
if ((n & 1) == 0) {
me->sum += 1.0/(2*n + 1);
}
else {
me->sum -= 1.0/(2*n + 1);
}
}
if (i < 0x07000000U) {
QACTIVE_POST(&me->super, CRUNCH_SIG, i);
status = Q_HANDLED();
}
else {
BSP_result(me->sum);
status = Q_TRAN(&Cruncher_processing);
}
break;
}
case ECHO_SIG: {
BSP_echo(me->sum);
status = Q_HANDLED();
break;
}
case TERMINATE_SIG: {
status = Q_TRAN(&Cruncher_final);
break;
}
default: {
status = Q_SUPER(&QHsm_top);
break;
}
}
return status;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:48,代码来源:reminder2.c
示例17: on_ancs_c_evt
/**@brief Function for handling the Apple Notification Service client.
*
* @details This function is called for all events in the Apple Notification client that
* are passed to the application.
*
* @param[in] p_evt Event received from the Apple Notification Service client.
*/
static void on_ancs_c_evt(ble_ancs_c_evt_t * p_evt)
{
uint32_t err_code = NRF_SUCCESS;
switch (p_evt->evt_type) {
case BLE_ANCS_C_EVT_DISCOVERY_COMPLETE:
QS_BEGIN(TRACE_ANCS_EVT, &l_SD)
QS_U8(0, p_evt->evt_type);
QS_END() QS_START_TX();
err_code = ble_ancs_c_handles_assign(&m_ancs_c,p_evt->conn_handle
, &p_evt->service);
APP_ERROR_CHECK(err_code);
#if 0
apple_notification_setup();
#else
QACTIVE_POST(AO_ble, ANCS_SIG, p_evt->evt_type);
#endif
break;
case BLE_ANCS_C_EVT_NOTIF: {
struct AncsNotification* status =
&l_Ble.ancs_status[p_evt->notif.category_id];
status->flags = p_evt->notif.evt_flags;
status->category_count = p_evt->notif.category_count;
QS_BEGIN(TRACE_ANCS_EVT, &l_SD)
QS_U8(0, p_evt->evt_type);
QS_U8(0, p_evt->notif.evt_id);
QS_MEM((uint8_t*)&status->flags, sizeof(status->flags));
QS_END() QS_START_TX();
QACTIVE_POST(AO_ble, ANCS_SIG
, ((uint32_t)p_evt->notif.evt_id << 24) //Add/Mod/Remove
| 0 // flags might not fit into 8 bits if compiler doesn't pack
| ((uint16_t)p_evt->notif.category_id << 8)//email, etc
| p_evt->evt_type);
} break;
//case BLE_ANCS_C_EVT_NOTIF_ATTRIBUTE: //title, message, date, etc
default:
QS_BEGIN(TRACE_ANCS_EVT, &l_SD)
QS_U8(0, p_evt->evt_type);
QS_END() QS_START_TX();
break;
}
}
开发者ID:henrychoi,项目名称:realtime,代码行数:54,代码来源:ble.c
示例18: FlashMgr_BusyFlash
/*${AOs::FlashMgr::SM::Active::BusyFlash} ..................................*/
static QState FlashMgr_BusyFlash(FlashMgr * const me, QEvt const * const e) {
QState status_;
switch (e->sig) {
/* ${AOs::FlashMgr::SM::Active::BusyFlash} */
case Q_ENTRY_SIG: {
/* Arm the timer so if the message can't be processed for some reason, we can get
* back to idle state. This timer may be re-armed if some messages require more
* time to process than others. */
QTimeEvt_rearm( /* Re-arm timer on entry */
&me->flashTimerEvt,
SEC_TO_TICKS( HL_MAX_TOUT_SEC_FLASH_FW )
);
FLASH_Unlock();/* Always unlock the flash on entry since we'll be doing stuff to it */
/* Reset all the variables that keep track of FW upgrades on entry so they are
* guaranteed to be cleared when we start any new operation */
memset( me->flashSectorsToErase, 0, sizeof(me->flashSectorsToErase) );
me->flashSectorsToEraseIndex = 0;
me->flashSectorsToEraseNum = 0;
me->fwPacketCurr = 0;
me->fwPacketExp = 0;
me->retryCurr = 0;
status_ = Q_HANDLED();
break;
}
/* ${AOs::FlashMgr::SM::Active::BusyFlash} */
case Q_EXIT_SIG: {
QTimeEvt_disarm(&me->flashTimerEvt); /* Disarm timer on exit */
FLASH_Lock(); /* Always lock the flash on exit */
/* Always send a flash status event to the CommMgr AO with the current error code */
FlashStatusEvt *evt = Q_NEW(FlashStatusEvt, FLASH_OP_DONE_SIG);
evt->errorCode = me->errorCode;
QACTIVE_POST(AO_CommMgr, (QEvt *)(evt), AO_FlashMgr);
status_ = Q_HANDLED();
break;
}
/* ${AOs::FlashMgr::SM::Active::BusyFlash::FLASH_TIMEOUT} */
case FLASH_TIMEOUT_SIG: {
ERR_printf("Timeout trying to process flash request, error: 0x%08x\n", me->errorCode);
status_ = Q_TRAN(&FlashMgr_Idle);
break;
}
/* ${AOs::FlashMgr::SM::Active::BusyFlash::FLASH_ERROR} */
case FLASH_ERROR_SIG: {
ERR_printf("Unable to to process flash request. Error: 0x%08x\n", me->errorCode);
status_ = Q_TRAN(&FlashMgr_Idle);
break;
}
default: {
status_ = Q_SUPER(&FlashMgr_Active);
break;
}
}
return status_;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:60,代码来源:FlashMgr.c
示例19: BSP_onKeyboardInput
/*..........................................................................*/
void BSP_onKeyboardInput(uint8_t key) {
switch (key) {
case 'e': {
static QEvt const echoEvt = { ECHO_SIG, 0U, 0U };
QACTIVE_POST((QActive *)&l_cruncher, &echoEvt, (void *)0);
break;
}
case '\033': { /* ESC pressed? */
/* NOTE: this constant event is statically pre-allocated.
* It can be posted/published as any other event.
*/
static QEvt const terminateEvt = { TERMINATE_SIG, 0U, 0U };
QACTIVE_POST((QActive *)&l_cruncher, &terminateEvt, (void *)0);
break;
}
}
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:18,代码来源:reminder2.c
示例20: EXTI0_IRQHandler
void EXTI0_IRQHandler(void) {
QK_ISR_ENTRY(); /* inform QK-nano about ISR entry */
EXTI->PR = 0x1; /* set the EXTI->PR[0] to clear the EXTI_SWIER[0] bit */
/* for testing */
QACTIVE_POST(AO_Table, Q_NEW(QEvent, MAX_PUB_SIG), (void *)0);
QK_ISR_EXIT(); /* inform QK-nano about ISR exit */
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:9,代码来源:bsp.c
注:本文中的QACTIVE_POST函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论