wifi8 2.0.0.0
|
API for configuring and manipulating WiFi 8 Click driver. More...
Topics | |
WiFi 8 MikroBUS Map | |
MikroBUS pin mapping of WiFi 8 Click driver. | |
Functions | |
void | wifi8_cfg_setup (wifi8_cfg_t *cfg) |
WiFi 8 configuration object setup function. | |
err_t | wifi8_init (wifi8_t *ctx, wifi8_cfg_t *cfg) |
WiFi 8 initialization function. | |
err_t | wifi8_default_cfg (wifi8_t *ctx) |
WiFi 8 default configuration function. | |
err_t | wifi8_generic_write (wifi8_t *ctx, uint8_t *data_in, uint8_t len) |
Generic writing function. | |
err_t | wifi8_generic_read (wifi8_t *ctx, uint8_t *data_out, uint8_t len) |
Generic reading function. | |
err_t | wifi8_reg_write (wifi8_t *ctx, uint32_t addr, uint32_t data_in) |
Write data to register address. | |
err_t | wifi8_reg_read (wifi8_t *ctx, uint32_t addr, uint32_t *data_out) |
Read data from register address. | |
err_t | wifi8_block_read (wifi8_t *ctx, uint32_t addr, uint8_t *data_buf, uint16_t buf_len) |
Read blocks of data from register address. | |
err_t | wifi8_block_write (wifi8_t *ctx, uint32_t addr, uint8_t *data_buf, uint16_t buf_len) |
Write blocks of data to register address. | |
err_t | wifi8_init_drv (wifi8_t *ctx) |
Synchronous API to initialize the device driver. | |
uint32_t | wifi8_chip_id (wifi8_t *ctx) |
Get device ID. | |
err_t | wifi8_get_full_firmware_version (wifi8_t *ctx, wifi8_m2m_rev_t *fw_version) |
Synchronous API to obtain the firmware version currently running on the device. | |
err_t | wifi8_get_ota_firmware_version (wifi8_t *ctx, wifi8_m2m_rev_t *fw_version) |
Synchronous API to obtain the firmware version of the device. | |
err_t | wifi8_connect (wifi8_t *ctx, char *pc_ssid, uint8_t u8_ssid_len, wifi8_m2m_sec_type_t u8_sec_type, void *pv_auth_info, uint16_t u16_ch) |
err_t | wifi8_get_connection_info (wifi8_t *ctx) |
err_t | wifi8_start_ap (wifi8_t *ctx, wifi8_m2m_ap_config_t *pstr_m2m_ap_config) |
Asynchronous API to enable access point (AKA "hot-spot") mode on the device. | |
err_t | wifi8_req_scan_result (wifi8_t *ctx, uint8_t scan_request_index) |
Asynchronous API to request the information of an access point discovered via scanning. | |
err_t | wifi8_request_scan (wifi8_t *ctx, uint8_t channel) |
Asynchronous API to request the WINC to scan for networks. | |
err_t | wifi8_handle_events (wifi8_t *ctx) |
Synchronous event handler function. | |
err_t | wifi8_ble_api_send (wifi8_t *ctx, uint8_t *msg, uint32_t len) |
Asynchronous API to send an encapsulated BLE message. | |
void | wifi8_socket_init (wifi8_t *ctx) |
The function performs the necessary initializations for the socket library. | |
err_t | wifi8_socket_create (wifi8_t *ctx, uint16_t u16_domain, uint8_t u8_type, uint8_t u8_flags) |
Synchronous socket allocation function based on the specified socket type. | |
err_t | wifi8_socket_bind (wifi8_t *ctx, int8_t sock, wifi8_sockaddr_t *pstr_addr, uint8_t u8_addr_len) |
Asynchronous bind function associates the provided address and local port to the socket. | |
int8_t | wifi8_socket_listen (wifi8_t *ctx, int8_t sock, uint8_t backlog) |
Asynchronous listen function. | |
err_t | wifi8_socket_connect (wifi8_t *ctx, int8_t sock, wifi8_sockaddr_t *pstr_addr, uint8_t u8_addr_len) |
Asynchronous connect function. | |
err_t | wifi8_socket_send (wifi8_t *ctx, int8_t sock, void *pv_send_buffer, uint16_t u16_send_length) |
Asynchronous sending function. | |
err_t | wifi8_socket_send_to (wifi8_t *ctx, int8_t sock, void *pv_send_buffer, uint16_t u16_send_length, wifi8_sockaddr_t *pstr_dest_addr, uint8_t u8_addr_len) |
Asynchronous sending function. | |
err_t | wifi8_socket_receive (wifi8_t *ctx, int8_t sock, void *pv_recv_buf, uint16_t u16_buf_len, uint32_t u32_timeoutmsec) |
Asynchronous receive function. | |
err_t | wifi8_socket_receive_from (wifi8_t *ctx, int8_t sock, void *pv_recv_buf, uint16_t u16_buf_len, uint32_t u32_timeoutmsec) |
Asynchronous receive function. | |
err_t | wifi8_socket_close (wifi8_t *ctx, int8_t sock) |
Synchronous close function. | |
API for configuring and manipulating WiFi 8 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
err_t wifi8_ble_api_send | ( | wifi8_t * | ctx, |
uint8_t * | msg, | ||
uint32_t | len ) |
Asynchronous API to send an encapsulated BLE message.
Asynchronous API to send an encapsulated BLE message over the Wifi Host Interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | msg | : Pointer to the start of the BLE message to transfer down to the device. |
[in] | len | : The length of the message in octets. |
0
- Success, -1
- Error.err_t wifi8_block_read | ( | wifi8_t * | ctx, |
uint32_t | addr, | ||
uint8_t * | data_buf, | ||
uint16_t | buf_len ) |
Read blocks of data from register address.
This function reads data from register address by using SPI serial interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | addr | : Register address. |
[out] | data_buf | : Read data. |
[in] | buf_len | : Number of bytes to read. |
0
- Success, -1
- Error.err_t wifi8_block_write | ( | wifi8_t * | ctx, |
uint32_t | addr, | ||
uint8_t * | data_buf, | ||
uint16_t | buf_len ) |
Write blocks of data to register address.
This function writes data to register address by using SPI serial interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | addr | : Register address. |
[in] | data_buf | : Data to write. |
[in] | buf_len | : Number of bytes to write. |
0
- Success, -1
- Error.void wifi8_cfg_setup | ( | wifi8_cfg_t * | cfg | ) |
WiFi 8 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See wifi8_cfg_t object definition for detailed explanation. |
uint32_t wifi8_chip_id | ( | wifi8_t * | ctx | ) |
Get device ID.
Reads and returns device ID.
[out] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
err_t wifi8_connect | ( | wifi8_t * | ctx, |
char * | pc_ssid, | ||
uint8_t | u8_ssid_len, | ||
wifi8_m2m_sec_type_t | u8_sec_type, | ||
void * | pv_auth_info, | ||
uint16_t | u16_ch ) |
@brie Asynchronous Wi-Fi connection function.
Asynchronous API to request connection to a specified access point.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | pc_ssid | : A buffer holding the SSID corresponding to the requested AP. |
[in] | u8_ssid_len | : Length of the given SSID (not including any NULL termination). |
[in] | u8_sec_type | : Wi-Fi security type security for the network. |
[in] | pv_auth_info | : Authentication parameters required for completing the connection. |
[in] | u16_ch | : Wi-Fi channel number as defined in tenuM2mScanCh enumeration. |
0
- Success, -1
- Error.err_t wifi8_default_cfg | ( | wifi8_t * | ctx | ) |
WiFi 8 default configuration function.
This function executes a default configuration of WiFi 8 click board.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t wifi8_generic_read | ( | wifi8_t * | ctx, |
uint8_t * | data_out, | ||
uint8_t | len ) |
Generic reading function.
This function reads a desired number of data bytes by using SPI serial interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t wifi8_generic_write | ( | wifi8_t * | ctx, |
uint8_t * | data_in, | ||
uint8_t | len ) |
Generic writing function.
This function writes a desired number of data bytes by using SPI serial interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.err_t wifi8_get_connection_info | ( | wifi8_t * | ctx | ) |
@brie Asynchronous API for retrieving the device connection status.
Requests the connection status from the device including information regarding any access point to which it is currently connected, or any non-AP station that is connected to the device. All information will be returned to the application via the Wi-Fi notification callback through the event M2M_WIFI_RESP_CONN_INFO.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t wifi8_get_full_firmware_version | ( | wifi8_t * | ctx, |
wifi8_m2m_rev_t * | fw_version ) |
Synchronous API to obtain the firmware version currently running on the device.
Read the firmware version currently running on the device.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[out] | fw_version | : Firmware object data. |
0
- Success, -1
- Error.err_t wifi8_get_ota_firmware_version | ( | wifi8_t * | ctx, |
wifi8_m2m_rev_t * | fw_version ) |
Synchronous API to obtain the firmware version of the device.
Synchronous API to obtain the firmware version of the device image that is stored in the inactive flash partition.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[out] | fw_version | : Firmware object data. |
0
- Success, -1
- Error.err_t wifi8_handle_events | ( | wifi8_t * | ctx | ) |
Synchronous event handler function.
This function is responsible for handling interrupts received from the device firmware. Applications should call this function periodically in-order to receive the events that are to be handled by the callback functions implemented by the application.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t wifi8_init | ( | wifi8_t * | ctx, |
wifi8_cfg_t * | cfg ) |
WiFi 8 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See wifi8_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t wifi8_init_drv | ( | wifi8_t * | ctx | ) |
Synchronous API to initialize the device driver.
This function initializes the device driver by registering the callback function for the M2M_WIFI layer handling of the events received, in response to the asynchronous Wi-Fi operations.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t wifi8_reg_read | ( | wifi8_t * | ctx, |
uint32_t | addr, | ||
uint32_t * | data_out ) |
Read data from register address.
This function reads data from register address by using SPI serial interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | addr | : Register address. |
[out] | data_out | : Data to be read. |
0
- Success, -1
- Error.err_t wifi8_reg_write | ( | wifi8_t * | ctx, |
uint32_t | addr, | ||
uint32_t | data_in ) |
Write data to register address.
This function writes data to register address by using SPI serial interface.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | addr | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.err_t wifi8_req_scan_result | ( | wifi8_t * | ctx, |
uint8_t | scan_request_index ) |
Asynchronous API to request the information of an access point discovered via scanning.
This function allows the information of any discovered access point to be retrieved. When a scan is completed, the application is informed of the number of networks (access points) discovered. Calling this function with an index, N, will return the information for the Nth access point. The information will be returned to the application via a M2M_WIFI_RESP_SCAN_RESULT event.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | scan_request_index | : Index for the requested result, the index range start from 0 till number of AP's found. |
0
- Success, -1
- Error.err_t wifi8_request_scan | ( | wifi8_t * | ctx, |
uint8_t | channel ) |
Asynchronous API to request the WINC to scan for networks.
Scan statuses are delivered to the application via the Wi-Fi event callback in three stages. The first step involves the event M2M_WIFI_RESP_SCAN_DONE which, if successful, of access points via multiple calls to the asynchronous wifi8_req_scan_result API. For M2M_WIFI_RESP_SCAN_RESULT.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | channel | : RF Channel ID for SCAN operation. |
0
- Success, -1
- Error.err_t wifi8_socket_bind | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
wifi8_sockaddr_t * | pstr_addr, | ||
uint8_t | u8_addr_len ) |
Asynchronous bind function associates the provided address and local port to the socket.
The asynchronous bind function associates the provided address and local port to the socket.The function can be used with both TCP and UDP sockets. Upon socket bind completion, the application will receive a SOCKET_MSG_BIND message in the socket callback.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | pstr_addr | :Pointer to socket address structure. |
[in] | u8_addr_len | : Size of the given socket address structure in bytes. |
0
- Success, -1
- Error.err_t wifi8_socket_close | ( | wifi8_t * | ctx, |
int8_t | sock ) |
Synchronous close function.
The synchronous close function, releases all the socket assigned resources.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
0
- Success, -1
- Error.err_t wifi8_socket_connect | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
wifi8_sockaddr_t * | pstr_addr, | ||
uint8_t | u8_addr_len ) |
Asynchronous connect function.
The asynchronous connect function must be called after receiving a valid socket ID from the wifi8_socket_create function. The application socket callback function is notified of the result of the connection attempt through the event SOCKET_MSG_CONNECT.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | pstr_addr | : Address of the remote server. |
[in] | u8_addr_len | : Size of the given socket address structure in bytes. |
0
- Success, -1
- Error.err_t wifi8_socket_create | ( | wifi8_t * | ctx, |
uint16_t | u16_domain, | ||
uint8_t | u8_type, | ||
uint8_t | u8_flags ) |
Synchronous socket allocation function based on the specified socket type.
Synchronous socket allocation function based on the specified socket type. Created sockets are non-blocking and their possible types are either TCP or a UDP sockets.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | u16_domain | : Socket family. |
[in] | u8_type | :Socket type. |
[in] | u8_flags | : Used to specify the socket creation flags. |
0
- Success, -1
- Error.void wifi8_socket_init | ( | wifi8_t * | ctx | ) |
The function performs the necessary initializations for the socket library.
The function performs the necessary initializations for the socket library through the following steps:
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
0
- Success, -1
- Error.int8_t wifi8_socket_listen | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
uint8_t | backlog ) |
Asynchronous listen function.
The asynchronous listen function, response is received through the event SOCKET_MSG_LISTEN in the socket callback.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | backlog | : Not used by the current implementation. |
0
- Success, -1
- Error.err_t wifi8_socket_receive | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
void * | pv_recv_buf, | ||
uint16_t | u16_buf_len, | ||
uint32_t | u32_timeoutmsec ) |
Asynchronous receive function.
The asynchronous receive function, used to retrieve data from a TCP stream.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | pv_recv_buf | : Pointer to a buffer that will hold the received data. |
[in] | u16_buf_len | : The buffer size in bytes. |
[in] | u32_timeoutmsec | : Timeout for the recv function in milli-seconds. |
0
- Success, -1
- Error.err_t wifi8_socket_receive_from | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
void * | pv_recv_buf, | ||
uint16_t | u16_buf_len, | ||
uint32_t | u32_timeoutmsec ) |
Asynchronous receive function.
The asynchronous recvfrom function is used to retrieve data from a UDP socket.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | pv_recv_buf | : Pointer to a buffer that will hold the received data. |
[in] | u16_buf_len | : The buffer size in bytes. |
[in] | u32_timeoutmsec | : Timeout for the recv function in milli-seconds. |
0
- Success, -1
- Error.err_t wifi8_socket_send | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
void * | pv_send_buffer, | ||
uint16_t | u16_send_length ) |
Asynchronous sending function.
The asynchronous sending function, used to send data on a TCP/UDP socket.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | pv_send_buffer | : Pointer to a buffer holding data to be transmitted. |
[in] | u16_send_length | : The buffer size in bytes. |
0
- Success, -1
- Error.err_t wifi8_socket_send_to | ( | wifi8_t * | ctx, |
int8_t | sock, | ||
void * | pv_send_buffer, | ||
uint16_t | u16_send_length, | ||
wifi8_sockaddr_t * | pstr_dest_addr, | ||
uint8_t | u8_addr_len ) |
Asynchronous sending function.
The asynchronous sending function, used to send data on a UDP socket.
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | sock | : Socket ID, must hold a non negative value. |
[in] | pv_send_buffer | : Pointer to a buffer holding data to be transmitted. |
[in] | u16_send_length | : The buffer size in bytes. |
[in] | pstr_dest_addr | : The destination address. |
[in] | u8_addr_len | : Destination address length in bytes. |
0
- Success, -1
- Error.err_t wifi8_start_ap | ( | wifi8_t * | ctx, |
wifi8_m2m_ap_config_t * | pstr_m2m_ap_config ) |
Asynchronous API to enable access point (AKA "hot-spot") mode on the device.
The WINC supports the ability to operate as an access point with the following limitations:
[in] | ctx | : Click context object. See wifi8_t object definition for detailed explanation. |
[in] | pstr_m2map_config | : A structure holding the AP configurations. |
0
- Success, -1
- Error.