Initial commit of files
This commit is contained in:
101
src/libPIC/analog.h
Normal file
101
src/libPIC/analog.h
Normal file
@ -0,0 +1,101 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (C) 2008
|
||||
* ProbeStar Telematics, LLC
|
||||
* All Rights Reserved. Proprietary and Confidential.
|
||||
*============================================================================
|
||||
* Generic A/D Chip Interface
|
||||
*----------------------------------------------------------------------------
|
||||
* PIC 10-bit A/D
|
||||
* Maxim 186, 188, 355
|
||||
* Microchip MCP320X, MCP3301
|
||||
*****************************************************************************/
|
||||
|
||||
/* prevent multiple inclusions */
|
||||
#ifndef _ANALOG_H_
|
||||
#define _ANALOG_H_
|
||||
|
||||
/*****************************************************************************
|
||||
* includes
|
||||
*****************************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
#include "types.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* defines
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* macros
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef ANALOG_MAX186
|
||||
#define ANALOG_MODULE
|
||||
#define AnalogInit() AdMax186Init()
|
||||
#define AnalogRead(C) AdMax186Read(C)
|
||||
#endif
|
||||
|
||||
#ifdef ANALOG_MCP320X
|
||||
#define ANALOG_MODULE
|
||||
#define AnalogInit() AdMcp320XInit()
|
||||
#define AnalogRead(C) AdMcp320XRead(C)
|
||||
#endif
|
||||
|
||||
#ifdef ANALOG_MCP3301
|
||||
#define ANALOG_MODULE
|
||||
#define AnalogInit() AdMcp3301Init()
|
||||
#define AnalogRead(C) AdMcp3301Read()
|
||||
#endif
|
||||
|
||||
#ifdef ADMUX_MAX355
|
||||
#define AnalogMux(C) AdMax355Mux(C)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* structs & typedefs
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* global constants
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* global variables
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* C function prototypes
|
||||
*****************************************************************************/
|
||||
/* export C functions to C++ */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Internal Analog
|
||||
extern void AdInit( void );
|
||||
extern WORD AdRead( BYTE byCh );
|
||||
extern void AdWrite( BYTE byCh, WORD wData );
|
||||
|
||||
// Analog Drivers
|
||||
#ifdef ANALOG_MAX186
|
||||
extern void AdMax186Init(void);
|
||||
extern WORD AdMax186Read( BYTE byChan );
|
||||
#endif
|
||||
#ifdef ANALOG_MCP320X
|
||||
extern void AdMcp320XInit( void );
|
||||
extern WORD AdMcp320XRead( BYTE byChan );
|
||||
#endif
|
||||
#ifdef ANALOG_MCP3301
|
||||
extern void AdMcp3301Init( void );
|
||||
extern short AdMcp3301Read( void );
|
||||
#endif
|
||||
|
||||
// Analog Multiplexors
|
||||
#ifdef ADMUX_MAX355
|
||||
extern void AdMax355Mux( BYTE byChan );
|
||||
#endif
|
||||
|
||||
#ifdef __cpluscplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in New Issue
Block a user