• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ osal_set_event函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中osal_set_event函数的典型用法代码示例。如果您正苦于以下问题:C++ osal_set_event函数的具体用法?C++ osal_set_event怎么用?C++ osal_set_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了osal_set_event函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: zb_HandleOsalEvent

/******************************************************************************
 * @fn          zb_HandleOsalEvent
 *
 * @brief       The zb_HandleOsalEvent function is called by the operating
 *              system when a task event is set
 *
 * @param       event - Bitmask containing the events that have been set
 *
 * @return      none
 */
void zb_HandleOsalEvent( uint16 event )
{

  
  if(event & SYS_EVENT_MSG)
  {
    
  }
  
  if ( event & MY_START_EVT )
  {
    zb_StartRequest();
  }
  
  if ( event & MY_REPORT_EVT )
  {
   if (appState == APP_BINDED) 
    {

    }
   else
   {
     osal_set_event( sapi_TaskID, MY_FIND_COLLECTOR_EVT);
   }
  }
  if ( event & MY_FIND_COLLECTOR_EVT )
  { 
    // Find and bind to a gateway device (if this node is not gateway)
      zb_BindDevice( TRUE, DUMMY_REPORT_CMD_ID, (uint8 *)NULL );

  }
  
}
开发者ID:DIYzzuzpb,项目名称:ZStack-CC2530-2.5.1-GPRS_GateWay,代码行数:43,代码来源:Router.c


示例2: oadManagerSvcDiscoveryMsg

/*********************************************************************
 * @fn      oadManagerSvcDiscoveryMsg
 *
 * @brief   Process GATT Primary Service discovery message
 *
 * @return  none
 */
static void oadManagerSvcDiscoveryMsg(gattMsgEvent_t *pMsg)
{
  if ( pMsg->hdr.status == SUCCESS ) // Characteristic found, the store handle.
  {
    attFindByTypeValueRsp_t *pRsp = &(pMsg->msg.findByTypeValueRsp);

    if ( pRsp->numInfo > 0 )
    {
      oadSvcStartHdl = pRsp->handlesInfo[0].handle;
      oadSvcEndHdl = pRsp->handlesInfo[0].grpEndHandle;

#if (defined HAL_LCD) && (HAL_LCD == TRUE)
      LCD_WRITE_STRING("OAD Svc Found!", HAL_LCD_LINE_1);
#endif
      // OAD service found
      (void)osal_set_event(oadManagerTaskId, CCC_DISCOVERY_EVT);
    }
  }
  else if ( pMsg->hdr.status == bleProcedureComplete )
  {
    if ( oadSvcStartHdl == 0 )
    {
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
        LCD_WRITE_STRING("OAD SvcNotFound", HAL_LCD_LINE_3);
#endif
    }
  }
}
开发者ID:Mecabot,项目名称:BLE-CC254x-1.4.0,代码行数:35,代码来源:oad_mgr_app.c


示例3: zb_SendDataConfirm

/******************************************************************************
 * @fn          zb_SendDataConfirm
 *
 * @brief       The zb_SendDataConfirm callback function is called by the
 *              ZigBee after a send data operation completes
 *
 * @param       handle - The handle identifying the data transmission.
 *              status - The status of the operation.
 *
 * @return      none
 */
void zb_SendDataConfirm( uint8 handle, uint8 status )
{
  if(status != ZB_SUCCESS) 
  {
    if ( ++reportFailureNr >= REPORT_FAILURE_LIMIT ) 
    {
       // Stop reporting
       osal_stop_timerEx( sapi_TaskID, MY_REPORT_EVT );
       
       // After failure reporting start automatically when the device
       // is binded to a new gateway
       reportState=TRUE;
        
       // Try binding to a new gateway
       osal_set_event( sapi_TaskID, MY_FIND_COLLECTOR_EVT );
       reportFailureNr=0;
    }
  }
  // status == SUCCESS
  else 
  {
    // Reset failure counter
    reportFailureNr=0;
  }
}
开发者ID:smileboywtu,项目名称:ZigbeeLcdStack,代码行数:36,代码来源:DemoSensor.c


示例4: OADManager_Init

/*********************************************************************
 * @fn      OADManager_Init
 *
 * @brief   Initialization function for the OAD Manager App Task.
 *          This is called during initialization and should contain
 *          any application specific initialization (ie. hardware
 *          initialization/setup, table initialization, power up
 *          notification).
 *
 * @param   task_id - the ID assigned by OSAL.  This ID should be
 *                    used to send messages and set timers.
 *
 * @return  none
 */
void OADManager_Init( uint8 task_id )
{
  oadManagerTaskId = task_id;

  // Setup Central Profile
  {
    uint8 scanRes = DEFAULT_MAX_SCAN_RES;
    GAPCentralRole_SetParameter ( GAPCENTRALROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
  }

  // Setup GAP
  GAP_SetParamValue( TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION );
  GAP_SetParamValue( TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION );
  GAP_SetParamValue( TGAP_REJECT_CONN_PARAMS, DEFAULT_OAD_REJECT_CONN_PARAMS ); 
  
  GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (uint8 *) oadManagerDeviceName );

  // Initialize GATT Client
  VOID GATT_InitClient();

  // Register to receive incoming ATT Indications/Notifications
  GATT_RegisterForInd( task_id );

#if (defined HAL_KEY) && (HAL_KEY == TRUE)
  // Register for all key events - This app will handle all key events
  RegisterForKeys( task_id );
#endif
#if (defined HAL_LED) && (HAL_LED == TRUE)
  HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
#endif

  // Setup a delayed profile startup
  osal_set_event( task_id, START_DEVICE_EVT );
}
开发者ID:Mecabot,项目名称:BLE-CC254x-1.4.0,代码行数:48,代码来源:oad_mgr_app.c


示例5: bedChangeCB

/*********************************************************************
 * @fn      bedChangeCB
 *
 * @brief   Callback from BedProfile indicating a value change
 *
 * @param   paramID - parameter ID of the value that was changed.
 *
 * @return  none
 */
static void bedChangeCB( uint8 paramID )
{
  /*
  if (paramID == BED_CONF)
  {
    uint8 newValue;

    Gyro_GetParameter( BED_CONF, &newValue );

    if (newValue == 0)
    {
      // Put sensor to sleep
      if (bedEnabled)
      {
        bedEnabled = FALSE;
        osal_set_event( sensorTag_TaskID, ST_BED_SENSOR_EVT);
      }
    }
    else
    {
    */ 
      bedEnabled = TRUE;
      osal_set_event( sensorTag_TaskID,  ST_BED_SENSOR_EVT);
    //}
  //} // should not get here
}
开发者ID:element14,项目名称:nocturne,代码行数:35,代码来源:SensorTag.c


示例6: zapZdoProcessIncoming

/**************************************************************************************************
 * @fn          zapZdoProcessIncoming
 *
 * @brief       This function processes the ZDO sub-system response from the ZNP.
 *
 * input parameters
 *
 * @param       port - Port Id corresponding to the ZNP that sent the message.
 * @param       pBuf - A pointer to the RPC response.
 *
 * output parameters
 *
 * None.
 *
 * @return      None.
 **************************************************************************************************
 */
