#include "myrtos.h"



osThreadId_t measureTaskHandle;
const osThreadAttr_t measureTask_attributes = {
  .name = "measureTask",
  .stack_size = 6144 * 4,
  .priority = (osPriority_t) osPriorityLow,
};
__weak void measureTask(void *argument)
{
    for (;;)
    { 
        osDelay(1); 
    }
}

osTimerId_t measureTimerHandle;
const osTimerAttr_t measureTimer_attributes = {
  .name = "measureTimer"
};
__weak void measureTimer_Callback(void *argument)
{
}


/*  放在尾部 否则要在头文件 声明函数*/
void RTOS_Port(void)
{
  measureTaskHandle = osThreadNew( measureTask, NULL, &measureTask_attributes );
  measureTimerHandle = osTimerNew(measureTimer_Callback, osTimerPeriodic, NULL, &measureTimer_attributes);
}

// 事件
// osEventFlagsId_t ads1115EventHandle;
// const osEventFlagsAttr_t ads1115Event_attributes = {
//   .name = "ads1115Event"
// };
//  typedef enum
// {
//     EV_READY,                   /*!< Startup finished. */
//     EV_FRAME_RECEIVED,          /*!< Frame received. */
//     EV_EXECUTE,                 /*!< Execute function. */
//     EV_FRAME_SENT               /*!< Frame sent. */
// } eMBEventType;
// myEvent01Handle = osEventFlagsNew(&myEvent01_attributes);
// osEventFlagsSet(modbusEventHandle,eEvent);
    // osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags)
// recvedEvent = osEventFlagsWait (modbusEventHandle,
//                                     EV_READY | EV_FRAME_RECEIVED | EV_EXECUTE |
//                                         EV_FRAME_SENT, /* 接收任务感兴趣的事件                                                       */
//                                     0,  
//                                     portMAX_DELAY); /* 指定超时事件,无限等待 */


// osMessageQueueId_t TestQQueueueueHandle;
// osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
// osMessageQueueGet(TestQueueHandle,osWaitForever);
// osStatus_t osMessageQueueGet ( osMessageQueueId_t  mq_id,
// void *  msg_ptr,       //储存读取结果的变量地址
// uint8_t *  msg_prio,  // ==NULL
// uint32_t  timeout    //阻塞超时时间
// );
// osStatus_t osMessageQueuePut ( osMessageQueueId_t  mq_id,
// const void *  msg_ptr,     //储存写入内容的变量地址
// uint8_t  msg_prio,        //==0U
// uint32_t  timeout         //阻塞超时时间
// );
//  osMessageQueueReset
// /*获取队列可容纳的消息(变量)数量; []
// 两个参数分别为：消息队列的句柄，等待时间（此时为一直等待）