protegemed, aquisição via A/D simples utilizando interrupção do timer
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Fork of ptgm_semDMA by
Codes/TelnetCommands/telnet_version.cpp@1:8129536051df, 2016-01-13 (annotated)
- Committer:
- viniciushl
- Date:
- Wed Jan 13 18:53:25 2016 +0000
- Revision:
- 1:8129536051df
- Parent:
- 0:fac116e94d44
Alterada captura para aquisi??o simples do A/D utilizando interrup??o do timer;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rebonatto | 0:fac116e94d44 | 1 | #include "TelnetServer.h" |
rebonatto | 0:fac116e94d44 | 2 | |
rebonatto | 0:fac116e94d44 | 3 | char *header_msg_version = "Protegemed - version information:\r\n\r\n"; |
rebonatto | 0:fac116e94d44 | 4 | char *fwversion_msg = "FW Version: "; |
rebonatto | 0:fac116e94d44 | 5 | char *builddate_msg = "\r\nBuild Date: "; |
rebonatto | 0:fac116e94d44 | 6 | char *fwfile_msg = "\r\nFW Filename: "; |
rebonatto | 0:fac116e94d44 | 7 | char *fwfile_not_available_msg = "Information not available"; |
rebonatto | 0:fac116e94d44 | 8 | |
rebonatto | 0:fac116e94d44 | 9 | #define VERSION_TEXT "2.0" |
rebonatto | 0:fac116e94d44 | 10 | #define BUILD_TEXT __TIME__ |
rebonatto | 0:fac116e94d44 | 11 | |
rebonatto | 0:fac116e94d44 | 12 | int TelnetServer::VersionCommand(TCPSocketConnection *conn,char** argv,int argc) |
rebonatto | 0:fac116e94d44 | 13 | { |
rebonatto | 0:fac116e94d44 | 14 | |
rebonatto | 0:fac116e94d44 | 15 | |
rebonatto | 0:fac116e94d44 | 16 | conn->send(header_msg_version,strlen(header_msg_version)); |
rebonatto | 0:fac116e94d44 | 17 | |
rebonatto | 0:fac116e94d44 | 18 | conn->send(fwversion_msg,strlen(fwversion_msg)); |
rebonatto | 0:fac116e94d44 | 19 | |
rebonatto | 0:fac116e94d44 | 20 | conn->send(VERSION_TEXT,strlen(VERSION_TEXT)); |
rebonatto | 0:fac116e94d44 | 21 | |
rebonatto | 0:fac116e94d44 | 22 | conn->send(builddate_msg,strlen(builddate_msg)); |
rebonatto | 0:fac116e94d44 | 23 | |
rebonatto | 0:fac116e94d44 | 24 | conn->send(BUILD_TEXT,strlen(BUILD_TEXT)); |
rebonatto | 0:fac116e94d44 | 25 | //printf("Version\n"); |
rebonatto | 0:fac116e94d44 | 26 | conn->send(fwfile_msg,strlen(fwfile_msg)); |
rebonatto | 0:fac116e94d44 | 27 | |
rebonatto | 0:fac116e94d44 | 28 | FILE *f = fopen("/local/version.txt","r"); |
rebonatto | 0:fac116e94d44 | 29 | if(f != NULL) |
rebonatto | 0:fac116e94d44 | 30 | { |
rebonatto | 0:fac116e94d44 | 31 | char buf[20]; |
rebonatto | 0:fac116e94d44 | 32 | fread(buf,1,19,f); |
rebonatto | 0:fac116e94d44 | 33 | buf[19]='\0'; |
rebonatto | 0:fac116e94d44 | 34 | conn->send(buf,strlen(buf)); |
rebonatto | 0:fac116e94d44 | 35 | fclose(f); |
rebonatto | 0:fac116e94d44 | 36 | } |
rebonatto | 0:fac116e94d44 | 37 | else |
rebonatto | 0:fac116e94d44 | 38 | { |
rebonatto | 0:fac116e94d44 | 39 | conn->send(fwfile_not_available_msg,strlen(fwfile_not_available_msg)); |
rebonatto | 0:fac116e94d44 | 40 | } |
rebonatto | 0:fac116e94d44 | 41 | |
rebonatto | 0:fac116e94d44 | 42 | conn->send("\r\n\r\n",strlen("\r\n\r\n")); |
rebonatto | 0:fac116e94d44 | 43 | return 0; |
rebonatto | 0:fac116e94d44 | 44 | } |