// This file has been automatically generated by goFB and should not be edited by hand
// Compiler written by Hammond Pearce and available at github.com/kiwih/goFB

// This file represents the interface of Function Block Manager
#ifndef MANAGER_H_
#define MANAGER_H_

#include "fbtypes.h"

//This is a BFB, so we need an enum type for the state machine
enum Manager_states { STATE_Manager_Start, STATE_Manager_next_val, STATE_Manager_run, STATE_Manager_zero };


union ManagerInputEvents {
	struct {
		UDINT ActualValueChanged;
	} event;
	
};


union ManagerOutputEvents {
	struct {
		UDINT Zero;
		UDINT Tick;
	} event;
	
};


typedef struct {
    //input events
	union ManagerInputEvents inputEvents;

    //output events
	union ManagerOutputEvents outputEvents;

    //input vars
	REAL ActualValue;
    BOOL TicksPerVal;
    
    //output vars
	REAL DesiredValue;
    
	//any internal vars (BFBs only)
    INT Len;
    INT Pos;
    REAL Vals[10];
    INT TickCount;
    
	//any child FBs (CFBs only)
	
	//resource vars
	
	//resources (Devices only)
	
	//state and trigger (BFBs only)
	enum Manager_states _state; //stores current state
	BOOL _trigger; //indicates if a state transition has occured this tick
	
} Manager_t;

//all FBs get a preinit function
int Manager_preinit(Manager_t _SPM *me);

//all FBs get an init function
int Manager_init(Manager_t _SPM *me);

//all FBs get a run function
void Manager_run(Manager_t _SPM *me);



#endif
