Coding the Compass

Dear,

Has anyone written the Monkey C code for a compass display function with the ability to record the heading direction (azimuth)?

Equivalent to the Garmin ABC app?