The final project of Embedde class.

Dependencies:   C12832 LM75B ESP-call MMA7660

Committer:
pkr7098
Date:
Thu Jun 03 07:09:55 2021 +0000
Revision:
2:37756b51ccdb
Parent:
1:ed1c6618f739
The final project of Embedde class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pkr7098 1:ed1c6618f739 1 #include "APPLICATION.h"
pkr7098 1:ed1c6618f739 2
pkr7098 1:ed1c6618f739 3 Thread threadMode;
pkr7098 1:ed1c6618f739 4 Semaphore semaphoreApplication(0, 1);
pkr7098 1:ed1c6618f739 5
pkr7098 1:ed1c6618f739 6 static void _threadMode(void)
pkr7098 1:ed1c6618f739 7 {
pkr7098 1:ed1c6618f739 8 /*
pkr7098 1:ed1c6618f739 9 * 디바이스의 각종 모드를을 수정한 후, 적절한 동작을 취하게할 때 사용하는 쓰레드입니다.
pkr7098 1:ed1c6618f739 10 * 현재 디바이스에서는 MODE_MODIFY_TIME가 다른 모드로 변경되었을 때 호출되어 시간 수정을 가능ㅎ하게 할지 불가능하게 할지를 결정하게합니다.
pkr7098 1:ed1c6618f739 11 */
pkr7098 1:ed1c6618f739 12 while(1) {
pkr7098 1:ed1c6618f739 13 semaphoreApplication.acquire();
pkr7098 1:ed1c6618f739 14 semaphoreModify.acquire();
pkr7098 1:ed1c6618f739 15 if(MODE_MODIFY_TIME == ABLE_TO_MODIFY_TIME) {
pkr7098 1:ed1c6618f739 16 semaphoreModify.release();
pkr7098 1:ed1c6618f739 17 timerStartTimeModify();
pkr7098 1:ed1c6618f739 18 } else {
pkr7098 1:ed1c6618f739 19 semaphoreModify.release();
pkr7098 1:ed1c6618f739 20 timerTerminateTimeModify();
pkr7098 1:ed1c6618f739 21 }
pkr7098 1:ed1c6618f739 22 }
pkr7098 1:ed1c6618f739 23 }
pkr7098 1:ed1c6618f739 24
pkr7098 1:ed1c6618f739 25 void applicationChangeMode(void)
pkr7098 1:ed1c6618f739 26 {
pkr7098 1:ed1c6618f739 27 /*
pkr7098 1:ed1c6618f739 28 * 디바이스의 모드를 동기화할 때 호출되는 함수입니다.
pkr7098 1:ed1c6618f739 29 * 현재 디바이스에서는 MODE_MODIFY를 수정하고, _threadMode를 호출하여 동기화시키는 목적으로 사용됩니다.
pkr7098 1:ed1c6618f739 30 */
pkr7098 1:ed1c6618f739 31 semaphoreApplication.release();
pkr7098 1:ed1c6618f739 32 }
pkr7098 1:ed1c6618f739 33
pkr7098 1:ed1c6618f739 34 void applicationInit(void)
pkr7098 1:ed1c6618f739 35 {
pkr7098 1:ed1c6618f739 36 /*
pkr7098 1:ed1c6618f739 37 * 각종 디바이스의 장치들을 초기화하기 위한 함수입니다.
pkr7098 1:ed1c6618f739 38 */
pkr7098 1:ed1c6618f739 39 PC.baud(115200);
pkr7098 1:ed1c6618f739 40 buzzerInit();
pkr7098 1:ed1c6618f739 41 ledInit();
pkr7098 1:ed1c6618f739 42 switchInit();
pkr7098 1:ed1c6618f739 43 switchApplicationInit();
pkr7098 1:ed1c6618f739 44 potInit();
pkr7098 1:ed1c6618f739 45 joystickInit();
pkr7098 1:ed1c6618f739 46 wifiInit();
pkr7098 1:ed1c6618f739 47 lcdInit();
pkr7098 1:ed1c6618f739 48 alarmInit();
pkr7098 1:ed1c6618f739 49 threadMode.start(_threadMode);
pkr7098 1:ed1c6618f739 50 }