Sha256: 251c8708ae3b3fdf95b2628935ed19e8876d555a8dc919ef05c4f4a8cd81c269

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

// #include <stdint.h>

#include "main.h"
#include "BlinkTask.h"
#include "Configure.h"    

//Most OS's frown upon direct memory access. 
//So we'll have to use fake registers during testing.
#ifdef TEST
  #define LOOP 
  #include "stub_io.h"
  #include "stub_interrupt.h"
#else
  #include <avr/interrupt.h>
  #include <avr/io.h>
  #define LOOP while(1)
  //The target will need a main. 
  //Our test runner will provide it's own and call AppMain()
  int main(void)              
  {
    return AppMain();
  }
#endif // TEST

int AppMain(void)
{
  Configure();

  LOOP
  {
    if(BlinkTaskReady==0x01)
    {
      BlinkTaskReady = 0x00;
      BlinkTask();
    }
  }
  return 0;
}

ISR(TIMER0_OVF_vect)
{
  /* toggle every thousand ticks */
  if (tick >= 1000)
  {
    /* signal our periodic task. */
    BlinkTaskReady = 0x01;
    /* reset the tick */
    tick = 0;
  }    
  tick++;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-0.29.1 examples/blinky/src/main.c
ceedling-0.29.0 examples/blinky/src/main.c