LibDriver PCF8591
Loading...
Searching...
No Matches
driver_pcf8591.h File Reference

driver pcf8591 header file More...

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

Go to the source code of this file.

Data Structures

struct  pcf8591_handle_s
 pcf8591 handle structure definition More...
struct  pcf8591_info_s
 pcf8591 information structure definition More...

Macros

#define DRIVER_PCF8591_LINK_INIT(HANDLE, STRUCTURE)
 initialize pcf8591_handle_t structure
#define DRIVER_PCF8591_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_PCF8591_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_PCF8591_LINK_IIC_READ_COMMAND(HANDLE, FUC)
 link iic_read_cmd function
#define DRIVER_PCF8591_LINK_IIC_WRITE_COMMAND(HANDLE, FUC)
 link iic_write_cmd function
#define DRIVER_PCF8591_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_PCF8591_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct pcf8591_handle_s pcf8591_handle_t
 pcf8591 handle structure definition
typedef struct pcf8591_info_s pcf8591_info_t
 pcf8591 information structure definition

Enumerations

enum  pcf8591_address_t {
  PCF8591_ADDRESS_A000 = 0 , PCF8591_ADDRESS_A001 = 1 , PCF8591_ADDRESS_A010 = 2 , PCF8591_ADDRESS_A011 = 3 ,
  PCF8591_ADDRESS_A100 = 4 , PCF8591_ADDRESS_A101 = 5 , PCF8591_ADDRESS_A110 = 6 , PCF8591_ADDRESS_A111 = 7
}
 pcf8591 address enumeration definition More...
enum  pcf8591_bool_t { PCF8591_BOOL_FALSE = 0x00 , PCF8591_BOOL_TRUE = 0x01 }
 pcf8591 bool enumeration definition More...
enum  pcf8591_channel_t { PCF8591_CHANNEL_0 = 0x00 , PCF8591_CHANNEL_1 = 0x01 , PCF8591_CHANNEL_2 = 0x02 , PCF8591_CHANNEL_3 = 0x03 }
 pcf8591 channel definition More...
enum  pcf8591_mode_t { PCF8591_MODE_AIN0123_GND = 0x00 , PCF8591_MODE_AIN012_AIN3 = 0x01 , PCF8591_MODE_AIN0_GND_AND_AIN1_GND_AND_AIN2_AIN3 = 0x02 , PCF8591_MODE_AIN0_AIN1_AND_ANI2_AIN3 = 0x03 }
 pcf8591 mode definition More...

Functions

uint8_t pcf8591_info (pcf8591_info_t *info)
 get chip's information
uint8_t pcf8591_set_addr_pin (pcf8591_handle_t *handle, pcf8591_address_t addr_pin)
 set the address pin
uint8_t pcf8591_get_addr_pin (pcf8591_handle_t *handle, pcf8591_address_t *addr_pin)
 get the address pin
uint8_t pcf8591_init (pcf8591_handle_t *handle)
 initialize the chip
uint8_t pcf8591_deinit (pcf8591_handle_t *handle)
 close the chip
uint8_t pcf8591_read (pcf8591_handle_t *handle, int16_t *raw, float *adc)
 read data from the chip
uint8_t pcf8591_multiple_read (pcf8591_handle_t *handle, int16_t *raw, float *adc, uint8_t *len)
 read the multiple channel data from the chip
uint8_t pcf8591_write (pcf8591_handle_t *handle, uint8_t data)
 write to the dac
uint8_t pcf8591_dac_convert_to_register (pcf8591_handle_t *handle, float dac, uint8_t *reg)
 convert a dac value to a register raw data
uint8_t pcf8591_set_reference_voltage (pcf8591_handle_t *handle, float ref_voltage)
 set the adc reference voltage
uint8_t pcf8591_get_reference_voltage (pcf8591_handle_t *handle, float *ref_voltage)
 get the adc reference voltage
uint8_t pcf8591_set_channel (pcf8591_handle_t *handle, pcf8591_channel_t channel)
 set the adc channel
uint8_t pcf8591_get_channel (pcf8591_handle_t *handle, pcf8591_channel_t *channel)
 get the adc channel
uint8_t pcf8591_set_mode (pcf8591_handle_t *handle, pcf8591_mode_t mode)
 set the adc mode
uint8_t pcf8591_get_mode (pcf8591_handle_t *handle, pcf8591_mode_t *mode)
 get the adc mode
uint8_t pcf8591_set_auto_increment (pcf8591_handle_t *handle, pcf8591_bool_t enable)
 set the adc auto increment read mode
uint8_t pcf8591_get_auto_increment (pcf8591_handle_t *handle, pcf8591_bool_t *enable)
 get the adc auto increment read mode
uint8_t pcf8591_set_reg (pcf8591_handle_t *handle, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t pcf8591_get_reg (pcf8591_handle_t *handle, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver pcf8591 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
2.0.0
Author
Shifeng Li
Date
2021-02-18

history

Date Version Author Description
2021/02/18 2.0 Shifeng Li format the code
2020/10/17 1.0 Shifeng Li first upload

Definition in file driver_pcf8591.h.