mirror of https://github.com/noisymime/Arduino.git
Added function to get firmware version
This commit is contained in:
parent
bd72512a59
commit
640465462d
|
@ -25,7 +25,7 @@
|
|||
#include "lwip/dns.h"
|
||||
#include <board_init.h>
|
||||
|
||||
|
||||
extern const char* fwVersion;
|
||||
|
||||
/*! \name USART Settings
|
||||
*/
|
||||
|
@ -1278,6 +1278,20 @@ cmd_spi_state_t get_databuf_tcp_cmd_cb(char* recv, char* reply, void* ctx, uint1
|
|||
return SPI_CMD_DONE;
|
||||
}
|
||||
|
||||
cmd_spi_state_t get_firmware_version_cmd_cb(char* recv, char* reply, void* ctx, uint16_t* count) {
|
||||
|
||||
CHECK_ARD_NETIF(recv, reply, count);
|
||||
|
||||
CREATE_HEADER_REPLY(reply, recv, 1);
|
||||
|
||||
uint8_t len = strlen(fwVersion);
|
||||
|
||||
PUT_BUFDATA_BYTE(fwVersion, len, reply, 3);
|
||||
|
||||
END_HEADER_REPLY(reply, 3+len+1, *count);
|
||||
|
||||
return SPI_CMD_DONE;
|
||||
}
|
||||
|
||||
int sendReply(int cmdIdx, char* recv, char* reply, void* resultCmd)
|
||||
{
|
||||
|
@ -1435,6 +1449,7 @@ void init_spi_cmds() {
|
|||
spi_add_cmd(DATA_SENT_TCP_CMD, ack_cmd_cb, data_sent_tcp_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_DATABUF_TCP_CMD, ack_cmd_cb, get_databuf_tcp_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_CLIENT_STATE_TCP_CMD, ack_cmd_cb, get_client_state_tcp_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_FW_VERSION_CMD, ack_cmd_cb, get_firmware_version_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
#include "ard_utils.h"
|
||||
#include <lwip_setup.h>
|
||||
|
||||
|
||||
//void board_init(void);
|
||||
/* FIRMWARE version */
|
||||
const char* fwVersion = "1.0.0";
|
||||
|
||||
#if BOARD == ARDUINO
|
||||
#if !defined(DATAFLASH)
|
||||
|
|
|
@ -54,6 +54,7 @@ enum {
|
|||
REQ_HOST_BY_NAME_CMD= 0x34,
|
||||
GET_HOST_BY_NAME_CMD= 0x35,
|
||||
START_SCAN_NETWORKS = 0x36,
|
||||
GET_FW_VERSION_CMD = 0x37,
|
||||
|
||||
// All command with DATA_FLAG 0x40 send a 16bit Len
|
||||
|
||||
|
|
Loading…
Reference in New Issue