add comment
This commit is contained in:
+3
-3
@@ -433,7 +433,7 @@ static void SimpleBLEPeripheral_clockHandler(UArg arg) {
|
||||
// events |= SBP_PERIODIC_EVT;
|
||||
|
||||
// Wake up the application.
|
||||
Semaphore_post(semaphore);
|
||||
Semaphore_post(semaphore); // send samaphore to jump out of infinite waiting(simple_peripheral.c line570)
|
||||
}
|
||||
|
||||
|
||||
@@ -850,14 +850,14 @@ static void EliteKeyPress(uint8_t key){
|
||||
|
||||
}
|
||||
else{
|
||||
if(OriginEliteFxn == INSTRUCTION.eliteFxn){
|
||||
if(OriginEliteFxn == INSTRUCTION.eliteFxn){ //old function == currunt instruction
|
||||
if(ShutDownCounter != 0){
|
||||
// dark LED
|
||||
WorkModeLED();
|
||||
ShutDownCounter = 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
else{ //old function != currunt instruction
|
||||
OriginEliteFxn = INSTRUCTION.eliteFxn;
|
||||
if(ShutDownCounter != 0){
|
||||
ShutDownCounter = 0;
|
||||
|
||||
+10
-10
@@ -558,8 +558,8 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
uint8_t counter6994 = 0;
|
||||
bool EliteOn = 0;
|
||||
|
||||
Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, SBP_PERIODIC_EVT_PERIOD, 0, false, SBP_PERIODIC_EVT);
|
||||
Util_startClock(&periodicClock); // timeup => call SimpleBLEPeripheral_clockHandler
|
||||
Util_constructClock(&periodicClock, SimpleBLEPeripheral_clockHandler, SBP_PERIODIC_EVT_PERIOD, 0, false, SBP_PERIODIC_EVT); //create a clock clockduration = 42(~=0.05 sec)
|
||||
Util_startClock(&periodicClock); // start the clock, timeup => call SimpleBLEPeripheral_clockHandler => wake up the device
|
||||
|
||||
// Application main loops
|
||||
for (;;) {
|
||||
@@ -567,16 +567,16 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
// Note that the semaphore associated with a thread is signaled when a
|
||||
// message is queued to the message receive queue of the thread or when
|
||||
// ICall_signal() function is called onto the semaphore.
|
||||
ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);
|
||||
if (errno == ICALL_ERRNO_SUCCESS) {
|
||||
ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER); //let errno wait for infinite time, if periodicClock time up then execute below code
|
||||
if (errno == ICALL_ERRNO_SUCCESS) {
|
||||
ICall_EntityID dest;
|
||||
ICall_ServiceEnum src;
|
||||
ICall_HciExtEvt * pMsg = NULL;
|
||||
|
||||
if (ICall_fetchServiceMsg(&src, &dest, (void **)&pMsg) == ICALL_ERRNO_SUCCESS) {
|
||||
if (ICall_fetchServiceMsg(&src, &dest, (void **)&pMsg) == ICALL_ERRNO_SUCCESS) { //if successfully retreived a meaasage from who?
|
||||
uint8 safeToDealloc = TRUE;
|
||||
|
||||
if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity)) {
|
||||
if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity)) { //src: source id who sent the massage; dest: entity id of the destination of the massage
|
||||
ICall_Stack_Event *pEvt = (ICall_Stack_Event *)pMsg;
|
||||
|
||||
// Check for BLE stack events first
|
||||
@@ -597,7 +597,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
|
||||
}
|
||||
|
||||
// If RTOS queue is not empty, process app message.
|
||||
// If RTOS queue is not empty, process app message. //RTOS is the OS on Elite
|
||||
while (!Queue_empty(appMsgQueue)){
|
||||
sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
|
||||
if (pMsg) {
|
||||
@@ -610,8 +610,8 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
}
|
||||
|
||||
if(!PeriodicEvent){
|
||||
Util_startClock(&periodicClock);
|
||||
if(!PeriodicEvent){ //if there is no periodic event
|
||||
Util_startClock(&periodicClock); //manually restart the clock
|
||||
key = PIN_getInputValue(switch_on);
|
||||
if(EliteOn){
|
||||
if(counter6994 < 35){
|
||||
@@ -634,7 +634,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) {
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
else{ // if there is periodic event
|
||||
Util_startClock(&periodicClock);
|
||||
if(PeriodicCounter >= StepTime){
|
||||
SimpleBLEPeripheral_performPeriodicTask();
|
||||
|
||||
Reference in New Issue
Block a user