So you have some CAN devices, and a CAN controller sharing board space with a nice I/O-studded microcontroller, and a basic idea of what you might be looking for on the bus (see my previous topic here: http://rechargecar.com/forums/macchina-and-protocols/can-bus-basics ).
Now you program. Luckily we've adapted a library that simplifies communication between the Atmel microcontroller and the Microchip CAN controller on the Macchina. It's open-source, and we host it on Github. Here are a few ways to view and download the library:
The Github project is located at: https://github.com/rechargecar/mcp2515
If you just want to download the code, you can click here: https://github.com/rechargecar/mcp2515/archive/master.zip
If you're familiar with Git, here's a path to the repository: https://github.com/rechargecar/mcp2515.git
PHILOSOPHY AND SHARING
We encourage feedback and any augmentations or improvements you might see fit to contribute back to the project. So if you want to fork it, make some changes, and submit a pull request ( https://help.github.com/articles/using-pull-requests ), we'll be glad to review the proposed changes and roll it back into the codebase if we think it will be helpful. And you're free to fork it into your own project, too, as long as you keep it open! We're using the LGPL license, so, while the library itself has to remain open, it doesn't force you to open-source your own code that might happen to use the library. We see this as a reasonable balance that allows a good amount of flexibility while still encouraging contribution back into the community.
Along with making projects very accessible and public, Github also makes sharing code snippets really easy, in the form of "Gists". A Gist is essentially a new Git repository, but trivial to create and share. So you could use it to start up a new project, or just show someone the order in which you like initializing all your I/O and data structures before reading the status from your battery charger. You can make new Gists here: https://gist.github.com/
If you want to embed Gists in your forum posts, there is a shorthand way to do that. All you have to do is type [gist:####] where #### is the numeric ID of the Gist you want to embed.
I'll follow this post up with a description of the library and a basic usage example.