Issue with Open source for AT91SAM7s

leon_heller:
This program for an LPC2103 uses 1.5k code space and 0.1k of RAM:

/*

** led.c
**
** simple program to test switch input and LED output
*/

#include <targets/LPC210x.h>

void LED_on();
void LED_off();

#define LED_ROW 0x04000000 //P0.26
#define LED_COLUMN 0x00000008 //P0.3
#define SWITCH_PIN 15 // Button 1

void
delay(int d)
{
for(; d; --d);
}

int main(void)
{
int sw_state;

while(1)
{
if (IOPIN & (1<<SWITCH_PIN))
LED_on();
else
LED_off();
}
}

void LED_on()
{
IODIR = 0x00000000;
IODIR |= (LED_ROW | LED_COLUMN);
IOSET = LED_ROW; // row low
IOSET = LED_COLUMN; // column high
}

void LED_off()
{
IODIR = 0x00000000;
IODIR |= (LED_ROW | LED_COLUMN);
IOCLR = LED_ROW; // row low
IOCLR = LED_COLUMN; // column high
}




You are probably including some libraries.



Leon

I set up a new C project to give your code a whirl, only I’m missing LPC210x.h

Could you include that also please.

Thank you