Main Site Documentation

Driver - FEZ Connect Driver


#1

[title]FEZ Connect Driver[/title]
http://code.tinyclr.com/project/421/fez-connect-driver/
[line]
This project demonstrates my FEZ Connect Driver code.
The drive is a simple wrapper around the WIZnet device on the FEZ Connect board.

FEZConnectDriver provides device and network initialization:
[ulist] InitializeDevice
sets the chip-select and reset pins.
calls WIZnet_W5100.Enable
InitializeNetwork
sets static or dynamic (DHCP) IP address assignment.
automatically calls DHCP release when re-initializing the network.
handles errors in a graceful way with error messages that can be shown in the Debug window.[/ulist]

I’ve included several utility classes:

NetUtils contains these functions:
ContentType
[ulist]converts file extension to mime content type.[/ulist]
MACAddressToBytes
[ulist]converts MAC string address into MAC byte array.[/ulist]
IPAddressToBytes
[ulist]converts IP string address into IP byte array.[/ulist]
IPBytesToString
[ulist]converts IP byte array into IP string.[/ulist]
GetBaseUrl
[ulist]extracts and decodes a base url string from a raw HTTP url string.[/ulist]
GetQueryString
[ulist]extracts and decodes a querystring from a raw HTTP url string.[/ulist]
ParseBaseUrl
[ulist]extracts filePath, fileName, and fileExtension from a raw HTTP url string.[/ulist]
ParseQueryString
[ulist]parses an HTTP querystring into name-value pairs.[/ulist]
ParsePostData
[ulist]parses HTTP post data into name-value pairs.[/ulist]
UrlDecode
[ulist]replaces escape characters with actual characters.[/ulist]
HexToByte
[ulist]converts a two-character hex string into a single byte value.[/ulist]
HexToChar
[ulist]converts a two-character hex string into a single char value.[/ulist]
IntToByte
[ulist]converts an integer string into a single byte value.[/ulist]

FlashSettings and NetSettings:
described here http://code.tinyclr.com/project/413/saving-application-settings-to-flash/

NTPClient:
GetNTPTime
[ulist]retrieves current date-time from an NTP server.[/ulist]
extracted from @ Nicolas3’s excellent NetConfig code at http://code.tinyclr.com/project/308/netconfig-wiz5100-http-configuration-framework/

Release Notes:
[Version 1.0 - 01/10/2012]

  • Uses Panda II Firmware version 4.1.8.0

#2

Thanks for this. It seems to be working so far (I have only been playing with my fez connect board for about 45 minutes now and I can say this…

It can get on my network using DHCP,
It corrected my RealTimeClock using NTP and a good server,
and that your code worked, first time, with no compile errors!!!

Thanks for putting this together!


#3

Thank you @ XenoPuTtSs, and welcome to the community!

Please let me know if you find any bugs or have any suggestions for improvement.