Skip to content

A Few More Wrappers for the W5500 Code

December 6, 2014

One to set an 8 bit value in a w5500 socket register, one each to read and write a 16 bit value

void wizSetCtl8(unsigned int ctlreg, unsigned char val){//write to a socket 0 control register
	wizWrite(ctlreg, WIZNET_WRITE_S0R,&val,1);
}
unsigned int wizGetCtl16(unsigned int ctlregaddr){
  union WReg regval; //spot to hold the register contents
  wizRead(ctlregaddr,WIZNET_READ_S0R,regval.c,2);
  return regval.i;
}
void wizSetCtl16(unsigned int ctlregaddr, unsigned int ctlregvalue){
  union WReg regval; //spot to hold the register contents
  regval.i=ctlregvalue;
  wizWrite(ctlregaddr,WIZNET_WRITE_S0R,regval.c,2);
}

I doubt if anyone other than me will use this code but I will be playing with it for a while so it’s worth it to round off some of the sharp edges.

Advertisements

From → web server

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: