Step-by-step Usage Instructions
- Make sure you have the SOCK library in your project (actually, you only need this if you have #define WLN_WPA 1 or #define WLN_KEEP_ALIVE 1 ).
2.Add wln.tbs and wln.tbh files to your project (they are in current_library_set \wln\trunk).
- Add #define WLN_DEBUG_PRINT 1 to the defines section of the global.tbh file of your project. This way you will "see what's going on". Don't forget to remove this later, after you've made sure that the library operates as expected.
Some access points, notably CISCO devices, are so impatient during the WPA1/WPA2 handshake process, that printing debug info makes them timeout. If you notice that the WLN library is stuck in the endless association loop, and you are sure that your password is set correctly, then try disabling debug printing!
- Define GA1000 interface line mapping. The following code is suggested (unless you built your own hardware, in which case study the Configuring Interface Lines topic of the wln. object's documentation):
** Tibbo Basic **
#if PLATFORM_ID=EM500 or PLATFORM_ID=EM500W #define WLN_RESET_MODE 1 'there will be no dedicated reset, and all other lines are fixed #elif PLATFORM_ID=EM1206 or PLATFORM_ID=EM1206W #define WLN_CLK PL_IO_NUM_14 #define WLN_CS PL_IO_NUM_15 #define WLN_DI PL_IO_NUM_12 #define WLN_DO PL_IO_NUM_13 #define WLN_RST PL_IO_NUM_11 #else 'EM1000, NB1010,... #define WLN_CLK PL_IO_NUM_53 #define WLN_CS PL_IO_NUM_49 #define WLN_DI PL_IO_NUM_52 #define WLN_DO PL_IO_NUM_50 #define WLN_RST PL_IO_NUM_51 #endif
Add include "wln\trunk\wln.tbh" to the includes section of the global.tbh file.
Add wln_proc_timer() to the on_sys_timer() event handler code (this library assumes that this event is generated twice per second).
Add wln_proc_data() to the on_sock_data_arrival() event handler code.
Add wln_proc_task_complete() to the on_wln_task_complete() event handler code. Pass completed_task argument of on_wln_task_complete() directly to wln_proc_task_complete().
Add wln_proc_event() to the on_wln_event() event handler code. Pass wln_event argument of on_wln_event() directly to wln_proc_event().
Create empty callback function bodies (presumably in device.tbs): callback_wln_ok() , callback_wln_failure() , callback_wln_pre_buffrq() , callback_wln_rescan_result() . Hint: copy from declarations in wln.tbh or from our code example .
Add ga1000fw.bin file to your project. This is the firmware file for the GA1000 Wi-Fi add-on module. You can get it at http://tibbo.com/downloads/basic/firmware.html .
Call wln_start() from somewhere. The no-brainer decision is to call from the on_sys_init() event handler. Note that wln_start() may fail, so it is wise to check the returned status code.
All of the above is illustrated in a code example .
If you are going to use WPA/WPA2 security
Add #define WLN_WPA 1 to the defines section of the global.tbh file.
Add an empty callback function body (presumably in device.tbs) for callback_wln_mkey_progress_update() .
Use wln_wpa_mkey_get() to calculate a pre-shared master key, which is required for WPA/WPA2 security. Assign this function's output result to the key argument of the wln_start() function.