/** * task charged with updating the time * @param param optional parameter */ static void watch_TimeUpdateTask(task_param_t param) { bool dateUpdateFlag, timeUpdateFlag; while (1) { RTC_WatchUpdateEventWait (&watch_time, &dateUpdateFlag, &timeUpdateFlag, OSA_WAIT_FOREVER); if(timeUpdateFlag) { snprintf( (char*)watch_labelTime.caption, 6, "%02d:%02d", watch_time.hour, watch_time.minute ); OSA_EventSet( &watch_event, (event_flags_t)timeUpdate_eventFlag); } if(dateUpdateFlag) { const char *dayOfWeekPtr; const char *monthsOfYearPtr; dayOfWeekPtr = watch_GetDayOfweek(&watch_time); monthsOfYearPtr = monthsOfYearStr[watch_time.month - 1]; snprintf( (char*)watch_labelDate.caption, 12, "%s, %02d %s", dayOfWeekPtr, watch_time.day, monthsOfYearPtr); OSA_EventSet( &watch_event, (event_flags_t)dateUpdate_eventFlag); } } }
/*FUNCTION********************************************************************** * * Function Name : I2C_DRV_SlaveAbortSendData * Description : This function is used to abort sending of I2C slave * *END*/ i2c_status_t I2C_DRV_SlaveAbortSendData(uint32_t instance, uint32_t *txSize) { assert(instance < I2C_INSTANCE_COUNT); i2c_slave_state_t * i2cSlaveState = (i2c_slave_state_t *)g_i2cStatePtr[instance]; *txSize = i2cSlaveState->txSize; /** Check if a transfer is running. */ if (!i2cSlaveState->isTxBusy) { return kStatus_I2C_NoSendInProgress; } /** Stop the running transfer. */ i2cSlaveState->isTxBusy = false; i2cSlaveState->txBuff = NULL; i2cSlaveState->txSize = 0; if(!i2cSlaveState->slaveListening) { /** Disable I2C interrupt in the peripheral.*/ I2C_HAL_SetIntCmd(g_i2cBase[instance], false); if (i2cSlaveState->isTxBlocking) { /** Set kI2CSlaveTxEmpty event to notify that the sending is done */ OSA_EventSet(&i2cSlaveState->irqEvent, kI2CSlaveAbort); } } return kStatus_I2C_Success; }
/*FUNCTION********************************************************************** * * Function Name : SPI_DRV_DmaSlaveCompleteTransfer * Description : Finish up a transfer. * Cleans up after a transfer is complete. Interrupts are disabled, and the SPI module * is disabled. This is not a public API as it is called from other driver functions. * *END**************************************************************************/ static void SPI_DRV_DmaSlaveCompleteTransfer(uint32_t instance) { spi_dma_slave_state_t * spiState = (spi_dma_slave_state_t *)g_spiStatePtr[instance]; SPI_Type *base = g_spiBase[instance]; /* Disable DMA requests and interrupts. */ SPI_HAL_SetRxDmaCmd(base, false); SPI_HAL_SetTxDmaCmd(base, false); SPI_HAL_SetIntMode(base, kSpiTxEmptyInt, false); /* Stop DMA channels */ DMA_DRV_StopChannel(&spiState->dmaTransmit); DMA_DRV_StopChannel(&spiState->dmaReceive); /* Disable interrupts */ SPI_HAL_SetIntMode(base, kSpiRxFullAndModfInt, false); #if FSL_FEATURE_SPI_16BIT_TRANSFERS if (g_spiFifoSize[instance] != 0) { /* Now disable the SPI FIFO interrupts */ SPI_HAL_SetFifoIntCmd(base, kSpiTxFifoNearEmptyInt, false); SPI_HAL_SetFifoIntCmd(base, kSpiRxFifoNearFullInt, false); } /* Receive extra byte if remaining receive byte is 0 */ if ((spiState->hasExtraByte) && (!spiState->remainingReceiveByteCount) && (spiState->receiveBuffer)) { spiState->receiveBuffer[spiState->remainingReceiveByteCount] = SPI_HAL_ReadDataLow(base); } #endif /* FSL_FEATURE_SPI_16BIT_TRANSFERS */ if (spiState->isSync) { /* Signal the synchronous completion object */ OSA_EventSet(&spiState->event, kSpiDmaTransferDone); } /* The transfer is complete, update the state structure */ spiState->isTransferInProgress = false; spiState->status = kStatus_SPI_Success; spiState->errorCount = 0; spiState->sendBuffer = NULL; spiState->receiveBuffer = NULL; spiState->remainingSendByteCount = 0; spiState->remainingReceiveByteCount = 0; }
/** * wait for packets and analyze data * @param param optional parameter */ static void watch_GetPacketsTask(task_param_t param) { mE_t sensorValue; while(1) { GuiDriver_QueueMsgGet(&watch_dataPacket , OSA_WAIT_FOREVER); // Extract data sensorValue = (mE_t)( watch_dataPacket.data[0] | (mE_t)watch_dataPacket.data[1] << 8 ); switch (watch_dataPacket.type) { // Battery Service case packetType_batteryLevel: { if ( false == isBatteryCharging ) { batteryLevel = (uint8_t)sensorValue; OSA_EventSet( &watch_event, (event_flags_t)batteryUpdate_eventFlag); } break; } case packetType_temperature: { currTemp = sensorValue / 100; snprintf( (char*)watch_labelTemp.caption, 4, "%d", currTemp); // TODO: Degree ascii code is 176. Check if we want to increase font to 255 chars, so we can display such char OSA_EventSet( &watch_event, (event_flags_t)tempUpdate_eventFlag); break; } default: {} } } }
/** * update local flags and notifications counters upon receiving * the current link state from KW40 * @param new_linkState new bluetooth link state * @return status flag */ osa_status_t watch_LinkStateUpdate( linkState_t new_linkState ) { OSA_EventSet( &watch_event, (event_flags_t)linkStateUpdate_eventFlag ); watch_linkState = new_linkState; switch ( watch_linkState ) { case linkState_disconnected: { sensor_SaveTargetsForKW40(); Notification_SetUnreadCounter( NOTIF_TYPE_CALL, 0 ); Notification_SetUnreadCounter( NOTIF_TYPE_MAIL, 0 ); Notification_SetUnreadCounter( NOTIF_TYPE_SMS, 0 ); watch_SetNotification(); if ( true == gui_sensorTag_IsActive() ) { power_SetSleepMode( POWER_SLEEP_MODE_TOTAL ); } break; } case linkState_connected: { sensor_RestoreTargetsForKW40(); if ( true == gui_sensorTag_IsActive() ) { power_SetSleepMode( POWER_SLEEP_MODE_SENSOR_TAG ); GuiDriver_NotifyKW40( GUI_CURRENT_APP_SENSOR_TAG ); } break; } } return kStatus_OSA_Success; }
/** * set notifications event */ void watch_SetNotification() { OSA_EventSet( &watch_event, (event_flags_t)notifDetect_eventFlag ); }
/** * set battery charge event */ void watch_SetBatteryChargeEvent() { OSA_EventSet( &watch_event, (event_flags_t)chargDetect_eventFlag); }
/*FUNCTION********************************************************************** * * Function Name : I2C_DRV_SlaveIRQHandler * Description : I2C Slave Generic ISR. * ISR action be called inside I2C IRQ handler entry. * *END*/ void I2C_DRV_SlaveIRQHandler(uint32_t instance) { assert(instance < I2C_INSTANCE_COUNT); I2C_Type * base = g_i2cBase[instance]; uint8_t i2cData = 0x00; bool doTransmit = false; bool wasArbLost = I2C_HAL_GetStatusFlag(base, kI2CArbitrationLost); bool addressed = I2C_HAL_GetStatusFlag(base, kI2CAddressAsSlave); bool stopIntEnabled = false; #if FSL_FEATURE_I2C_HAS_START_STOP_DETECT bool startDetected = I2C_HAL_GetStartFlag(base); bool startIntEnabled = I2C_HAL_GetStartStopIntCmd(base); bool stopDetected = I2C_HAL_GetStopFlag(base); stopIntEnabled = startIntEnabled; #endif #if FSL_FEATURE_I2C_HAS_STOP_DETECT bool stopDetected = I2C_HAL_GetStopFlag(base); stopIntEnabled = I2C_HAL_GetStopIntCmd(base); #endif /** Get current runtime structure */ i2c_slave_state_t * i2cSlaveState = (i2c_slave_state_t *)g_i2cStatePtr[instance]; /** Get current slave transfer direction */ i2c_direction_t direction = I2C_HAL_GetDirMode(base); #if FSL_FEATURE_I2C_HAS_START_STOP_DETECT /*--------------- Handle START ------------------*/ if (startIntEnabled && startDetected) { I2C_HAL_ClearStartFlag(base); I2C_HAL_ClearInt(base); if(i2cSlaveState->slaveCallback != NULL) { /*Call callback to handle when the driver detect START signal*/ i2cSlaveState->slaveCallback(instance, kI2CSlaveStartDetect, i2cSlaveState->callbackParam); } return; } #endif #if FSL_FEATURE_I2C_HAS_START_STOP_DETECT || FSL_FEATURE_I2C_HAS_STOP_DETECT /*--------------- Handle STOP ------------------*/ if (stopIntEnabled && stopDetected) { I2C_HAL_ClearStopFlag(base); I2C_HAL_ClearInt(base); if(!i2cSlaveState->slaveListening) { /** Disable I2C interrupt in the peripheral.*/ I2C_HAL_SetIntCmd(base, false); } if(i2cSlaveState->slaveCallback != NULL) { /*Call callback to handle when the driver detect STOP signal*/ i2cSlaveState->slaveCallback(instance, kI2CSlaveStopDetect, i2cSlaveState->callbackParam); } if (i2cSlaveState->isRxBlocking) { OSA_EventSet(&i2cSlaveState->irqEvent, kI2CSlaveStopDetect); } i2cSlaveState->status = kStatus_I2C_Idle; return; } #endif /** Clear I2C IRQ.*/ I2C_HAL_ClearInt(base); if (wasArbLost) { I2C_HAL_ClearArbitrationLost(base); if (!addressed) { i2cSlaveState->status = kStatus_I2C_AribtrationLost; if(!i2cSlaveState->slaveListening) { /** Disable I2C interrupt in the peripheral.*/ I2C_HAL_SetIntCmd(base, false); } return; } } /*--------------- Handle Address ------------------*/ /** Addressed only happens when receiving address. */ if (addressed) /** Slave is addressed. */ { /** Master read from Slave. Slave transmit.*/ if (I2C_HAL_GetStatusFlag(base, kI2CSlaveTransmit)) { /** Switch to TX mode*/ I2C_HAL_SetDirMode(base, kI2CSend); if(i2cSlaveState->slaveCallback != NULL) { /*Call callback to handle when the driver get read request*/ i2cSlaveState->slaveCallback(instance, kI2CSlaveTxReq, i2cSlaveState->callbackParam); } doTransmit = true; } else /** Master write to Slave. Slave receive.*/ { /** Switch to RX mode.*/ I2C_HAL_SetDirMode(base, kI2CReceive); if(i2cSlaveState->slaveCallback != NULL) { /*Call callback to handle when the driver get write request*/ i2cSlaveState->slaveCallback(instance, kI2CSlaveRxReq, i2cSlaveState->callbackParam); } /** Read dummy character.*/ I2C_HAL_ReadByte(base); } } /*--------------- Handle Transfer ------------------*/ else { /** Handle transmit */ if (direction == kI2CSend) { if (I2C_HAL_GetStatusFlag(base, kI2CReceivedNak)) { /** Switch to RX mode.*/ I2C_HAL_SetDirMode(base, kI2CReceive); /** Read dummy character to release bus */ I2C_HAL_ReadByte(base); if ((!i2cSlaveState->slaveListening) && (!stopIntEnabled)) { /** Disable I2C interrupt in the peripheral.*/ I2C_HAL_SetIntCmd(base, false); } if(i2cSlaveState->slaveCallback != NULL) { /** Receive TX NAK, mean transaction is finished, call callback to handle */ i2cSlaveState->slaveCallback(instance, kI2CSlaveTxNAK, i2cSlaveState->callbackParam); } if (i2cSlaveState->isTxBlocking) { OSA_EventSet(&i2cSlaveState->irqEvent, kI2CSlaveTxNAK); } i2cSlaveState->txSize = 0; i2cSlaveState->txBuff = NULL; i2cSlaveState->isTxBusy = false; } else /** ACK from receiver.*/ { doTransmit = true; } } /** Handle receive */ else { /** Get byte from data register */ i2cData = I2C_HAL_ReadByte(base); if (i2cSlaveState->rxSize) { *(i2cSlaveState->rxBuff) = i2cData; ++ i2cSlaveState->rxBuff; -- i2cSlaveState->rxSize; if (!i2cSlaveState->rxSize) { if (!stopIntEnabled) { if(!i2cSlaveState->slaveListening) { /** Disable I2C interrupt in the peripheral.*/ I2C_HAL_SetIntCmd(base, false); } /** All bytes are received, so we're done with this transfer */ if (i2cSlaveState->isRxBlocking) { OSA_EventSet(&i2cSlaveState->irqEvent, kI2CSlaveRxFull); } } i2cSlaveState->isRxBusy = false; i2cSlaveState->rxBuff = NULL; if(i2cSlaveState->slaveCallback != NULL) { /** Rx buffer is full, call callback to handle */ i2cSlaveState->slaveCallback(instance, kI2CSlaveRxFull, i2cSlaveState->callbackParam); } } } else { /** The Rxbuff is full --> Set kStatus_I2C_SlaveRxOverrun*/ i2cSlaveState->status = kStatus_I2C_SlaveRxOverrun; } } } /** DO TRANSMIT*/ if (doTransmit) { /** Send byte to data register */ if (i2cSlaveState->txSize) { i2cData = *(i2cSlaveState->txBuff); I2C_HAL_WriteByte(base, i2cData); ++ i2cSlaveState->txBuff; -- i2cSlaveState->txSize; if (!i2cSlaveState->txSize) { /** All bytes are received, so we're done with this transfer */ i2cSlaveState->txBuff = NULL; i2cSlaveState->isTxBusy = false; if(i2cSlaveState->slaveCallback != NULL) { /** Tx buffer is empty, finish transaction, call callback to handle */ i2cSlaveState->slaveCallback(instance, kI2CSlaveTxEmpty, i2cSlaveState->callbackParam); } } } else { /** The Txbuff is empty --> set kStatus_I2C_SlaveTxUnderrun*/ i2cSlaveState->status = kStatus_I2C_SlaveTxUnderrun ; } } }
uint32_t OS_Event_set(os_event_handle handle, uint32_t bitmask) { return ((kStatus_OSA_Success == OSA_EventSet((event_t*) (handle), (bitmask))) ? OS_EVENT_OK : OS_EVENT_ERROR); }
/*FUNCTION********************************************************************** * * Function Name : SPI_DRV_DmaSlaveStartTransfer * Description : Starts the transfer with information passed. * *END**************************************************************************/ static spi_status_t SPI_DRV_DmaSlaveStartTransfer(uint32_t instance) { spi_dma_slave_state_t * spiState = (spi_dma_slave_state_t *)g_spiStatePtr[instance]; /* For temporarily storing DMA register channel */ void * param; SPI_Type *base = g_spiBase[instance]; uint32_t transferSizeInBytes; /* DMA transfer size in bytes */ /* Initialize s_byteToSend */ s_byteToSend = spiState->dummyPattern; /* If the transfer count is zero, then return immediately. */ if (spiState->remainingSendByteCount == 0) { /* Signal the synchronous completion object if the transfer wasn't async. * Otherwise, when we return the the sync function we'll get stuck in the sync wait loop. */ if (spiState->isSync) { /* Signal the synchronous completion object */ OSA_EventSet(&spiState->event, kSpiDmaTransferDone); } return kStatus_SPI_Success; } /* In order to flush any remaining data in the shift register, disable then enable the SPI */ SPI_HAL_Disable(base); SPI_HAL_Enable(base); /* First, set the DMA transfer size in bytes */ #if FSL_FEATURE_SPI_16BIT_TRANSFERS if (SPI_HAL_Get8or16BitMode(base) == kSpi16BitMode) { transferSizeInBytes = 2; /* If bits/frame > 8, meaning 2 bytes, then the transfer byte count must not be an odd * count. If so, drop the last odd byte. This odd byte will be transferred in when dma * completed */ if (spiState->remainingSendByteCount % 2 != 0) { spiState->remainingSendByteCount ++; spiState->remainingReceiveByteCount --; spiState->hasExtraByte = true; } else { spiState->hasExtraByte = false; } } else { transferSizeInBytes = 1; } #else transferSizeInBytes = 1; #endif /* FSL_FEATURE_SPI_16BIT_TRANSFERS */ param = (void *)(instance); /* For DMA callback, set "param" as the SPI instance number */ /* Save information about the transfer for use by the ISR. */ spiState->isTransferInProgress = true; /************************************************************************************ * Set up the RX DMA channel Transfer Control Descriptor (TCD) * Note, if there is no receive buffer (if user passes in NULL), then bypass RX DMA * set up. ************************************************************************************/ /* If no receive buffer then disable incrementing the destination and set the destination * to a temporary location */ if ((spiState->remainingReceiveByteCount > 0) || (spiState->hasExtraByte)) { uint32_t receiveSize = spiState->remainingReceiveByteCount; if ((!spiState->receiveBuffer) || (!spiState->remainingReceiveByteCount)) { if (!spiState->remainingReceiveByteCount) { /* If receive count is 0, always receive 1 frame (2 bytes) */ receiveSize = 2; } /* Set up this channel's control which includes enabling the DMA interrupt */ DMA_DRV_ConfigTransfer(&spiState->dmaReceive, kDmaPeripheralToPeripheral, transferSizeInBytes, SPI_HAL_GetDataRegAddr(base), /* src is data register */ (uint32_t)(&s_rxBuffIfNull), /* dest is temporary location */ (uint32_t)(receiveSize)); } else { /* Set up this channel's control which includes enabling the DMA interrupt */ DMA_DRV_ConfigTransfer(&spiState->dmaReceive, kDmaPeripheralToMemory, transferSizeInBytes, SPI_HAL_GetDataRegAddr(base), /* src is data register */ (uint32_t)(spiState->receiveBuffer), /* dest is rx buffer */ (uint32_t)(receiveSize)); } /* Destination size is only one byte */ DMA_DRV_SetDestTransferSize(&spiState->dmaReceive, 1U); /* Enable the DMA peripheral request */ DMA_DRV_StartChannel(&spiState->dmaReceive); /* Register callback for DMA interrupt */ DMA_DRV_RegisterCallback(&spiState->dmaReceive, SPI_DRV_DmaSlaveCallback, param); } /************************************************************************************ * Set up the TX DMA channel Transfer Control Descriptor (TCD) * Note, if there is no source buffer (if user passes in NULL), then send zeros ************************************************************************************/ /* Per the reference manual, before enabling the SPI transmit DMA request, we first need * to read the status register and then write to the SPI data register. Afterwards, we need * to decrement the sendByteCount and perform other driver maintenance functions. */ /* Read the SPI Status register */ SPI_HAL_IsTxBuffEmptyPending(base); /* Start the transfer by writing the first byte/word to the SPI data register. * If a send buffer was provided, the byte/word comes from there. Otherwise we just send zeros. */ #if FSL_FEATURE_SPI_16BIT_TRANSFERS if (transferSizeInBytes == 2) /* 16-bit transfers for SPI16 module */ { if (spiState->sendBuffer) { s_byteToSend = *(spiState->sendBuffer); SPI_HAL_WriteDataLow(base, s_byteToSend); ++spiState->sendBuffer; s_byteToSend = *(spiState->sendBuffer); SPI_HAL_WriteDataHigh(base, s_byteToSend); ++spiState->sendBuffer; } else /* Else, if no send buffer, write zeros */ { SPI_HAL_WriteDataLow(base, s_byteToSend); SPI_HAL_WriteDataHigh(base, s_byteToSend); } spiState->remainingSendByteCount -= 2; /* Decrement the send byte count by 2 */ } else /* 8-bit transfers for SPI16 module */ { if (spiState->sendBuffer) { s_byteToSend = *(spiState->sendBuffer); ++spiState->sendBuffer; } SPI_HAL_WriteDataLow(base, s_byteToSend); /* If no send buffer, s_byteToSend=0 */ --spiState->remainingSendByteCount; /* Decrement the send byte count for use in DMA setup */ } #else /* For SPI modules that do not support 16-bit transfers */ if (spiState->sendBuffer) { s_byteToSend = *(spiState->sendBuffer); ++spiState->sendBuffer; } SPI_HAL_WriteData(base, s_byteToSend); /* If no send buffer, s_byteToSend=0 */ --spiState->remainingSendByteCount; /* Decrement the send byte count for use in DMA setup */ #endif /* FSL_FEATURE_SPI_16BIT_TRANSFERS */ /* If there are no more bytes to send then return without setting up the TX DMA channel. * Else, set up the TX DMA channel and enable the TX DMA request. */ if (!spiState->remainingSendByteCount) /* No more bytes to send */ { if ((spiState->remainingReceiveByteCount) || (spiState->hasExtraByte)) { /* Enable the RX DMA channel request now */ SPI_HAL_SetRxDmaCmd(base, true); return kStatus_SPI_Success; } else /* If RX DMA chan not setup then enable the interrupt to get the received byte */ { SPI_HAL_SetIntMode(base, kSpiTxEmptyInt, true); return kStatus_SPI_Success; } } else /* Since there are more bytes to send, set up the TX DMA channel */ { /* If there is a send buffer, data comes from there, else send 0 */ if (spiState->sendBuffer) { /* Set up this channel's control which includes enabling the DMA interrupt */ DMA_DRV_ConfigTransfer(&spiState->dmaTransmit, kDmaMemoryToPeripheral, transferSizeInBytes, (uint32_t)(spiState->sendBuffer), SPI_HAL_GetDataRegAddr(base), (uint32_t)(spiState->remainingSendByteCount)); } else /* Configure TX DMA channel to send zeros */ { /* Set up this channel's control which includes enabling the DMA interrupt */ DMA_DRV_ConfigTransfer(&spiState->dmaTransmit, kDmaPeripheralToPeripheral, transferSizeInBytes, (uint32_t)(&s_byteToSend), SPI_HAL_GetDataRegAddr(base), (uint32_t)(spiState->remainingSendByteCount)); } /* Source size is only one byte */ DMA_DRV_SetSourceTransferSize(&spiState->dmaTransmit, 1U); /* Enable the SPI TX DMA Request */ SPI_HAL_SetTxDmaCmd(base, true); /* Enable the SPI RX DMA request also. */ SPI_HAL_SetRxDmaCmd(base, true); /* Enable the DMA peripheral request */ DMA_DRV_StartChannel(&spiState->dmaTransmit); } return kStatus_SPI_Success; }
void bluetooth_SendGetAdvModeReq(void) { static hostInterface_packet_t dataPacket = { .start1 = gHostInterface_startByte1, .start2 = gHostInterface_startByte2, .length = 0, .data[0] = gHostInterface_trailerByte }; dataPacket.type = packetType_advModeGet; while(HostInterface_TxQueueMsgPut((hostInterface_packet_t *)&dataPacket, true) != kStatus_OSA_Success); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void bluetooth_SendToggleAdvModeReq(void) { static hostInterface_packet_t dataPacket = { .start1 = gHostInterface_startByte1, .start2 = gHostInterface_startByte2, .length = 0, .data[0] = gHostInterface_trailerByte }; dataPacket.type = packetType_advModeToggle; while(HostInterface_TxQueueMsgPut((hostInterface_packet_t *)&dataPacket, true) != kStatus_OSA_Success); haptic_Vibrate(); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * [buttonsGroup_DestroyTasks description] * @param param [description] */ osa_status_t bluetooth_WaitForAdvModeUpdate(uint32_t timeout) { osa_status_t status; event_flags_t setFlags; status = OSA_EventWait(&advModeUpdate_event, advModeUpdate_eventFlag, false, timeout, &setFlags); if ( kStatus_OSA_Success != status ) { return kStatus_OSA_Error; } return (osa_status_t)status; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * [buttonsGroup_DestroyTasks description] * @param param [description] */ osa_status_t bluetooth_AdvModeUpdate(bluetooth_advMode_t bluetooth_advMode) { OSA_EventSet( &advModeUpdate_event, (event_flags_t)advModeUpdate_eventFlag); bluetoothCurrentAdvMode = bluetooth_advMode; return kStatus_OSA_Success; }