1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| void StartDefaultTask(void *argument) { uint8_t sta = 0x01; uint8_t dir = 1; uint8_t brun = 1; for(;;) { uint8_t key; if (osMessageQueueGet(RX1_QUEUEHandle,&key,0,10) == osOK && K3_Pin == key) { brun = !brun; } if(brun){ SetLeds(sta); if (osMessageQueueGet(RX2_QUEUEHandle,&key,0,10) == osOK && key == K1_Pin) dir = !dir; if (dir) sta = (sta < 0x80) ? (sta << 1) : 0x01; else sta = (sta > 0x01) ? (sta >> 1) : 0x80; osDelay(100); } else{ SetLeds(sta); } } } void StartTaskKey(void *argument) { uint8_t brun = 1; for(;;) { uint8_t key = ScanKey(); if (key > 0) { while (ScanKey() > 0); osMessageQueuePut(RX1_QUEUEHandle,&key,0,0); osMessageQueuePut(RX2_QUEUEHandle,&key,0,0); } osDelay(10); } }
|