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();
}

3 Responses to “AtomLED.c”

  1. Twinkle Twinkle Little Haskell « A Critical Systems Blog Says:

    [...] AtomLED.c (auto-generated from AtomLED.hs—included for the curious). Posted by Lee Pike Filed in Embedded Software, Haskell Leave a Comment » [...]

  2. Thomas Says:

    Is it possible to use a timer on the AVR instead?

    • Lee Pike Says:

      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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: