@@ -337,6 +337,27 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
337337 GraphMeterMode_drawGraph (this , x + captionLen , y , w , this -> h , -1 );
338338}
339339
340+ static void IOMeterMode_draw (Meter * this , int x , int y , int w ) {
341+ assert (x >= 0 );
342+ assert (w <= INT_MAX - x );
343+
344+ // Draw the caption
345+ const int captionLen = 3 ;
346+ const char * caption = Meter_getCaption (this );
347+ if (w >= captionLen ) {
348+ attrset (CRT_colors [METER_TEXT ]);
349+ mvaddnstr (y , x , caption , captionLen );
350+ }
351+ w -= captionLen ;
352+
353+ // Draw the top graph, half height
354+ GraphMeterMode_drawGraph (this , x + captionLen , y , w , GRAPH_HEIGHT / 2 , 0 );
355+
356+ // Draw the bottom graph, half height
357+ y += GRAPH_HEIGHT / 2 ;
358+ GraphMeterMode_drawGraph (this , x + captionLen , y , w , GRAPH_HEIGHT / 2 , 1 );
359+ }
360+
340361/* ---------- LEDMeterMode ---------- */
341362
342363static const char * const LEDMeterMode_digitsAscii [] = {
@@ -442,6 +463,11 @@ static const MeterMode Meter_modes[] = {
442463 .h = DEFAULT_GRAPH_HEIGHT ,
443464 .draw = GraphMeterMode_draw ,
444465 },
466+ [IO_METERMODE ] = {
467+ .uiName = "In/Out" ,
468+ .h = GRAPH_HEIGHT ,
469+ .draw = IOMeterMode_draw ,
470+ },
445471 [LED_METERMODE ] = {
446472 .uiName = "LED" ,
447473 .h = 3 ,
0 commit comments