void zapZdoProcessIncoming(uint8 port, uint8 *pBuf)
{
  uint8 len = pBuf[MT_RPC_POS_LEN];
  uint8 cmd1 = pBuf[MT_RPC_POS_CMD1];

  pBuf += MT_RPC_FRAME_HDR_SZ;

  switch (cmd1)
  {
  case MT_ZDO_STATUS_ERROR_RSP:  // TODO: fill-in when/if needed.
    break;

  case MT_ZDO_STATE_CHANGE_IND:
    // Especially for UART transport, allow time for multiple got syncs before acting on it.
    if (ZSuccess != osal_start_timerEx(zapTaskId, ZAP_APP_ZDO_STATE_CHANGE_EVT,
                                                  ZAP_APP_ZDO_STATE_CHANGE_DLY))
    {
      (void)osal_set_event(zapTaskId, ZAP_APP_ZDO_STATE_CHANGE_EVT);
    }
    break;

  case MT_ZDO_MATCH_DESC_RSP_SENT:  // TODO: fill-in when/if needed.
    break;

  case MT_ZDO_SRC_RTG_IND:  // TODO: fill-in when/if needed.
    break;

  case MT_ZDO_JOIN_CNF:  // TODO: fill-in when/if needed.
    break;

  case MT_ZDO_CONCENTRATOR_IND_CB:
    zapZDO_ConcentratorIndicationCB(pBuf);
    break;

  case MT_ZDO_MSG_CB_INCOMING:
    {
      zdoIncomingMsg_t inMsg;

      // Assuming exclusive use of network short addresses.
      inMsg.srcAddr.addrMode = Addr16Bit;
      inMsg.srcAddr.addr.shortAddr = BUILD_UINT16(pBuf[0], pBuf[1]);
      pBuf += 2;
      inMsg.wasBroadcast = *pBuf++;
      inMsg.clusterID = BUILD_UINT16(pBuf[0], pBuf[1]);
      pBuf += 2;
      inMsg.SecurityUse = *pBuf++;
      inMsg.TransSeq = *pBuf++;
      inMsg.asduLen = len-9;
      inMsg.macDestAddr = BUILD_UINT16(pBuf[0], pBuf[1]);
      pBuf += 2;
      inMsg.asdu = pBuf;

      ZDO_SendMsgCBs(&inMsg);
    }
    break;

  default:
    break;
  }
}
开发者ID:MobileHealthMonitoringSystem,项目名称:MHMS,代码行数:77,代码来源:zap_zdo.c


示例7: HAL_ISR_FUNCTION

HAL_ISR_FUNCTION(port2Isr, P2INT_VECTOR)
{
  unsigned char status;
  unsigned char i;

  HAL_ENTER_ISR();

  status = P2IFG;
  status &= P2IEN;
  if (status)
  {
    P2IFG = ~status;
    P2IF = 0;

    for (i = 0; i < OS_MAX_INTERRUPT; i++)
    {
      if (PIN_MAJOR(blueBasic_interrupts[i].pin) == 2 && (status & (1 << PIN_MINOR(blueBasic_interrupts[i].pin))))
      {
        osal_set_event(blueBasic_TaskID, BLUEBASIC_EVENT_INTERRUPT << i);
      }
    }
  }

  HAL_EXIT_ISR();
}
开发者ID:JBtje,项目名称:BlueBasic,代码行数:25,代码来源:BlueBasic.c


示例8: timeAppPairStateCB

/*********************************************************************
 * @fn      pairStateCB
 *
 * @brief   Pairing state callback.
 *
 * @return  none
 */
static void timeAppPairStateCB( uint16 connHandle, uint8 state, uint8 status )
{
  if ( state == GAPBOND_PAIRING_STATE_STARTED )
  {
    timeAppPairingStarted = TRUE;
  }
  else if ( state == GAPBOND_PAIRING_STATE_COMPLETE )
  {
    timeAppPairingStarted = FALSE;

    if ( status == SUCCESS )
    {
      linkDBItem_t  *pItem;
      
      if ( (pItem = linkDB_Find( gapConnHandle )) != NULL )
      {
        // Store bonding state of pairing
        timeAppBonded = ( (pItem->stateFlags & LINK_BOUND) == LINK_BOUND );
        
        if ( timeAppBonded )
        {
          osal_memcpy( timeAppBondedAddr, pItem->addr, B_ADDR_LEN );
        }
      }
      
      // If discovery was postponed start discovery
      if ( timeAppDiscPostponed && timeAppDiscoveryCmpl == FALSE )
      {
        timeAppDiscPostponed = FALSE;
        osal_set_event( bloodPressureTaskId, BP_START_DISCOVERY_EVT );
      }
    }
  }
}
开发者ID:AubrCool,项目名称:BLE,代码行数:41,代码来源:bloodPressure.c


