Skip to content

Commit

Permalink
extmod/network_cyw43: Add support to get STA RSSI using status() method.
Browse files Browse the repository at this point in the history
This enables the use of WLAN(0).status('rssi') to get current RSSI of the
AP that the STA is connected to.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
Oliver Joos authored and dpgeorge committed Apr 4, 2023
1 parent 11b5ee0 commit f34af3e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions extmod/network_cyw43.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,14 @@ STATIC mp_obj_t network_cyw43_status(size_t n_args, const mp_obj_t *args) {

// one argument: return status based on query parameter
switch (mp_obj_str_get_qstr(args[1])) {
case MP_QSTR_rssi: {
if (self->itf != CYW43_ITF_STA) {
mp_raise_ValueError(MP_ERROR_TEXT("STA required"));
}
int32_t rssi;
cyw43_wifi_get_rssi(self->cyw, &rssi);
return mp_obj_new_int(rssi);
}
case MP_QSTR_stations: {
// return list of connected stations
if (self->itf != CYW43_ITF_AP) {
Expand Down

0 comments on commit f34af3e

Please sign in to comment.