By connecting to the "ACM" port exposed on the USB of the STM32 (used as a service and connected to a PC) it is possible to send alphanumeric command (eg with "minicom") in order to perform: -Digital Output. -Switched pulse. -Digittal Input. -Analogic Input. -Request of a brief (returned by the serial line): 'H' or '?'. Note that all the commands can be given on a single string and it will be executed readily just at the instant each one is completely received.
Diff: src/main.cpp
- Revision:
- 1:cae05f3e5d56
- Parent:
- 0:2c26b4ba7cf3
- Child:
- 3:a425b8b0a4c2
--- a/src/main.cpp Tue Dec 19 09:23:12 2017 +0000 +++ b/src/main.cpp Tue Dec 19 09:45:19 2017 +0000 @@ -13,27 +13,28 @@ * Dove <time> è un valore float con precisione massima di 10^-3 Sec (es.: 0.00x è valildo, 0.000x non è valido). * Risposta: 'OK;' per ogni comando corretto, '<ERROR <wrong sequence> [(Port=<portName>, Pin=<pinNumber>)][analogic input name])\n\r' * in ogni altro caso. - * Risposta: 'OK;' per ogni comando corretto, 'ERROR <wrong sequence> [(Port=<portName>, Pin=<pinNumber>)][<analogic input name>])\n\r' + * Risposta: 'OK;' per ogni comando corretto, suggerimento come risposta a 'H' o '?', 'ERROR <wrong sequence> [(Port=<portName>, Pin=<pinNumber>)][<analogic input name>])\n\r' * in ogni altro caso. * N.B.: i comandi sono riportati facendo uso della seguente serie di espansioni: - * <s> per indicare una valore numerico o alfanumerico con significato 's'; [x-y] per indicare una range di interi da 'x' a 'y'; + * <s> per indicare un valore numerico o alfanumerico con significato 's'; [x-y] per indicare una range di interi da 'x' a 'y'; * [a,b,c,....] per indicare una serie di possibili stringhe (alfanumeriche) 'a', 'b', 'c',...; * e + come nelle standard re. * * Exposed functionality * By connecting to the "ACM" port exposed on the USB of the STM32 (used as a service and connected to a PC) it is possible to send the - * following commands in text format (eg with minicom). - * -DigitalOutput: command 'DO P<portName [B-G]> *<pinNumber [0-15]> <value [01]>;'. - * -Switch switch: combo 'DP P<portName> *<pinNumber [0-15]> <time>;'. - * From the moment the specified output is called, it is denied until the specified time expires. - * Note that it can be called reentrant and burst: the effect is exactly the one programmed: many "Timeouts" are instantiated every request and disallowed + * following commands in text format (eg. with "minicom"). + * -Digital Output: command 'DO P<portName [B-G]> *<pinNumber [0-15]> <value [01]>;'. + * -Switch Pulse: combo 'DP P<portName> *<pinNumber [0-15]> <time>;'. + * Where <time> is a float value with a maximum accuracy of 10 ^ -3 Sec (eg: 0.00x is valildo, 0.000x is not valid). * + * From the moment the specified output is called, it is denied until the specified time expires. + * Note that it can be called reentrant and burst: the effect is exactly the one programmed: many "Timeouts" are instantiated every request and disallowed * after the expiration of its time. - * -Digit to Input: command 'DI P<portName> *<pinNumber [0-15]>;'. Return '[01];' according to the voltage level present on the specified pin (0 or 1). + * -Digital Input: command 'DI P<portName> *<pinNumber [0-15]>;'. Return '[01];' according to the voltage level present on the specified pin (0 or 1). * -Analogic Input: command 'AI <analogic input name (at the moment only [ADC_TEMP, ADC_VREF, ADC_VBAT])>;' - * Where <time> is a float value with a maximum accuracy of 10 ^ -3 Sec (eg: 0.00x is valildo, 0.000x is not valid). * - * Answer: 'OK;' for each correct command, 'ERROR <wrong sequence> [(Port = <portName>, Pin = <pinNumber>)] [<analogic input name>])\n\r' in any other case. - * N.B .: the commands are shown using the following series of expansions: + * -Request of a brief: 'H' or '?'. + * Answer: 'OK;' for each correct command, command bried for brief request, 'ERROR <wrong sequence> [(Port = <portName>, Pin = <pinNumber>)] [<analogic input name>])\n\r' in any other case. + * N.B .: commands are shown using the following series of expansions: * <s> to indicate a numeric or alphanumeric value with meaning 's'; [x-y] to indicate a range of integers from 'x' to 'y'; - [a, b, c, ....] to indicate a series of possible strings (alphanumeric) 'a', 'b', 'c', ...; * and + as in Standards RE. + * [a, b, c, ....] to indicate a series of possible strings (alphanumeric) 'a', 'b', 'c', ...; * and + as in Standards RE. * * @author Lorenzo Sola * @date 18/12/2017