示例9: oadManagerCharDiscovery

/*********************************************************************
 * @fn      oadManagerCharDiscovery
 *
 * @brief   OAD Characteristics service discovery.
 *
 * @return  none
 */
static void oadManagerCharDiscovery(void)
{
  attReadByTypeReq_t req;

  req.startHandle = oadSvcStartHdl;
  req.endHandle = oadSvcEndHdl;
  req.type.len = ATT_UUID_SIZE;

  if ( oadManagerDiscIdx == 0 )
  {
    uint8 oadCharUUID[ATT_UUID_SIZE] = { TI_BASE_UUID_128( OAD_IMG_IDENTIFY_UUID ) };

    (void)osal_memcpy(req.type.uuid, oadCharUUID, ATT_UUID_SIZE);
  }
  else
  {
    uint8 oadCharUUID[ATT_UUID_SIZE] = { TI_BASE_UUID_128( OAD_IMG_BLOCK_UUID ) };

    (void)osal_memcpy(req.type.uuid, oadCharUUID, ATT_UUID_SIZE);
  }

  if (GATT_DiscCharsByUUID(oadManagerConnHandle, &req, oadManagerTaskId) != SUCCESS)
  {
    (void)osal_set_event(oadManagerTaskId, CHAR_DISCOVERY_EVT);
  }
}
开发者ID:Mecabot,项目名称:BLE-CC254x-1.4.0,代码行数:33,代码来源:oad_mgr_app.c


示例10: pulseNodeCheckIn

static void pulseNodeCheckIn(void)
{

  static bool Flag;
  afAddrType_t addr;                    //AF address stucture defined for info on the destination Endpoint object that data will be sent to
  
  osal_stop_timerEx(pulseTaskId, PULSE_EVT_REQ); //Stop pulseDataReq() task since no pulse data is being measured
  PulseEvtReq_sync = FALSE;
  Flag = FALSE;
  addr.addr.shortAddr = pulseAddr;      //loading short address (16-bit) with pulse address
  addr.addrMode = afAddr16Bit;          //Set to directly sent to a node
  addr.endPoint = PULSE_ENDPOINT;       //Sets the endpoint of the final destination (coordinator?)

  pulseDat[PULSE_CHECK_IN] = CHECK_IN_ACTIVE;   //Flag is set and will notify coordinator that node is currently sending check in data
  HalLcdWriteString("BPMsensor Inacti",HAL_LCD_LINE_5);

  if (afStatus_SUCCESS != AF_DataRequest(&addr, (endPointDesc_t *)&PULSE_epDesc, PULSE_CLUSTER_ID,
                                          PULSE_DAT_LEN, pulseDat, &pulseTSN, AF_DISCV_ROUTE,AF_DEFAULT_RADIUS))
    { //if data transfer is unsuccessful place event immediately back into queue to attempt to send again
        osal_set_event(pulseTaskId, PULSE_EVT_CHECKIN);
  }
  else
  {
    pulseCnt++;
  }

  if((QS == FALSE) && (Flag == FALSE)){
    osal_start_timerEx(pulseTaskId, PULSE_EVT_CHECKIN, PULSE_DLY_CHECKIN);  //send check in dummy packet every 10 seconds
    Flag = TRUE;  //to prevent restarting of timer if existing already running
     
  }
  
}
开发者ID:MobileHealthMonitoringSystem,项目名称:MHMS,代码行数:33,代码来源:tvsa.c


示例11: barometerChangeCB

/*********************************************************************
 * @fn      barometerChangeCB
 *
 * @brief   Callback from Barometer Service indicating a value change
 *
 * @param   paramID - parameter ID of the value that was changed.
 *
 * @return  none
 */
