/****************************************************************************/
/* Copyright 2014 - 2015 MBARI                                              */
/****************************************************************************/
/* Summary  : ModBus callback routines for Miscellaneous Registers          */
/* Filename : misc.h                                                        */
/* Author   : Robert Herlien (rah)                                          */
/* Project  : OASIS5 Controller                                             */
/* Revision : 1.0                                                           */
/* Created  : 11/02/2015                                                    */
/*                                                                          */
/* MBARI provides this documentation and code "as is", with no warranty,    */
/* express or implied, of its quality or consistency. It is provided without*/
/* support and without obligation on the part of the Monterey Bay Aquarium  */
/* Research Institute to assist in its use, correction, modification, or    */
/* enhancement. This information should not be published or distributed to  */
/* third parties without specific written permission from MBARI.            */
/*                                                                          */
/****************************************************************************/
/* Modification History:                                                    */
/* 2nov2015 rah - created from misc.c in FOCE Medium Voltage Converter      */
/****************************************************************************/

#ifndef MISC_H
#define MISC_H

#include "config.h"
#include "mb.h"

#define SW_REV_HIGH	1
#define SW_REV_LOW	0

#define REG_INPUT_START 1000
#define REG_INPUT_NREGS 4

#define MB_TMOUT_50US   35             /* Default timeout is 1.75 ms    */

typedef enum
    { BLINKY_OFF = 0, BLINKY_ON, BLINKY_DEBUG24, BLINKY_DEBUG, BLINKY_ERROR, BLINKY50 } BlinkyState;

/********** Functions ***************/

void            miscInit(void);
unsigned int	miscRegRead(unsigned int address, ConfigData *configp);
eMBErrorCode	miscRegWrite(unsigned int address, unsigned int val, ConfigData *configp);

void            setBlinkyDebug(BlinkyState state);
BlinkyState     getBlinkyDebug(void);
void            blinkyTask(BOOL gotModbus);

#endif
