SAPI Reference#
This section provides an overview of SAPI modules.
Bluetooth APIs to initialize and configure Bluetooth features.
Common APIs to initialize the driver and to handle common features, which are independent of device configuration mode.
Crypto APIs to perform cryptographic operations.
Driver APIs to initialize the driver and also to handle the events.
Network APIs for protocols including MQTT, FTP, HTTP, SMTP, SNTP, DHCP, POP3 and WebSockets.
RTOS APIs to manage tasks, mutexes, semaphores etc.
Wi-Fi APIs to initialize and configure Wi-Fi features.
Blocking vs. Non-blocking APIs#
SAPI functions are divided into two categories: blocking and non-blocking.
Blocking APIs#
Blocking APIs wait on a semaphore after sending a command to the device. The API waits until the semaphore is posted or it times out. SAPI driver posts the semaphore once the response from the device is received for that command. Every blocking API has a timeout configured in SAPI. If a semaphore wait times out, the API will get error an response code 0xFFE2
which is a command timeout error. For more information about API timeout errors please, see SAPI Timeout Error Indication and Recovery Mechanism
Non-Blocking APIs#
Non-blocking APIs do not wait for any event after sending the command to the device, they return immediately. When using non-blocking APIs, a callback must be registered to process the response for the command. Refer to Wi-Fi APIs for more information on the callbacks.
Note! A return value is provided for every API as follows
for success, the return value is
RSI_SUCCESS
for failure, the return is a negative value from the SAPI driver or the device. Common driver error codes are
RSI_ERROR_INVALID_PARAM
,RSI_ERROR_COMMAND_GIVEN_IN_WRONG_STATE
,RSI_ERROR_PKT_ALLOCATION_FAILURE
,RSI_ERROR_SPI_TIMEOUT
). For errors returned from the device, see Error Codes). Not all API's have an error returned from the device.