LibDriver MCP3421
Loading...
Searching...
No Matches
driver_mcp3421.h File Reference

driver mcp3421 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_mcp3421.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mcp3421_handle_s
 mcp3421 handle structure definition More...
struct  mcp3421_info_s
 mcp3421 information structure definition More...

Macros

#define DRIVER_MCP3421_LINK_INIT(HANDLE, STRUCTURE)
 initialize mcp3421_handle_t structure
#define DRIVER_MCP3421_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_MCP3421_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_MCP3421_LINK_IIC_READ_COMMAND(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_MCP3421_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_MCP3421_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_MCP3421_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct mcp3421_handle_s mcp3421_handle_t
 mcp3421 handle structure definition
typedef struct mcp3421_info_s mcp3421_info_t
 mcp3421 information structure definition

Enumerations

enum  mcp3421_bit_t { MCP3421_BIT_12 = 0x00 , MCP3421_BIT_14 = 0x01 , MCP3421_BIT_16 = 0x02 , MCP3421_BIT_18 = 0x03 }
 mcp3421 bit enumeration definition More...
enum  mcp3421_pga_t { MCP3421_PGA_1 = 0x00 , MCP3421_PGA_2 = 0x01 , MCP3421_PGA_4 = 0x02 , MCP3421_PGA_8 = 0x03 }
 mcp3421 pga enumeration definition More...

Functions

uint8_t mcp3421_info (mcp3421_info_t *info)
 get chip's information
uint8_t mcp3421_init (mcp3421_handle_t *handle)
 initialize the chip
uint8_t mcp3421_deinit (mcp3421_handle_t *handle)
 close the chip
uint8_t mcp3421_single_read (mcp3421_handle_t *handle, int32_t *raw, double *v)
 read data from the chip once
uint8_t mcp3421_start_continuous_read (mcp3421_handle_t *handle)
 start the chip reading
uint8_t mcp3421_stop_continuous_read (mcp3421_handle_t *handle)
 stop the chip reading
uint8_t mcp3421_continuous_read (mcp3421_handle_t *handle, int32_t *raw, double *v)
 read data from the chip continuously
uint8_t mcp3421_set_adc_bit (mcp3421_handle_t *handle, mcp3421_bit_t adc_bit)
 set the adc bit
uint8_t mcp3421_get_adc_bit (mcp3421_handle_t *handle, mcp3421_bit_t *adc_bit)
 get the adc bit
uint8_t mcp3421_set_pga (mcp3421_handle_t *handle, mcp3421_pga_t pga)
 set the adc pga
uint8_t mcp3421_get_pga (mcp3421_handle_t *handle, mcp3421_pga_t *pga)
 get the adc pga
uint8_t mcp3421_set_reg (mcp3421_handle_t *handle, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t mcp3421_get_reg (mcp3421_handle_t *handle, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver mcp3421 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2024-05-30

history

Date Version Author Description
2024/05/30 1.0 Shifeng Li first upload

Definition in file driver_mcp3421.h.