Saturday, November 29, 2014

Porting Arduino libraries and pointers

I need to blow off a little steam. What is it with the Arduino library authors and pointers? It's driving me nuts! I just found another author using pointers in really odd places. It was something like this: *((uint32_t *) varName), which basically translates into the unsigned 32 bit int contents of varName and is perfectly legal if varName is a uint32_t pointer (it is not). For some odd reason this works with the Arduino Uno but not with my Chipkit Uno32. I've seen this in parts of the Ethernet library and I think that folks are taking advantage of side effects to get the values they want. Unfortunately I'm not an expert at C++ so I might be wrong.
Anyways, I've fixed the EthernetServer and DHCP library and the ChipKit Uno32 is now getting its IP address from my DHCP server (yea). Now I'll move onto the next issue which is the EthernetClient library. I think I'll start by looking for pointers and see where that leads.
PS: Found another pointer mess and I fixed that one too. I now have the EthernetClient (with DHCP) working. Now I need to get this up onto Git Hub and then add in the MQTT library.

0 Comments:

Post a Comment

<< Home