完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
static TaskHandle_t xTaskToNotify = NULL;
/* The peripheral driver's transmit function. */ void StartTransmission( uint8_t *pcData, size_t xDataLength ) { /* At this point xTaskToNotify should be NULL as no transmission is in progress. A mutex can be used to guard access to the peripheral if necessary. */ configASSERT( xTaskToNotify == NULL ); /* Store the handle of the calling task. */ xTaskToNotify = xTaskGetCurrentTaskHandle(); /* Start the transmission - an interrupt is generated when the transmission is complete. */ vStartTransmit( pcData, xDatalength ); } /*-----------------------------------------------------------*/ /* The transmit end interrupt. */ void vTransmitEndISR( void ) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; /* At this point xTaskToNotify should not be NULL as a transmission was in progress. */ configASSERT( xTaskToNotify != NULL ); /* Notify the task that the transmission is complete. */ vTaskNotifyGiveFromISR( xTaskToNotify, &xHigherPriorityTaskWoken ); /* There are no transmissions in progress, so no tasks to notify. */ xTaskToNotify = NULL; /* If xHigherPriorityTaskWoken is now set to pdTRUE then a context switch should be performed to ensure the interrupt returns directly to the highest priority task. The macro used for this purpose is dependent on the port in use and may be called portEND_SWITCHING_ISR(). */ portYIELD_FROM_ISR( xHigherPriorityTaskWoken ); } /*-----------------------------------------------------------*/ /* The task that initiates the transmission, then enters the Blocked state (so not consuming any CPU time) to wait for it to complete. */ void vAFunctionCalledFromATask( uint8_t ucDataToTransmit, size_t xDataLength ) { uint32_t ulNotificationValue; const TickType_t xMaxBlockTime = pdMS_TO_TICKS( 200 ); /* Start the transmission by calling the function shown above. */ StartTransmission( ucDataToTransmit, xDataLength ); /* Wait for the transmission to complete. */ ulNotificationValue = ulTaskNotifyTake( pdFALSE, xMaxBlockTime ); if( ulNotificationValue == 1 ) { /* The transmission ended as expected. */ } else { /* The call to ulTaskNotifyTake() timed out. */ } } 这是官网范例,按照范例来写 |
|
|
|
只有小组成员才能发言,加入小组>>
695 浏览 0 评论
1106 浏览 1 评论
2473 浏览 5 评论
2808 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2646 浏览 6 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
655浏览 9评论
651浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
783浏览 6评论
630浏览 5评论
670浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-22 17:49 , Processed in 1.016730 second(s), Total 77, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号