static void barometerChangeCB( uint8 paramID )
{
  uint8 newValue;

  switch( paramID )
  {
    case SENSOR_CONF:
      Barometer_GetParameter( SENSOR_CONF, &newValue );

      switch ( newValue)
      {
      case ST_CFG_SENSOR_DISABLE:
        if (barEnabled)
        {
          barEnabled = FALSE;
          osal_set_event( sensorTag_TaskID, ST_BAROMETER_SENSOR_EVT);
        }
        break;

      case ST_CFG_SENSOR_ENABLE:
        if(!barEnabled)
        {
          barEnabled = TRUE;
          osal_set_event( sensorTag_TaskID, ST_BAROMETER_SENSOR_EVT);
        }
        break;

      case ST_CFG_CALIBRATE:
        readBarCalibration();
        break;

      default:
        break;
      }
      break;

  case SENSOR_PERI:
      Barometer_GetParameter( SENSOR_PERI, &newValue );
      sensorBarPeriod = newValue*SENSOR_PERIOD_RESOLUTION;
      break;

    default:
      // should not get here!
      break;
  }
}
开发者ID:Mecabot,项目名称:BLE-CC254x-1.4.0,代码行数:55,代码来源:SensorTag.c


示例12: HalLedBlink

/***************************************************************************************************
 * @fn      HalLedBlink
 *
 * @brief   Blink the leds
 *
 * @param   leds       - bit mask value of leds to be blinked
 *          numBlinks  - number of blinks
 *          percent    - the percentage in each period where the led
 *                       will be on
 *          period     - length of each cycle in milliseconds
 *
 * @return  None
 ***************************************************************************************************/
void HalLedBlink (uint8 leds, uint8 numBlinks, uint8 percent, uint16 period)
{
#if (defined (BLINK_LEDS)) && (HAL_LED == TRUE)
  uint8 led;
  HalLedControl_t *sts;

  if (leds && percent && period)
  {
    if (percent < 100)
    {
      led = HAL_LED_1;
      leds &= HAL_LED_ALL;
      sts = HalLedStatusControl.HalLedControlTable;

      while (leds)
      {
        if (leds & led)
        {
          /* Store the current state of the led before going to blinking if not already blinking */
          if(sts->mode < HAL_LED_MODE_BLINK )
          	preBlinkState |= (led & HalLedState);

          sts->mode  = HAL_LED_MODE_OFF;                    /* Stop previous blink */
          sts->time  = period;                              /* Time for one on/off cycle */
          sts->onPct = percent;                             /* % of cycle LED is on */
          sts->left  = numBlinks;                           /* Number of blink cycles */
          if (!numBlinks) sts->mode |= HAL_LED_MODE_FLASH;  /* Continuous */
          sts->next = osal_GetSystemClock();                /* Start now */
          sts->mode |= HAL_LED_MODE_BLINK;                  /* Enable blinking */
          leds ^= led;
        }
        led <<= 1;
        sts++;
      }
      // Cancel any overlapping timer for blink events
      osal_stop_timerEx(Hal_TaskID, HAL_LED_BLINK_EVENT);
      osal_set_event (Hal_TaskID, HAL_LED_BLINK_EVENT);
    }
    else
    {
      HalLedSet (leds, HAL_LED_MODE_ON);                    /* >= 100%, turn on */
    }
  }
  else
  {
    HalLedSet (leds, HAL_LED_MODE_OFF);                     /* No on time, turn off */
  }
#elif (HAL_LED == TRUE)
  percent = (leds & HalLedState) ? HAL_LED_MODE_OFF : HAL_LED_MODE_ON;
  HalLedOnOff (leds, percent);                              /* Toggle */
#else
  // HAL LED is disabled, suppress unused argument warnings
  (void) leds;
  (void) numBlinks;
  (void) percent;
  (void) period;
#endif /* BLINK_LEDS && HAL_LED */
}
开发者ID:nevinxu,项目名称:HM502B1,代码行数:71,代码来源:hal_led.c


