
/* Generated by fzmparser version 1.14 --- DO NOT EDIT! */

/* Uses following resources: */
/* [10 events, 4+0 states, 2 inputs, 3 outputs, 1 match regs, 0 capture regs] */

#include "sct_fsm.h"


void sct_fsm_init (void)
{

/* MATCH/CAPTURE registers */
LPC_SCT->REGMODE_L = 0x0000;         /* L: 1x MATCH, 0x CAPTURE, 15 unused */
LPC_SCT->REGMODE_H = 0x0000;             /* H: 0x MATCH, 0x CAPTURE, 16 unused */
LPC_SCT->MATCH_L[0] = speed;
LPC_SCT->MATCHREL_L[0] = speed;

/* OUTPUT registers */
LPC_SCT->OUT[4].SET = 0x00000380;        /* LED_BLUE */
LPC_SCT->OUT[4].CLR = 0x00000024;
LPC_SCT->OUT[2].SET = 0x00000218;        /* LED_GREEN */
LPC_SCT->OUT[2].CLR = 0x00000042;
LPC_SCT->OUT[3].SET = 0x00000260;        /* LED_RED */
LPC_SCT->OUT[3].CLR = 0x00000088;
  /* Unused outputs must not be affected by any event */
LPC_SCT->OUT[0].SET = 0;
LPC_SCT->OUT[0].CLR = 0;
LPC_SCT->OUT[1].SET = 0;
LPC_SCT->OUT[1].CLR = 0;
LPC_SCT->OUT[5].SET = 0;
LPC_SCT->OUT[5].CLR = 0;
LPC_SCT->OUT[6].SET = 0;
LPC_SCT->OUT[6].CLR = 0;
LPC_SCT->OUT[7].SET = 0;
LPC_SCT->OUT[7].CLR = 0;
LPC_SCT->OUT[8].SET = 0;
LPC_SCT->OUT[8].CLR = 0;
LPC_SCT->OUT[9].SET = 0;
LPC_SCT->OUT[9].CLR = 0;
LPC_SCT->OUT[10].SET = 0;
LPC_SCT->OUT[10].CLR = 0;
LPC_SCT->OUT[11].SET = 0;
LPC_SCT->OUT[11].CLR = 0;
LPC_SCT->OUT[12].SET = 0;
LPC_SCT->OUT[12].CLR = 0;
LPC_SCT->OUT[13].SET = 0;
LPC_SCT->OUT[13].CLR = 0;
LPC_SCT->OUT[14].SET = 0;
LPC_SCT->OUT[14].CLR = 0;
LPC_SCT->OUT[15].SET = 0;
LPC_SCT->OUT[15].CLR = 0;
LPC_SCT->OUTPUT = (LPC_SCT->OUTPUT & ~0x0000001C) | 0x00000000;

/* Conflict resolution register */

/* EVENT registers */
LPC_SCT->EVENT[9].CTRL = 0x00006040;     /* L: --> state L_ENTRY */
LPC_SCT->EVENT[9].STATE = 0xFFFFFFFF;
LPC_SCT->EVENT[0].CTRL = 0x00001000;     /* L: */
LPC_SCT->EVENT[0].STATE = 0xFFFFFFFF;
LPC_SCT->EVENT[1].CTRL = 0x0000F000;     /* L: --> state LED_GREEN */
LPC_SCT->EVENT[1].STATE = 0x00000001;
LPC_SCT->EVENT[2].CTRL = 0x0001FC00;     /* L: --> state LED_BLUE */
LPC_SCT->EVENT[2].STATE = 0x00000001;
LPC_SCT->EVENT[3].CTRL = 0x00017000;     /* L: --> state LED_RED */
LPC_SCT->EVENT[3].STATE = 0x00000002;
LPC_SCT->EVENT[4].CTRL = 0x00007C00;     /* L: --> state L_ENTRY */
LPC_SCT->EVENT[4].STATE = 0x00000002;
LPC_SCT->EVENT[5].CTRL = 0x0001F000;     /* L: --> state LED_BLUE */
LPC_SCT->EVENT[5].STATE = 0x00000004;
LPC_SCT->EVENT[6].CTRL = 0x0000FC00;     /* L: --> state LED_GREEN */
LPC_SCT->EVENT[6].STATE = 0x00000004;
LPC_SCT->EVENT[7].CTRL = 0x00017C00;     /* L: --> state LED_RED */
LPC_SCT->EVENT[7].STATE = 0x00000008;
LPC_SCT->EVENT[8].CTRL = 0x00007000;     /* L: --> state L_ENTRY */
LPC_SCT->EVENT[8].STATE = 0x00000008;
  /* Unused events must not have any effect */
LPC_SCT->EVENT[10].STATE = 0;
LPC_SCT->EVENT[11].STATE = 0;
LPC_SCT->EVENT[12].STATE = 0;
LPC_SCT->EVENT[13].STATE = 0;
LPC_SCT->EVENT[14].STATE = 0;
LPC_SCT->EVENT[15].STATE = 0;

/* STATE registers */
LPC_SCT->STATE_L = 0;
LPC_SCT->STATE_H = 0; /* implicit value */

/* state names assignment: */
  /* State L 0: L_ENTRY */
  /* State L 1: LED_GREEN */
  /* State L 2: LED_RED */
  /* State L 3: LED_BLUE */

/* CORE registers */
LPC_SCT->START_L = 0x0000;
LPC_SCT->STOP_L =  0x0000;
LPC_SCT->HALT_L =  0x0000;
LPC_SCT->LIMIT_L = 0x0001;
LPC_SCT->START_H = 0x0000;
LPC_SCT->STOP_H =  0x0000;
LPC_SCT->HALT_H =  0x0000;
LPC_SCT->LIMIT_H = 0x0000;
LPC_SCT->EVEN =    0x00000000;
LPC_SCT->DMA0REQUEST = 0x00000000;
LPC_SCT->DMA1REQUEST = 0x00000000;

}
