Added a GPIO to power on/off for external I2C sensor(s) (with LEDs)

Dependencies:   UniGraphic mbed vt100

18-Jun-2018 外部センサの電源オン・オフ機能は下位互換の為に無効になっていました。 この版で再度有効にしました。

Committer:
Rhyme
Date:
Fri Apr 13 04:19:23 2018 +0000
Revision:
0:846e2321c637
power to color sensor on/off test OK. Currently the function is disabled.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:846e2321c637 1 #include "mbed.h"
Rhyme 0:846e2321c637 2 #include "edge_mgr.h"
Rhyme 0:846e2321c637 3 #include "edge_reset_mgr.h"
Rhyme 0:846e2321c637 4 #include "edge_chart.h"
Rhyme 0:846e2321c637 5 #if 0
Rhyme 0:846e2321c637 6 typedef struct _edge_chart_st {
Rhyme 0:846e2321c637 7 char *name ;
Rhyme 0:846e2321c637 8 int left ;
Rhyme 0:846e2321c637 9 int top ;
Rhyme 0:846e2321c637 10 int width ;
Rhyme 0:846e2321c637 11 int height ;
Rhyme 0:846e2321c637 12 int index ;
Rhyme 0:846e2321c637 13 int min ;
Rhyme 0:846e2321c637 14 int max ;
Rhyme 0:846e2321c637 15 } edge_chart_type ;
Rhyme 0:846e2321c637 16
Rhyme 0:846e2321c637 17 extern edge_chart_type edge_chart[] ;
Rhyme 0:846e2321c637 18 #endif
Rhyme 0:846e2321c637 19
Rhyme 0:846e2321c637 20 edge_chart_type edge_chart[] = {
Rhyme 0:846e2321c637 21 /* name, left, top, width, height, index, min, max */
Rhyme 0:846e2321c637 22 { "Accel", 0, 0, 160, 60, 0, -0.2, 0.2 },
Rhyme 0:846e2321c637 23 { "Color", 160, 0, 160, 120, 0, 0.0, 10000.0 },
Rhyme 0:846e2321c637 24 { "Color2", 160, 120, 160, 120, 0, 0.0, 10000.0 },
Rhyme 0:846e2321c637 25 { "Temp", 0, 120, 160, 120, 0, -10.0, 50.0 },
Rhyme 0:846e2321c637 26 { "Press", 0, 60, 160, 60, 0, -1.0, 5.0 },
Rhyme 0:846e2321c637 27 { 0, 0, 0, 0, 0, 0, 0.0, 0.0 }
Rhyme 0:846e2321c637 28 } ;
Rhyme 0:846e2321c637 29
Rhyme 0:846e2321c637 30 void draw_chart_frame(edge_chart_type *p)
Rhyme 0:846e2321c637 31 {
Rhyme 0:846e2321c637 32 if (display) {
Rhyme 0:846e2321c637 33 display->fillrect(p->left+1, p->top+1,
Rhyme 0:846e2321c637 34 p->left + p->width - 2, p->top + p->height - 2, Black) ;
Rhyme 0:846e2321c637 35 display->rect(p->left, p->top,
Rhyme 0:846e2321c637 36 p->left + p->width - 1,
Rhyme 0:846e2321c637 37 p->top + p->height -1, Blue) ;
Rhyme 0:846e2321c637 38 display->set_font((unsigned char*) Arial12x12);
Rhyme 0:846e2321c637 39 display->foreground(White) ;
Rhyme 0:846e2321c637 40 display->locate(p->left + 5, p->top + 5) ;
Rhyme 0:846e2321c637 41 display->printf(p->name) ;
Rhyme 0:846e2321c637 42 }
Rhyme 0:846e2321c637 43 }
Rhyme 0:846e2321c637 44
Rhyme 0:846e2321c637 45 void draw_all_chart_frame(void)
Rhyme 0:846e2321c637 46 {
Rhyme 0:846e2321c637 47 edge_chart_type *p ;
Rhyme 0:846e2321c637 48 if (display) {
Rhyme 0:846e2321c637 49 reset_watch_dog() ;
Rhyme 0:846e2321c637 50 display->BusEnable(true) ;
Rhyme 0:846e2321c637 51 for(p = edge_chart ; p->name ; p++ ) {
Rhyme 0:846e2321c637 52 draw_chart_frame(p) ;
Rhyme 0:846e2321c637 53 }
Rhyme 0:846e2321c637 54 display->BusEnable(false) ;
Rhyme 0:846e2321c637 55 }
Rhyme 0:846e2321c637 56 }