FreeCalypso > hg > fc-magnetite
comparison src/aci2/aci/ati_fcmisc.c @ 669:227d37a968ec
AT+IOR and AT+IOW GPIO commands implemented in aci2
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 May 2020 02:55:26 +0000 |
parents | 36df58db1640 |
children |
comparison
equal
deleted
inserted
replaced
668:4011858168a1 | 669:227d37a968ec |
---|---|
163 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | 163 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); |
164 return (ATI_CMPL); | 164 return (ATI_CMPL); |
165 } | 165 } |
166 #endif /* TARGET_HAS_PWL */ | 166 #endif /* TARGET_HAS_PWL */ |
167 | 167 |
168 /* AT+IOR - read GPIO pin */ | |
169 GLOBAL T_ATI_RSLT atPlusIOR (char *cl, UBYTE srcId) | |
170 { | |
171 char *me="+IOR: "; | |
172 unsigned ionum; | |
173 int state; | |
174 | |
175 TRACE_FUNCTION("atPlusIOR()"); | |
176 | |
177 cl = parse(cl, "D", &ionum); | |
178 if (!cl) | |
179 return (ATI_FAIL); | |
180 if (ionum > 13) | |
181 return (ATI_FAIL); | |
182 state = AI_ReadBit(ionum); | |
183 sprintf(g_sa, "%s%u,%d", me, ionum, state); | |
184 io_sendMessage(srcId, g_sa, ATI_NORMAL_OUTPUT); | |
185 return (ATI_CMPL); | |
186 } | |
187 | |
188 /* AT+IOW - set GPIO pin */ | |
189 GLOBAL T_ATI_RSLT atPlusIOW (char *cl, UBYTE srcId) | |
190 { | |
191 unsigned ionum; | |
192 int state; | |
193 | |
194 TRACE_FUNCTION("atPlusIOW()"); | |
195 | |
196 cl = parse(cl, "DD", &ionum, &state); | |
197 if (!cl) | |
198 return (ATI_FAIL); | |
199 if (ionum > 13) | |
200 return (ATI_FAIL); | |
201 if (state) | |
202 AI_SetBit(ionum); | |
203 else | |
204 AI_ResetBit(ionum); | |
205 return (ATI_CMPL); | |
206 } | |
207 | |
168 #endif /* ATI_FCMISC_C */ | 208 #endif /* ATI_FCMISC_C */ |