home  general  lard  ArdweeNET  MAXX  the QUUB  Gecko  SiiMAN
        api  license
LARD
   

 

LARD is an open-source hardware abstraction layer that implements the Arduino core library functions for LPC processors.

(Actually it's just for the the LPC1227 at present, but I may expand it later)

LARD is an "Arduino-like" abstraction layer, it is primarily designed to ease the task of performing common coding functions on the LPC1227 and to create a familiar environment for Arduino programmers and an easy migration path to the LPC1227 for existing Arduino code.

LARD is not Arduino and there are differences in the code and certainly the tool chain but to give you an example here is a version of the Arduino "blink without delay" program.

#include "LARD.h"

#define LED_PIN 13

void LEDoff (void);
void LEDon (void);

swTimer * led_timer;

void LEDon (void) {
  digitalWrite (LED_PIN, HIGH);
  swTimerAttachCallback (led_timer, LEDoff);
}

void LEDoff (void) {
  digitalWrite (LED_PIN, LOW);
  swTimerAttachCallback (led_timer, LEDon);
}

void setup (void) {

  pinMode(LED_PIN, OUTPUT);

  led_timer = swTimerCreate(1000, SWTIMER_TYPE_ONESHOT, LEDon);
  swTimerStart(led_timer);

}

void loop (void) {

}

Note that there are many similarities with the setup() and loop() functions used as per normal. In this case though the builtin software timers with callback functions have been used to generate the "delays".

C or C++

NOTE: LPCXpresso free version now allows C++ so LARD will be converted when I get time (I have made a start). That will make it almost 100% Arduino compatible.

At present LARD is pure C, why is this?

In the LPC Xpresso environment the free version of the IDE/compiler has a limit of 128k program size which is no big deal in itself but it is also only a C compiler.

If you buy the next version you get 256k of program size and C++ but it costs $256 and at present I don't really want to spend the money. Anyway that raises the cost of entry to using LPCs considerably. As it stands you can start using the Xpresso boards for about €20 so the extra $256 is a huge increase.

This is a bit unfortunate because of a lot of this code would benefit from the data hiding and encapsulation that C++ makes easy.

That said I am trying to incorporate such object-orientated concepts so the end result should be similar.

So for the time being C++ library functions like Serial.begin() have become SerialBegin()

 

   
 

Top of Page

 

  home  general  lard  ArdweeNET  MAXX  the QUUB  Gecko  SiiMAN
        api  license
 

Copyright © 1973-2013 Rob Gray, All rights reserved.
PO Box 450, Gin Gin, QLD, Australia.
www.robgray.com