CANoodler is an open-source CAN interface board.
See https://github.com/newaetech/CANoodler for full source.