+ def MCPcanstat(self):
+ """Get the CAN Status."""
+ return self.peek8(0x0E);
+ def MCPreqstatNormal(self):
+ """Set the CAN state."""
+ state=0x0;
+ self.MCPbitmodify(0x0F,0xE0,(state<<5));
+ def MCPreqstatSleep(self):
+ """Set the CAN state."""
+ state=0x1;
+ self.MCPbitmodify(0x0F,0xE0,(state<<5));
+ def MCPreqstatLoopback(self):
+ """Set the CAN state."""
+ state=0x2;
+ self.MCPbitmodify(0x0F,0xE0,(state<<5));
+ def MCPreqstatListenOnly(self):
+ """Set the CAN state."""
+ state=0x3;
+ self.MCPbitmodify(0x0F,0xE0,(state<<5));
+ def MCPreqstatConfiguration(self):
+ """Set the CAN state."""
+ state=0x4;
+ self.MCPbitmodify(0x0F,0xE0,(state<<5));
+
+ def MCPcanstatstr(self):
+ """Read the present status as a string."""
+ status=self.MCPcanstat();
+ opmod=(status&0xE0)>>5;
+ return self.MCPMODES[opmod];