The final project of Embedde class.
Dependencies: C12832 LM75B ESP-call MMA7660
LCD.cpp
00001 #include "LCD.h" 00002 00003 C12832 _lcd(D11, D13, D12, D7, D10); 00004 Thread _lcdShowLoadingSimbol; 00005 Semaphore semaphoreLCD(0, 1); 00006 Semaphore semaphoreLCDLoading(0, 1); 00007 00008 int _x, _y; 00009 00010 static void lcdShowLoadingSimbol(void) 00011 { 00012 unsigned int count = 0; 00013 char simbols[] = {'\\', '|', '/', '-'}; 00014 while(1) { 00015 for(int i = 0; i < 4; i++) { 00016 semaphoreLCDLoading.acquire(); 00017 semaphoreLCD.acquire(); 00018 _lcd.locate(_x, _y); 00019 _lcd.putc(simbols[i]); 00020 semaphoreLCD.release(); 00021 semaphoreLCDLoading.release(); 00022 thread_sleep_for(LCD_LOADING_TERM); 00023 } 00024 } 00025 } 00026 00027 void lcdInit(void) 00028 { 00029 semaphoreLCD.release(); 00030 _lcdShowLoadingSimbol.start(lcdShowLoadingSimbol); 00031 } 00032 00033 void lcdShowLoadingSimbolStart(int x, int y) 00034 { 00035 _x = x; 00036 _y = y; 00037 semaphoreLCDLoading.release(); 00038 00039 } 00040 00041 void lcdShowLoadingSimbolTerminate(void) 00042 { 00043 semaphoreLCDLoading.acquire(); 00044 }
Generated on Fri Jul 15 2022 05:56:23 by 1.7.2