Skip to content

A collection of C inline functions and macros for programming the Arduino

License

Notifications You must be signed in to change notification settings

jeffrson/oniudra-headers

 
 

Repository files navigation

arduino-headers

About

This is a collection of inline functions and macros I use for programming my Arduino in pure old C. It enables me to write simply

pin12_mode_input();

instead of the more cryptic

DDRB &= ~(_BV(4));

and since GCC is clever there is absolutely no overhead in doing this.

My Arduino has an ATmega328P microprocessor running at 16MHz, and unfortunately this is all the headers support right now. If somebody wants to lend me an Arduino with another chip or clock speed I'd be happy to change this.

Usage

Here is a simple C program, which just blinks the diode connected to pin 13.

#include <util/delay.h>
#include <arduino/pins.h>

int main()
{
        pin13_mode_output();

        while (1) {
                pin13_high();
                _delay_ms(100.0);
                pin13_low();
                _delay_ms(900.0);
        }

        return 0;
}

See the doorduino code for a larger example. There you can also find a Makefile for compiling and uploading Arduino programs.

License

arduino-headers is free software. It is distributed under the terms of the GNU General Public License

Contact

Please send bug reports, patches, feature requests, praise and general gossip to me, Emil Renner Berthing esmil@mailme.dk.

About

A collection of C inline functions and macros for programming the Arduino

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.5%
  • C 3.5%