forked from gary/BCU
2
0
Fork 0
BCU/library/drv_peripheral/drv_mcp3208.h

38 lines
643 B
C

#ifndef DRV_MCP3208_H_
#define DRV_MCP3208_H_
#include <stdint.h>
#include "drv_spi.h"
#define ADCIC_VREF 3250
#define ADCIC_RESULO 4096
#define MSP_CH0 0x18
#define MSP_CH1 0x19
#define MSP_CH2 0x1A
#define MSP_CH3 0x1B
#define MSP_CH4 0x1C
#define MSP_CH5 0x1D
#define MSP_CH6 0x1E
#define MSP_CH7 0x1F
typedef struct
{
uint8_t cs;
SpiDev spi;
}MCP3208Item;
#define MCP3208_STATIC_INIT(_name, _spi, _cs) \
MCP3208Item _name = \
{ \
.cs = _cs, \
.spi = _spi, \
}
void drv_mcp3208_init(MCP3208Item *item);
bool drv_mcp3208_read_reg(MCP3208Item *item, uint8_t reg, uint16_t *value);
#endif