Hexiwear oled display from KDS3
Dependencies: Hexi_OLED_SSD1351
main.cpp
00001 #include "mbed.h" 00002 #include "Hexi_OLED_SSD1351.h" 00003 #include "string.h" 00004 00005 #define D {} 00006 00007 //#define DEBUG_LOGO 00008 #define DEBUG_BUTTON 00009 //#define DEBUG_WATCH 00010 //#define DEBUG_APP 00011 //#define DEBUG_WEATHER 00012 //#define DEBUG_MOTION 00013 //#define DEBUG_FLASHLIGHT 00014 //#define DEBUG_NOTIFICATION 00015 00016 00017 #ifdef DEBUG_LOGO 00018 #include "logo.h" 00019 #endif 00020 #ifdef DEBUG_BUTTON 00021 #include "button.h" 00022 #endif 00023 #ifdef DEBUG_WATCH 00024 #include "watch.h" 00025 #endif 00026 #ifdef DEBUG_APP 00027 #include "app.h" 00028 #endif 00029 #ifdef DEBUG_WEATHER 00030 #include "weather.h" 00031 #endif 00032 #ifdef DEBUG_MOTION 00033 #include "motion.h" 00034 #endif 00035 #ifdef DEBUG_FLASHLIGHT 00036 #include "flashlight.h" 00037 #endif 00038 #ifdef DEBUG_NOTIFICATION 00039 #include "notification.h" 00040 #endif 00041 00042 DigitalOut led1(LED1); 00043 SSD1351 oled(PTB22,PTB21,PTC13,PTB20,PTE6, PTD15); /* (MOSI,SCLK,POWER,CS,RST,DC) */ 00044 00045 const uint8_t *image; 00046 00047 // main() runs in its own thread in the OS 00048 int main() 00049 { 00050 00051 while (true) { 00052 led1 = !led1; 00053 00054 00055 #ifdef DEBUG_LOGO 00056 image = hexiwear_logo_bmp; 00057 oled.DrawImage(image,0,0); 00058 D Thread::wait(1000); 00059 oled.FillScreen(COLOR_BLACK); 00060 Thread::wait(1000); 00061 #endif 00062 00063 #ifdef DEBUG_BUTTON 00064 00065 image = buttonGroup_left_bmp; 00066 oled.DrawImage(image,2,30); 00067 00068 image = buttonGroup_left_bmp; 00069 oled.DrawImage(image,2,57); 00070 00071 D Thread::wait(1000); 00072 oled.FillScreen(COLOR_BLACK); 00073 00074 image = buttonGroup_right_bmp; 00075 oled.DrawImage(image,92,30); 00076 00077 image = buttonGroup_right_bmp; 00078 oled.DrawImage(image,92,57); 00079 00080 D Thread::wait(1000); 00081 oled.FillScreen(COLOR_BLACK); 00082 00083 image = button_start_bmp; 00084 oled.DrawImage(image,50,81); 00085 00086 Thread::wait(1000); 00087 oled.FillScreen(COLOR_BLACK); 00088 00089 image = button_stop_bmp; 00090 oled.DrawImage(image,50,81); 00091 00092 Thread::wait(1000); 00093 oled.FillScreen(COLOR_BLACK); 00094 00095 image = button_back_bmp; 00096 oled.DrawImage(image,0,81); 00097 00098 Thread::wait(1000); 00099 oled.FillScreen(COLOR_BLACK); 00100 00101 Thread::wait(1000); 00102 #endif 00103 00104 #ifdef DEBUG_MOTION 00105 image = gui_motionControl_cover_bmp; 00106 oled.DrawImage(image,0,0); 00107 Thread::wait(1000); 00108 00109 image = gui_motionControl_acc_bmp; 00110 oled.DrawImage(image,0,0); 00111 Thread::wait(1000); 00112 00113 image = gui_motionControl_gyro_bmp; 00114 oled.DrawImage(image,0,0); 00115 Thread::wait(1000); 00116 #endif 00117 00118 #ifdef DEBUG_FLASHLIGHT 00119 image = flashlight_screen_bmp; 00120 oled.DrawImage(image,0,0); 00121 Thread::wait(1000); 00122 00123 image = flashlight_off_bmp; 00124 oled.DrawImage(image,24,23); 00125 Thread::wait(1000); 00126 00127 image = flashlight_on_bmp; 00128 oled.DrawImage(image,24,23); 00129 Thread::wait(1000); 00130 #endif 00131 00132 #ifdef DEBUG_NOTIFICATION 00133 00134 image = gui_notifications_screen_bmp; 00135 oled.DrawImage(image,0,0); 00136 Thread::wait(1000); 00137 00138 oled.FillScreen(COLOR_WHITE); 00139 oled.FillScreen(COLOR_BLACK); 00140 00141 image = gui_notifications_mainScreen_bmp; 00142 oled.DrawImage(image,0,0); 00143 Thread::wait(1000); 00144 00145 oled.FillScreen(COLOR_WHITE); 00146 oled.FillScreen(COLOR_BLACK); 00147 00148 image = gui_notifications_mail_white_bmp; 00149 oled.DrawImage(image,13,9); 00150 00151 image = gui_notifications_sms_white_bmp; 00152 oled.DrawImage(image,16,32); 00153 00154 image = gui_notifications_call_white_bmp; 00155 oled.DrawImage(image,16,54); 00156 Thread::wait(1000); 00157 #endif 00158 00159 00160 } 00161 } 00162
Generated on Tue Jul 12 2022 18:04:05 by
1.7.2