示例13: SimpleBLECentral_Init

/*********************************************************************
 * @fn      SimpleBLECentral_Init
 *
 * @brief   Initialization function for the Simple BLE Central App Task.
 *          This is called during initialization and should contain
 *          any application specific initialization (ie. hardware
 *          initialization/setup, table initialization, power up
 *          notification).
 *
 * @param   task_id - the ID assigned by OSAL.  This ID should be
 *                    used to send messages and set timers.
 *
 * @return  none
 */
void SimpleBLECentral_Init( uint8 task_id )
{
  simpleBLETaskId = task_id;

  // 串口初始化
  NPI_InitTransport(uart_NpiSerialCallback); 
  //NPI_WriteTransport("SimpleBLECentral_Init\r\n", 23);
  
  Get_IMEI();
  //halSleep(100);
  //Get_Test();

  // Setup Central Profile
  {
    uint8 scanRes = DEFAULT_MAX_SCAN_RES;
    GAPCentralRole_SetParameter ( GAPCENTRALROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
  }
  
  // Setup GAP
  GAP_SetParamValue( TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION );
  GAP_SetParamValue( TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION );
  GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (uint8 *) simpleBLEDeviceName );

  // Setup the GAP Bond Manager
  {
    uint32 passkey = DEFAULT_PASSCODE;
    uint8 pairMode = DEFAULT_PAIRING_MODE;
    uint8 mitm = DEFAULT_MITM_MODE;
    uint8 ioCap = DEFAULT_IO_CAPABILITIES;
    uint8 bonding = DEFAULT_BONDING_MODE;
    GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof( uint32 ), &passkey );
    GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof( uint8 ), &pairMode );
    GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof( uint8 ), &mitm );
    GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof( uint8 ), &ioCap );
    GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof( uint8 ), &bonding );
  }  

  // Initialize GATT Client
  VOID GATT_InitClient();

  // Register to receive incoming ATT Indications/Notifications
  GATT_RegisterForInd( simpleBLETaskId );

  // Initialize GATT attributes
  GGS_AddService( GATT_ALL_SERVICES );         // GAP
  GATTServApp_AddService( GATT_ALL_SERVICES ); // GATT attributes

  // Register for all key events - This app will handle all key events
  RegisterForKeys( simpleBLETaskId );
  
  // makes sure LEDs are off
  HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
  
  // Setup a delayed profile startup
  osal_set_event( simpleBLETaskId, START_DEVICE_EVT );
}
开发者ID:tanxjian,项目名称:BLE-CC254x-1.3.2,代码行数:70,代码来源:simpleBLECentral.c


示例14: rxCB

/***************************************************************************************************
 *                                          LOCAL FUNCTIONS
 ***************************************************************************************************/
static void rxCB( uint8 port, uint8 event )
{
  extern uint8 SampleApp_TaskID;
  rxlen=Hal_UART_RxBufLen(SERIAL_APP_PORT);  //接收缓冲区数据长度,字节为单位
  readbuf();  //读取buf的数值,并判断时候用ID功能  
  if(rxlen==0)
     osal_mem_free( rbuf );  //释放内存 
  else
  osal_set_event(SampleApp_TaskID,UART_RX_CB_EVT);
}
开发者ID:kobefaith,项目名称:zigbee,代码行数:13,代码来源:MT_UART.c


示例15: readAccData

/*********************************************************************
 * @fn      readAccData
 *
 * @brief   Read accelerometer data
 *
 * @param   none
 *
 * @return  none
 */
static void readAccData(void)
{
//    uint8 aData[ACCELEROMETER_DATA_LEN];
//    if (HalAccRead(aData))
//    {
//        Accel_SetParameter( ACCELEROMETER_DATA, ACCELEROMETER_DATA_LEN, aData);
//    }
//  readGyroData();
  osal_set_event( sensorTag_TaskID, ST_GYROSCOPE_SENSOR_EVT );
}
开发者ID:firechecking,项目名称:Hedwig-SixAxis-6050,代码行数:19,代码来源:SensorTag.c


