LibDriver HX711
Loading...
Searching...
No Matches
hx711 base driver function

hx711 base driver modules More...

Collaboration diagram for hx711 base driver function:

Data Structures

struct  hx711_handle_s
 hx711 handle structure definition More...
struct  hx711_info_s
 hx711 info structure definition More...

Typedefs

typedef struct hx711_handle_s hx711_handle_t
 hx711 handle structure definition
typedef struct hx711_info_s hx711_info_t
 hx711 info structure definition

Enumerations

enum  hx711_mode_t { HX711_MODE_CHANNEL_A_GAIN_128 = 0x01 , HX711_MODE_CHANNEL_B_GAIN_32 = 0x02 , HX711_MODE_CHANNEL_A_GAIN_64 = 0x03 }
 hx711 mode enumeration definition More...

Functions

uint8_t hx711_info (hx711_info_t *info)
 get chip's information
uint8_t hx711_init (hx711_handle_t *handle)
 initialize the chip
uint8_t hx711_deinit (hx711_handle_t *handle)
 close the chip
uint8_t hx711_set_mode (hx711_handle_t *handle, hx711_mode_t mode)
 set the chip mode
uint8_t hx711_get_mode (hx711_handle_t *handle, hx711_mode_t *mode)
 get the chip mode
uint8_t hx711_read (hx711_handle_t *handle, int32_t *raw, double *voltage_v)
 read the 24 bits raw ad from the chip

Detailed Description

hx711 base driver modules

Typedef Documentation

◆ hx711_handle_t

hx711 handle structure definition

◆ hx711_info_t

typedef struct hx711_info_s hx711_info_t

hx711 info structure definition

Enumeration Type Documentation

◆ hx711_mode_t

hx711 mode enumeration definition

Enumerator
HX711_MODE_CHANNEL_A_GAIN_128 

channel A 128 gain

HX711_MODE_CHANNEL_B_GAIN_32 

channel B 32 gain

HX711_MODE_CHANNEL_A_GAIN_64 

channel A 64 gain

Definition at line 64 of file driver_hx711.h.

Function Documentation

◆ hx711_deinit()

uint8_t hx711_deinit ( hx711_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an hx711 handle structure
Returns
status code
  • 0 success
  • 1 bus or clock deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 277 of file driver_hx711.c.

◆ hx711_get_mode()

uint8_t hx711_get_mode ( hx711_handle_t * handle,
hx711_mode_t * mode )

get the chip mode

Parameters
[in]*handlepointer to an hx711 handle structure
[out]*modepointer to a chip mode
Returns
status code
  • 0 success
  • 1 get mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 351 of file driver_hx711.c.

◆ hx711_info()

uint8_t hx711_info ( hx711_info_t * info)

get chip's information

Parameters
[out]*infopointer to an hx711 info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 431 of file driver_hx711.c.

◆ hx711_init()

uint8_t hx711_init ( hx711_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an hx711 handle structure
Returns
status code
  • 0 success
  • 1 bus or clock initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 183 of file driver_hx711.c.

◆ hx711_read()

uint8_t hx711_read ( hx711_handle_t * handle,
int32_t * raw,
double * voltage_v )

read the 24 bits raw ad from the chip

Parameters
[in]*handlepointer to an hx711 handle structure
[out]*rawpointer to a raw adc buffer
[out]*voltage_vpointer to a converted adc buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 mode error
Note
none

Definition at line 380 of file driver_hx711.c.

◆ hx711_set_mode()

uint8_t hx711_set_mode ( hx711_handle_t * handle,
hx711_mode_t mode )

set the chip mode

Parameters
[in]*handlepointer to an hx711 handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 1 set mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 316 of file driver_hx711.c.