SWRU368C May 2018 – January 2021 CC3100 , CC3100MOD , CC3200 , CC3200MOD
The device APIs handle the device power and general configuration.
Sl_Start – This function initializes the communication interface, sets the enable pin of the device, and calls to the init complete callback. If no callback function is provided, the function is blocking until the device finishes the initialization process. The device returns to its functional role in case of success: ROLE_STA, ROLE_AP, ROLE_P2P. Otherwise, in case of a failure it returns: ROLE_STA_ERR, ROLE_AP_ERR, ROLE_P2P_ERR
Sl_Stop – This function clears the enable pin of the device, closes the communication interface, and invokes the stop complete callback (if it exists). The time-out parameter lets the user control the hibernate timing:
sl_DevSet – This function configures different device parameters. The main parameters used are the DeviceSetID and Option. The possible DeviceSetID and Option combinations are:
Setting device time and date example:
SlDateTime_t dateTime= {0};
dateTime.sl_tm_day = (unsigned long)23; // Day of month (DD format) range 1-13
dateTime.sl_tm_mon = (unsigned long)6; // Month (MM format) in the range of 1-12
dateTime.sl_tm_year = (unsigned long)2014; // Year (YYYY format)
dateTime.sl_tm_hour = (unsigned long)17; // Hours in the range of 0-23
dateTime.sl_tm_min = (unsigned long)55; // Minutes in the range of 0-59
dateTime.sl_tm_sec = (unsigned long)22; // Seconds in the range of 0-59
sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,sizeof(SlDateTime_t),(unsigned char *
) (&dateTime));
sl_DevGet – This function lets the user read different device parameters. The main parameters used are the DeviceSetID and Option parameter. The possible DeviceSetID and Option combinations are:
Example for getting version:
SlVersionFull ver;
pConfigOpt = SL_DEVICE_GENERAL_VERSION;
sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &pConfigOpt,&pConfigLen,
(unsigned char*)(&ver));
printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP
%d.%d.%d.%d\nROM%d\nHOST%d.%d.%d.%d\n",
ver.ChipFwAndPhyVersion.ChipId,
ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
ver.RomVersion, SL_MAJOR_VERSION_NUM, SL_MINOR_VERSION_NUM, SL_VERSION_NUM,
SL_SUB_VERSION_NUM);
sl_EventMaskSet – Masks asynchronous events from the device. Masked events do not generate asynchronous messages from the device. This function receives an EventClass and a bit mask. The events and mask options are:
An example of masking out connection and disconnection from WLAN class:
sl_EventMaskSet(SL_EVENT_CLASS_WLAN, (SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
sl_EventMaskGet – Returns the events bit mask from the device. If that event is masked, the device does not send this event. The function is similar to sl_EventMaskSet.
An example of getting an event mask for WLAN class:
sl_EventMaskSet(SL_EVENT_CLASS_WLAN,
(SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
sl_EventMaskGet – Returns the events bit mask from the device. If an event is masked, the device does not send the event. The function is similar to sl_EventMaskSet.
An example of getting an event mask for WLAN class:
unsigned long maskWlan;
sl_StatusGet(SL_EVENT_CLASS_WLAN,&maskWlan);
sl_Task
sl_UartSetMode – This function should be used if the user’s chosen host interface is UART. The function sets the user’s UART configuration: