diff --git a/cube/User/Src/loopCtrl.c b/cube/User/Src/loopCtrl.c index 7ce6f62..e46a673 100644 --- a/cube/User/Src/loopCtrl.c +++ b/cube/User/Src/loopCtrl.c @@ -2,6 +2,7 @@ #include #include #include +#include bool loopActive = false; @@ -10,6 +11,7 @@ void loopEnable() { HAL_GPIO_WritePin(Loop_Enable_GPIO_Port, Loop_Enable_Pin, GPIO_PIN_SET); HAL_GPIO_WritePin(Loop_Enable_GPIO_Port, Loop_Enable_Pin, GPIO_PIN_RESET); coloredMsg(LOG_HIGH, true, "lc le loop is enabled"); + oledPrint("loop enabled"); } void loopDisable() { @@ -17,6 +19,7 @@ void loopDisable() { HAL_GPIO_WritePin(Loop_Disable_GPIO_Port, Loop_Disable_Pin, GPIO_PIN_RESET); loopActive = false; coloredMsg(LOG_HIGH, true, "lc ld loop is disabled"); + oledPrint("loop disabled"); } void loopStatusCallback() { diff --git a/cube/User/Src/oled.c b/cube/User/Src/oled.c index cf13c1a..bbd9ab2 100644 --- a/cube/User/Src/oled.c +++ b/cube/User/Src/oled.c @@ -23,14 +23,6 @@ #define LOW GPIO_PIN_RESET -// DO: SPI Clk, D1: SPI Data - - - - - - - static void __LEDPIN_RST(GPIO_PinState v) { HAL_GPIO_WritePin(Display_RES_GPIO_Port, Display_RES_Pin, v); @@ -365,145 +357,6 @@ void oled_PrintBMP(unsigned char x0,unsigned char y0,unsigned char x1,unsigned c } } -//void oled_PrintValueC(unsigned char x, unsigned char y, char data) -//{ -// unsigned char i,j,k; -// if(data < 0) -// { -// oled_P6x8Char(x,y,'-'); -// data = - data; -// } -// else -// { -// oled_P6x8Char(x,y,'+'); -// } -// i = data/100; -// j = (data%100)/10; -// k = data%10; -// oled_P6x8Char(x+6,y,i+48); -// oled_P6x8Char(x+12,y,j+48); -// oled_P6x8Char(x+18,y,k+48); -//} -// -// -//void oled_PrintValueI(unsigned char x, unsigned char y, int data) -//{ -// unsigned char i,j,k,l,m; -// if(data < 0) -// { -// oled_P6x8Char(x,y,'-'); -// data = - data; -// } -//// else -//// { -//// oled_P6x8Char(x,y,'+'); -//// } -// -// l = data/10000; -// m= (data%10000)/1000; -// i = (data%1000)/100; -// j = (data%100)/10; -// k = data%10; -// -// unsigned char c; -// c = (l == 0) ? ' ' : (l + 48); oled_P6x8Char(x+6,y,c); -// c = (m == 0 && l == 0) ? ' ' : (m + 48); oled_P6x8Char(x+12,y,c); -// c = (i == 0 && m == 0 && l == 0) ? ' ' : (i + 48); oled_P6x8Char(x+18,y,c); -// c = (j == 0 && i == 0 && m == 0 && l == 0) ? ' ' : (j + 48); oled_P6x8Char(x+24,y,c); -// oled_P6x8Char(x+30,y,k+48); -//} -// -//void oled_PrintValueFP(unsigned char x, unsigned char y, unsigned int data, unsigned char num) -//{ -// unsigned char m,i,j,k; -// oled_P6x8Char(x, y, '.'); -// m= data/1000; -// i = (data%1000)/100; -// j = (data%100)/10; -// k = data%10; -// switch(num) -// { -// case 1: LED_P6x8Char(x+6,y,k+48); -// break; -// case 2: LED_P6x8Char(x+6,y,j+48); -// oled_P6x8Char(x+12,y,k+48); -// break; -// case 3: LED_P6x8Char(x+6,y,i+48); -// oled_P6x8Char(x+12,y,j+48); -// oled_P6x8Char(x+18,y,k+48); -// break; -// case 4: LED_P6x8Char(x+6,y,m+48); -// oled_P6x8Char(x+12,y,i+48); -// oled_P6x8Char(x+18,y,j+48); -// oled_P6x8Char(x+24,y,k+48); -// break; -// } -//} -// -// -//void oled_PrintValueF(unsigned char x, unsigned char y, float data, unsigned char num) -//{ -// unsigned char l,m,i,j,k; -// unsigned char databiti = 6; -// unsigned int tempdataui = 0; -// int tempdataii = (int)data; -// long int tempdatalp = (long int)((data - (int)data)*10000); -// -// -// if(data < 0.0000001) oled_P6x8Char(x, y,'-'); -// else oled_P6x8Char(x, y,'+'); -// if(tempdataii < 0)tempdataii = - tempdataii; -// tempdataui = tempdataii; -// l = tempdataui/10000; -// m= (tempdataui%10000)/1000; -// i = (tempdataui%1000)/100; -// j = (tempdataui%100)/10; -// k = tempdataui%10; -// if (l != 0) -// { -// oled_P6x8Char(x+6,y,l+48); -// oled_P6x8Char(x+12,y,m+48); -// oled_P6x8Char(x+18,y,i+48); -// oled_P6x8Char(x+24,y,j+48); -// oled_P6x8Char(x+30,y,k+48); -// } -// else if(m != 0) -// { -// databiti = 5; -// oled_P6x8Char(x+6,y,m+48); -// oled_P6x8Char(x+12,y,i+48); -// oled_P6x8Char(x+18,y,j+48); -// oled_P6x8Char(x+24,y,k+48); -// } -// else if(i != 0) -// { -// databiti = 4; -// oled_P6x8Char(x+6,y,i+48); -// oled_P6x8Char(x+12,y,j+48); -// oled_P6x8Char(x+18,y,k+48); -// } -// else if(j != 0) -// { -// databiti = 3; -// oled_P6x8Char(x+6,y,j+48); -// oled_P6x8Char(x+12,y,k+48); -// } -// else -// { -// databiti = 2; -// oled_P6x8Char(x+6,y,k+48); -// } -// if(tempdatalp < 0)tempdatalp = - tempdatalp; -// switch(num) -// { -// case 0: break; -// case 1: oled_PrintValueFP(x + databiti * 6, y, (unsigned int)(tempdatalp / 1000),num);break; -// case 2: oled_PrintValueFP(x + databiti * 6, y, (unsigned int)(tempdatalp / 100),num);break; -// case 3: oled_PrintValueFP(x + databiti * 6, y, (unsigned int)(tempdatalp / 10),num);break; -// case 4: oled_PrintValueFP(x + databiti * 6, y, (unsigned int)(tempdatalp),num);break; -// } -//} - void oled_Cursor(unsigned char cursor_column, unsigned char cursor_row) { if(cursor_row != 0) @@ -519,19 +372,6 @@ void oled_Cursor(unsigned char cursor_column, unsigned char cursor_row) } } -#if 0 -void setup() -{ - LEDPIN_Init(); - oled_Init(); -} -void loop() -{ - oled_P8x16Str(23,0,"welcome to"); - oled_P8x16Str(40,2,"Smart"); - oled_P8x16Str(20,4,"Prototyping"); -} -#endif #define MAX_LINES 8