AtomLED.c
#include
#include
int16_t ledPin = 13;
void avr_blink(void);
static uint64_t __global_clock = 0;
static const uint32_t __coverage_len = 1;
static uint32_t __coverage[1] = {0};
static uint32_t __coverage_index = 0;
struct { /* state */
struct { /* AtomLED */
bool on;
} AtomLED;
} state =
{ /* state */
{ /* AtomLED */
/* on */ true
}
};
/* AtomLED.blinkOn */
static void __r0() {
bool __0 = true;
bool __1 = state.AtomLED.on;
bool __2 = ! __1;
if (__0) {
avr_blink();
__coverage[0] = __coverage[0] | (1 << 0);
}
state.AtomLED.on = __2;
}
/* AtomLED.blinkOff */
static void __r1() {
bool __0 = true;
bool __1 = state.AtomLED.on;
bool __2 = ! __1;
if (__0) {
avr_blink();
__coverage[0] = __coverage[0] | (1 << 1);
}
state.AtomLED.on = __2;
}
static void __assertion_checks() {
}
void AtomLED() {
{
static uint16_t __scheduling_clock = 0;
if (__scheduling_clock == 0) {
__assertion_checks(); __r0(); /* AtomLED.blinkOn */
__scheduling_clock = 39999;
}
else {
__scheduling_clock = __scheduling_clock - 1;
}
}
{
static uint16_t __scheduling_clock = 5000;
if (__scheduling_clock == 0) {
__assertion_checks(); __r1(); /* AtomLED.blinkOff */
__scheduling_clock = 39999;
}
else {
__scheduling_clock = __scheduling_clock - 1;
}
}
__global_clock = __global_clock + 1;
}
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
}
void avr_blink() { digitalWrite(ledPin, state.AtomLED.on); } // set the LED off
void loop() {
AtomLED();
}
Like this:
Like Loading...
May 31, 2010 at 11:03 pm |
[...] AtomLED.c (auto-generated from AtomLED.hs—included for the curious). Posted by Lee Pike Filed in Embedded Software, Haskell Leave a Comment » [...]
October 3, 2010 at 5:29 am |
Is it possible to use a timer on the AVR instead?
October 3, 2010 at 10:49 am |
Yes, Thomas. That was to be discussed in my next post, which I have yet to get to. :-/ But the short answer is, when using Atom, use the action and call functions to call external code. The scons script will automatically add the correct headers.