The final project of Embedde class.

Dependencies:   C12832 LM75B ESP-call MMA7660

Committer:
pkr7098
Date:
Thu Jun 03 07:08:47 2021 +0000
Revision:
1:ed1c6618f739
The final project of Embedde class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pkr7098 1:ed1c6618f739 1 #include "LCD.h"
pkr7098 1:ed1c6618f739 2
pkr7098 1:ed1c6618f739 3 C12832 _lcd(D11, D13, D12, D7, D10);
pkr7098 1:ed1c6618f739 4 Thread _lcdShowLoadingSimbol;
pkr7098 1:ed1c6618f739 5 Semaphore semaphoreLCD(0, 1);
pkr7098 1:ed1c6618f739 6 Semaphore semaphoreLCDLoading(0, 1);
pkr7098 1:ed1c6618f739 7
pkr7098 1:ed1c6618f739 8 int _x, _y;
pkr7098 1:ed1c6618f739 9
pkr7098 1:ed1c6618f739 10 static void lcdShowLoadingSimbol(void)
pkr7098 1:ed1c6618f739 11 {
pkr7098 1:ed1c6618f739 12 unsigned int count = 0;
pkr7098 1:ed1c6618f739 13 char simbols[] = {'\\', '|', '/', '-'};
pkr7098 1:ed1c6618f739 14 while(1) {
pkr7098 1:ed1c6618f739 15 for(int i = 0; i < 4; i++) {
pkr7098 1:ed1c6618f739 16 semaphoreLCDLoading.acquire();
pkr7098 1:ed1c6618f739 17 semaphoreLCD.acquire();
pkr7098 1:ed1c6618f739 18 _lcd.locate(_x, _y);
pkr7098 1:ed1c6618f739 19 _lcd.putc(simbols[i]);
pkr7098 1:ed1c6618f739 20 semaphoreLCD.release();
pkr7098 1:ed1c6618f739 21 semaphoreLCDLoading.release();
pkr7098 1:ed1c6618f739 22 thread_sleep_for(LCD_LOADING_TERM);
pkr7098 1:ed1c6618f739 23 }
pkr7098 1:ed1c6618f739 24 }
pkr7098 1:ed1c6618f739 25 }
pkr7098 1:ed1c6618f739 26
pkr7098 1:ed1c6618f739 27 void lcdInit(void)
pkr7098 1:ed1c6618f739 28 {
pkr7098 1:ed1c6618f739 29 semaphoreLCD.release();
pkr7098 1:ed1c6618f739 30 _lcdShowLoadingSimbol.start(lcdShowLoadingSimbol);
pkr7098 1:ed1c6618f739 31 }
pkr7098 1:ed1c6618f739 32
pkr7098 1:ed1c6618f739 33 void lcdShowLoadingSimbolStart(int x, int y)
pkr7098 1:ed1c6618f739 34 {
pkr7098 1:ed1c6618f739 35 _x = x;
pkr7098 1:ed1c6618f739 36 _y = y;
pkr7098 1:ed1c6618f739 37 semaphoreLCDLoading.release();
pkr7098 1:ed1c6618f739 38
pkr7098 1:ed1c6618f739 39 }
pkr7098 1:ed1c6618f739 40
pkr7098 1:ed1c6618f739 41 void lcdShowLoadingSimbolTerminate(void)
pkr7098 1:ed1c6618f739 42 {
pkr7098 1:ed1c6618f739 43 semaphoreLCDLoading.acquire();
pkr7098 1:ed1c6618f739 44 }