505
TIDE and Tibbo BASIC User Manual
©2000-2008 Tibbo Technology Inc.
'BRINGING UP THE WI-FI MODULE (SIMPLIFIED)
Sub
On
_sys_init()
'----- allocate buffers -----
wln.buffrq(6)
sys.buffalloc
'----- issue hardware reset -----
io.num=WLN_RST
io.enabled=YES
io.state=LOW
io.state=HIGH
'----- map interface lines -----
wln.csmap=WLN_CS
io.num=WLN_CS
io.enabled=YES
wln.dimap=WLN_DI
wln.domap=WLN_
Do
io.num=WLN_
Do
io.enabled=YES
wln.clkmap=WLN_CLK
io.num=WLN_CLK
io.enabled=YES
'----- set MAC address (optional) -----
wln.mac="0.100.110.120.130.140"
'----- set domain -----
wln.domain=PL_WLN_DOMAIN_FCC
'----- boot up the GA1000 -----
romfile.open("ga1000fw.bin")
wln.boot(romfile.offset)
'----- setup the IP, gateway, netmask -----
wln.ip="192.168.1.86"
wln.gatewayip="192.168.1.1"
wln.netmask="255.255.255.0"
'----- set TX power (optional) -----
wln.settxpower(15)
...
End
Sub
Allocating Buffer Memory
The first step is to allocate memory for a single buffer required by the wln object.
This buffer is used to form outgoing packets and is necessary for correct operation.
You never have to deal with this buffer directly -- it is handled internally by the
wln object.
Buffer memory is allocated in pages. A page is 256 bytes of memory. Allocating
memory for a buffer is a two-step process: First you have to request for a specific
allocation (a number of pages) and then you have to perform the actual allocation.
Request the size you need in pages using the
method.
The allocation method (
) applies to all buffers previously specified,
in one fell swoop:
516
217