示例16: OS_type

void OS_type(char c)
{
  switch (c)
  {
    case 0xff:
      break;
    case NL:
    case CR:
#ifdef ENABLE_CONSOLE_ECHO
      OS_putchar('\n');
#endif // ENABLE_CONSOLE_ECHO
      *input.ptr = NL;
      input.mode = MODE_GOT_INPUT;
      // Wake the interpreter now we have something new to do
      osal_set_event(blueBasic_TaskID, BLUEBASIC_INPUT_AVAILABLE);
      break;
    case CTRLH:
      if(input.ptr == input.start)
      {
        break;
      }
      if (*--input.ptr == input.quote)
      {
        input.quote = 0;
      }
#ifdef ENABLE_CONSOLE_ECHO
      OS_putchar(CTRLH);
      OS_putchar(' ');
      OS_putchar(CTRLH);
#endif // ENABLE_CONSOLE_ECHO
      break;
    default:
      if(input.ptr != input.end)
      {
        // Are we in a quoted string?
        if(c == input.quote)
        {
          input.quote = 0;
        }
        else if (c == DQUOTE || c == SQUOTE)
        {
          input.quote = c;
        }
        else if (input.quote == 0 && c >= 'a' && c <= 'z')
        {
          c = c + 'A' - 'a';
        }
        *input.ptr++ = c;
#ifdef ENABLE_CONSOLE_ECHO
        OS_putchar(c);
#endif
      }
      break;
  }
}
开发者ID:jun930,项目名称:BlueBasic,代码行数:55,代码来源:os.c


示例17: npSpiRxIsr

/**************************************************************************************************
* @fn          npSpiRxIsr
*
* @brief       This function handles the DMA Rx complete interrupt.
*
* input parameters
*
* None.
*
* output parameters
*
* None.
*
* @return      None.
**************************************************************************************************
*/
void npSpiRxIsr(void)
{
  uint8 *pBuf;
  mtRpcCmdType_t type = (mtRpcCmdType_t)(npSpiBuf[1] & MT_RPC_CMD_TYPE_MASK);
  
  NP_SPI_ASSERT(npSpiState == NP_SPI_WAIT_RX);
  switch (type)
  {
  case MT_RPC_CMD_POLL:
    npSpiState = NP_SPI_WAIT_TX;
    if ((pBuf = npSpiPollCallback()) != NULL)
    {
      /* Send TX packet using uDMA */
      spi_tx(pBuf);
      osal_msg_deallocate((uint8 *)pBuf);
    }
    else
    {
      /* If there is no data in the queue, send 3 zeros. */
      pBuf = npSpiBuf;
      npSpiBuf[0] = npSpiBuf[1] = npSpiBuf[2] = 0;
          
      /* Send TX packet using uDMA */
      spi_tx(pBuf);
    }
    break;
    
  case MT_RPC_CMD_SREQ:
    npSpiState = NP_SPI_WAIT_SREQ;
    osal_set_event(znpTaskId, ZNP_SPI_RX_SREQ_EVENT);
    break;
    
  case MT_RPC_CMD_AREQ:
    npSpiState = NP_SPI_WAIT_AREQ;
    osal_set_event(znpTaskId, ZNP_SPI_RX_AREQ_EVENT);
    break;
    
  default:
    npSpiState = NP_SPI_IDLE;
    break;
  }
}
开发者ID:LILCMU,项目名称:WRATIOT,代码行数:58,代码来源:znp_spi_udma.c


示例18: halAccelProcessMotionDetectInterrupt

/**************************************************************************************************
 * @fn      halProcessMotionDetectInterrupt
 *
 * @brief   Processes motion detection interrupt by informing the entity that
 *          enabled motion detection that it has occurred. Also disables further
 *          motion detection interrupts.
 *
 * @param
 *
 * @return
 **************************************************************************************************/
static void halAccelProcessMotionDetectInterrupt( void )
{
  /* Disable port interrupt */
  P1IEN &= (uint8) ~HAL_ACCEL_P1_INTERRUPT_PINS;

  /* Disable P1 interrupts */
  IEN2 &= ~(BV( 4 ));

  /* Set event to process motion detection not in interrupt context */
  osal_set_event( Hal_TaskID, HAL_MOTION_DETECTED_EVENT );
}
开发者ID:AndreFrelicot,项目名称:SensorTag-Fusion,代码行数:22,代码来源:hal_accel.c


示例19: TransmitApp_SetSendEvt

/*********************************************************************
 * @fn      TransmitApp_SetSendEvt
 *
 * @brief   Set the event flag
 *
 * @param   none
 *
 * @return  none
 */
void TransmitApp_SetSendEvt( void )
{
#if defined( TRANSMITAPP_DELAY_SEND )
  // Adds a delay to sending the data
  osal_start_timerEx( TransmitApp_TaskID,
                    TRANSMITAPP_SEND_MSG_EVT, TRANSMITAPP_SEND_DELAY );
#else
  // No Delay - just send the data
  osal_set_event( TransmitApp_TaskID, TRANSMITAPP_SEND_MSG_EVT );
#endif
}
开发者ID:liuyd07,项目名称:ZigbeeComm,代码行数:20,代码来源:TransmitApp.c


示例20: rxCB

/*********************************************************************
 * @fn      rxCB
 *
 * @brief   Process UART Rx event handling.
 *          May be triggered by an Rx timer expiration - less than max
 *          Rx bytes have arrived within the Rx max age time.
 *          May be set by failure to alloc max Rx byte-buffer for the DMA Rx -
 *          system resources are too low, so set flow control?
 *
 * @param   none
 *
 * @return  none
 */
static void rxCB( uint8 port, uint8 event )
{
  uint8 *buf, len;

  /* While awaiting retries/response, only buffer 1 next buffer: otaBuf2.
   * If allow the DMA Rx to continue to run, allocating Rx buffers, the heap
   * will become so depleted that an incoming OTA response cannot be received.
   * When the Rx data available is not read, the DMA Rx Machine automatically
   * sets flow control off - it is automatically re-enabled upon Rx data read.
   * When the back-logged otaBuf2 is sent OTA, an Rx data read is scheduled.
   */
  if ( otaBuf2 )
  {
    return;
  }

  if ( !(buf = osal_mem_alloc( SERIAL_APP_RX_CNT )) )
  {
    return;
  }

  /* HAL UART Manager will turn flow control back on if it can after read.
   * Reserve 1 byte for the 'sequence number'.
   */
  len = HalUARTRead( port, buf+1, SERIAL_APP_RX_CNT-1 );
  
  if ( !len )  // Length is not expected to ever be zero.
  {
    osal_mem_free( buf );
    return;
  }
  //else
  //  HalLedSet(HAL_LED_2,HAL_LED_MODE_ON);

  /* If the local global otaBuf is in use, then either the response handshake
   * is being awaited or retries are being attempted. When the wait/retries
   * process has been exhausted, the next OTA msg will be attempted from
   * otaBuf2, if it is not NULL.
   */
  if ( otaBuf )
  {
    otaBuf2 = buf;
    otaLen2 = len;
  }
  else
  {
    otaBuf = buf;
    otaLen = len;
    /* Don't call SerialApp_SendData() from here in the callback function.
     * Set the event so SerialApp_SendData() runs during this task's time slot.
     */
    osal_set_event( SerialApp_TaskID, SERIALAPP_MSG_SEND_EVT );
  }
}
开发者ID:kricnam,项目名称:blackboxreader,代码行数:67,代码来源:SerialApp.c



注:本文中的osal_set_event函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osal_start_timerEx函数代码示例发布时间:2022-05-30
下一篇:
C++ osal_msg_receive函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap