How can I make libraries for Pinguino?

From Pinguino
Jump to: navigation, search

If you want to write a library for Pinguino here is some useful information :

Where to put the files ?

  • for 8-bit : p8/pinguino
  • for 32-bit : p32/include/pinguino
  • core directory is for files that manage processor internal resources (SPI, UART, USB, PWM, etc ...).
  • libraries directory is for all other external resources (SD, bluetooth, servo, etc ...).

Where to put the keywords file ?

  • for 8-bit : p8/lib (or p8/pdl for x.3 > r313 22 Mar 2012)
    file must have .pdl extension
  • for 32-bit : p32/lib (or p32/pdl for x.3 > r313 22 Mar 2012)
    file must be with .pdl32 extension

the format used in the keywords files is :
[name used under Pinguino IDE][SPACE][name used in the library]#include[SPACE]<[name of your library]>#define MACRONAME
For example :-

digitalWrite digitalwrite#include <digitalw.c>


Serial2.begin Serial2_begin#include <serial.c>#define SERIALUSEPORT2

Can I use a Pinguino function name in my own library ?

No as you can't write your own library from within the Pinguino IDE.
The Pinguino IDE uses C++ syntax but Pinguino compilers only understand C.
For example, you can't use Serial.begin as the real name is serialinit.