I'm using the Teensy 2.0 (atmega32u4) and decided to switch from Arduino IDE with Wiring to pure C. I think it's much more useful to master programming microcontrollers on that level. Wiring seems to be quite limited at some point.
It was really easy to use some basic libraries such as avr/io, or util/delay and write simple programs like "arduino hello world".
My problem comes with more complex tasks such as acting as usb mouse. On http://pjrc.com are references just to use with arduino ide/wiring. I couldn't find anything useful on google. Is there any good reference for pure C programming tennsy/arduino and/or using libraries such as "usb_mouse.h" (from pjrc.com) with pure C?
EDIT 1
Let me add some details (based of @st2000 answer).. Yes, Tennsy (and Arduino) are microcontrollers, not microprocessors. Programming avr chips in pure C doesn't require so much work as programming microprocessors. This is the simplest avr C program I could come with (typical blinky):
#include <avr/io.h>
#include <util/delay.h>
int main(void) {
(CLKPR = 0x80, CLKPR = 0x00);
DDRD |= (1<<6);
PORTD &= ~(1<<6);
int sviti = 0;
while (1) {
if (sviti)
PORTD |= (1<<6);
else
PORTD &= ~(1<<6);
sviti ^= 1;
_delay_ms(40000);
}
}
As you can see (@st2000), there are no dozens of setting up registers. It does not require any expensive equipment to upload resultant .HEX file - for teensy the only thing you need is a USB cable.
If you want a concrete example, I want to use this library with pure C, but it's obviously meant for wiring and arduino IDE primary. So how to use this library with pure C? And back to my main question, how to generally use libraries of this kind with pure C avr programming?
make
at the command line. With one caveat: allPROGMEM
arrays should be madeconst
in order to be compatible with recent releases of gcc. You can of course tune the Makefile to your taste.