SSI handler.
Function handles SSI requests.
27{
28 size_t print_value;
29 switch (iIndex)
30 {
31 case 0:
32 print_value = snprintf(pcInsert, iInsertLen, "%f", (adc_read() * 3.3f / (1 << 12)));
33 break;
34 case 1:
35 print_value = snprintf(pcInsert, iInsertLen, "%f", (27.0f - ((adc_read() * 3.3f / (1 << 12)) - 0.706f) / 0.001721f));
36 break;
37 case 2:
38 if (cyw43_arch_gpio_get(CYW43_WL_GPIO_LED_PIN))
39 print_value = snprintf(pcInsert, iInsertLen, "ON");
40 else
41 print_value = snprintf(pcInsert, iInsertLen, "OFF");
42 break;
43 case 3:
45 print_value = snprintf(pcInsert, iInsertLen, "ON");
46 else
47 print_value = snprintf(pcInsert, iInsertLen, "OFF");
48 break;
49 case 4:
51 {
53 print_value = snprintf(pcInsert, iInsertLen, "rainbow-wheel");
54 break;
56 print_value = snprintf(pcInsert, iInsertLen, "rainbow-cycle");
57 break;
59 print_value = snprintf(pcInsert, iInsertLen, "static");
60 break;
62 print_value = snprintf(pcInsert, iInsertLen, "breathing");
63 break;
65 print_value = snprintf(pcInsert, iInsertLen, "flashing");
66 break;
68 print_value = snprintf(pcInsert, iInsertLen, "loading");
69 break;
71 print_value = snprintf(pcInsert, iInsertLen, "wave");
72 break;
74 print_value = snprintf(pcInsert, iInsertLen, "fade");
75 break;
76 default:
77 print_value = 0;
78 break;
79 }
80 break;
81 case 5:
83 {
85 print_value = snprintf(pcInsert, iInsertLen, "red");
86 break;
88 print_value = snprintf(pcInsert, iInsertLen, "green");
89 break;
91 print_value = snprintf(pcInsert, iInsertLen, "blue");
92 break;
94 print_value = snprintf(pcInsert, iInsertLen, "white");
95 break;
97 print_value = snprintf(pcInsert, iInsertLen, "purple");
98 break;
100 print_value = snprintf(pcInsert, iInsertLen, "yellow");
101 break;
103 print_value = snprintf(pcInsert, iInsertLen, "cyan");
104 break;
106 print_value = snprintf(pcInsert, iInsertLen, "orange");
107 break;
109 print_value = snprintf(pcInsert, iInsertLen, "pink");
110 break;
112 print_value = snprintf(pcInsert, iInsertLen, "turquoise");
113 break;
115 print_value = snprintf(pcInsert, iInsertLen, "magenta");
116 break;
117 default:
118 print_value = 0;
119 break;
120 }
121 break;
122 case 6:
124 break;
125 case 7:
127 print_value = snprintf(pcInsert, iInsertLen,
"%04d-%02d-%02dT%02d:%02d:%02dZ",
utc->tm_year + 1900,
utc->tm_mon + 1,
utc->tm_mday,
utc->tm_hour,
utc->tm_min,
utc->tm_sec);
128 else
129 print_value = snprintf(pcInsert, iInsertLen, "NULL");
130 break;
131 default:
132 print_value = 0;
133 break;
134 }
135 return (u16_t)print_value;
136}
volatile struct light_state_t light_state
Light state.
volatile struct tm * utc
UTC time struct.
enum light_modes light_mode