drivers/wireless/iee802154/xbee: Support "WR" AT command for writing parameters to non-volatile memory.

This commit is contained in:
Anthony Merlino 2019-01-10 12:11:00 +04:00
parent aad2fae1a1
commit 8fc7ee9cec
2 changed files with 30 additions and 4 deletions

View File

@ -657,6 +657,10 @@ static void xbee_process_apiframes(FAR struct xbee_priv_s *priv,
frame->io_data[frame->io_offset]);
priv->boostmode = frame->io_data[frame->io_offset++];
}
else if (memcmp(command, "WR", 2) == 0)
{
wlinfo("Write Complete: %d\n", frame->io_data[frame->io_offset]);
}
else
{
wlwarn("Unhandled AT Response: %.*s\n", 2, command);
@ -1354,10 +1358,21 @@ int xbee_atquery(FAR struct xbee_priv_s *priv, FAR const char *atcommand)
do
{
/* Setup a timeout */
/* There is a note in the XBee datasheet: Once you issue a WR command,
* do not send any additional characters to the device until after
* you receive the OK response.
*
* If we are issuing a WR command, don't set a timeout. We will have to rely
* on the XBee getting back to us reliably.
*/
(void)wd_start(priv->atquery_wd, XBEE_ATQUERY_TIMEOUT, xbee_atquery_timeout,
1, (wdparm_t)priv);
if (memcmp(atcommand, "WR", 2) != 0)
{
/* Setup a timeout */
(void)wd_start(priv->atquery_wd, XBEE_ATQUERY_TIMEOUT, xbee_atquery_timeout,
1, (wdparm_t)priv);
}
/* Send the query */

View File

@ -382,7 +382,18 @@ void xbee_send_atquery(FAR struct xbee_priv_s *priv, FAR const char *atcommand);
*
****************************************************************************/
#define xbee_query_assoc(priv) xbee_atquery(priv "AI")
#define xbee_query_assoc(priv) xbee_atquery(priv, "AI")
/****************************************************************************
* Name: xbee_save_params
*
* Description:
* Sends API frame with AT command request to write current parameters to
* non-volatile memory so that they are used after next reset.
*
****************************************************************************/
#define xbee_save_params(priv) xbee_atquery(priv, "WR")
/****************************************************************************
* Name: xbee_set_panid