33u8g_t u8g;
44
55
6- void u8g_prepare (void ) {
6+ void u8g_prepare (void )
7+ {
78 u8g_SetFont (&u8g, u8g_font_6x10); /* set the current font and reset the font reference position to "Baseline" */
89 u8g_SetFontRefHeightExtendedText (&u8g); /* define the calculation method for the ascent and descent of the current font */
910 u8g_SetDefaultForegroundColor (&u8g); /* assign one of the default colors as current color index */
1011 u8g_SetFontPosTop (&u8g); /* set the reference position for the character and string draw procedure */
1112}
1213
13- void display_app_name (uint16_t kind_index){
14+ void display_app_name (uint16_t kind_index)
15+ {
1416 u8g_prepare ();
1517 switch (kind_index){
1618 case 0 :
@@ -31,7 +33,8 @@ void display_app_name(uint16_t kind_index){
3133 }
3234}
3335
34- void display_app_power (uint16_t app_power){ // 显示实时的功率值
36+ void display_app_power (uint16_t app_power)
37+ { // 显示实时的功率值
3538 char s[10 ][10 ] ;
3639 float t;
3740 t= app_power*0.05 ;
@@ -40,14 +43,14 @@ void display_app_power(uint16_t app_power){ //显示实时的功率值
4043 u8g_DrawStr (&u8g, 30 , 40 , s[0 ]);
4144}
4245
43- void m_u8g_init (void ){
46+ void m_u8g_init (void )
47+ {
4448 u8g_InitComFn (&u8g, &u8g_dev_ssd1306_128x64_2x_i2c, U8G_COM_SSD_I2C); /* create a new interface to a graphics display */
4549 u8g_Begin (&u8g); /* reset display and put it into default state */
4650}
4751
48- void display (uint16_t index,uint16_t display_power){
49-
50-
52+ void display (uint16_t index,uint16_t display_power)
53+ {
5154 u8g_FirstPage (&u8g); /* marks the beginning of the picture loop; it cannot be used inside the picture loop */
5255 do {
5356
@@ -57,7 +60,8 @@ void display(uint16_t index,uint16_t display_power){
5760 } while (u8g_NextPage (&u8g));
5861}
5962
60- void PrintEvent (sample_data_node_ptr front, int windows_len){
63+ void PrintEvent (sample_data_node_ptr front, int windows_len)
64+ {
6165 for (uint32_t i=0 ;i<windows_len;i++){
6266 front = front->next_ptr ;
6367 EMBARC_PRINTF (" %d,%d,%d\n " ,front->IRMS ,-(front->active_power ),-(front->reactive_power ));
0 commit comments