Skip to content

Commit

Permalink
drivers/wireless/gs2200m: Add power-save and sync-loss interval
Browse files Browse the repository at this point in the history
Add power save control and sync loss interval on GS2200M.

(cherry picked from commit 697bbff)
  • Loading branch information
SPRESENSE committed Aug 2, 2022
1 parent c919c11 commit 6d2abaa
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/wireless/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ config WL_GS2200M_CHECK_VERSION
bool "Check the version of GS2200M"
default n

config WL_GS2200M_SYNC_INTERVAL
int "Sync loss interval in station mode (100ms)"
default 100
range 1 63325
---help---
Time interval to recognize dis-association situation.
The value indicate n times of Wi-Fi beacon. If the node
lost receiving beacon n times, behave as dis-associtaion.
Time difference between 2 beacons are approximetely 100 msec.
So the unit of the value is 100 ms.

config WL_GS2200M_LOGLEVEL
int "Log level"
default 0
Expand Down
38 changes: 38 additions & 0 deletions drivers/wireless/gs2200m.c
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,34 @@ static enum pkt_type_e gs2200m_activate_wrx(FAR struct gs2200m_dev_s *dev,
return gs2200m_send_cmd2(dev, cmd);
}

/****************************************************************************
* Name: gs2200m_powersave_wrx
* NOTE: See 9.1.1 Active Radio Receive
****************************************************************************/

static enum pkt_type_e gs2200m_powersave_wrx(FAR struct gs2200m_dev_s *dev,
uint8_t on)
{
char cmd[30];

snprintf(cmd, sizeof(cmd), "AT+WRXPS=%d\r\n", on);
return gs2200m_send_cmd2(dev, cmd);
}

/****************************************************************************
* Name: gs2200m_syncloss
* NOTE: See 5.1.4 Sync loss interval
****************************************************************************/

static enum pkt_type_e gs2200m_syncloss(FAR struct gs2200m_dev_s *dev,
int val)
{
char cmd[30];

snprintf(cmd, sizeof(cmd), "AT+WSYNCINTRL=%d\r\n", val);
return gs2200m_send_cmd2(dev, cmd);
}

/****************************************************************************
* Name: gs2200m_set_gpio
* NOTE: See 10.3 GPIO Commands
Expand Down Expand Up @@ -2685,6 +2713,11 @@ static int gs2200m_ioctl_assoc_sta(FAR struct gs2200m_dev_s *dev,

dev->disassociate_flag = false;

/* Sync lost time interval */

t = gs2200m_syncloss(dev, CONFIG_WL_GS2200M_SYNC_INTERVAL);
ASSERT(TYPE_OK == t);

return OK;
}

Expand Down Expand Up @@ -3429,6 +3462,11 @@ static int gs2200m_start(FAR struct gs2200m_dev_s *dev)
t = gs2200m_activate_wrx(dev, 1);
ASSERT(TYPE_OK == t);

/* Power save disable */

t = gs2200m_powersave_wrx(dev, 0);
ASSERT(TYPE_OK == t);

/* Set Bulk Data mode */

t = gs2200m_enable_bulk(dev, 1);
Expand Down

0 comments on commit 6d2abaa

Please sign in to comment.