LibDriver BA121
Loading...
Searching...
No Matches
ba121 basic driver function

ba121 basic driver modules More...

Collaboration diagram for ba121 basic driver function:

Data Structures

struct  ba121_handle_s
 ba121 handle structure definition More...
struct  ba121_info_s
 ba121 information structure definition More...

Typedefs

typedef struct ba121_handle_s ba121_handle_t
 ba121 handle structure definition
typedef struct ba121_info_s ba121_info_t
 ba121 information structure definition

Enumerations

enum  ba121_status_t {
  BA121_STATUS_OK = 0x00 , BA121_STATUS_FRAME_ERROR = 0x01 , BA121_STATUS_BUSY = 0x02 , BA121_STATUS_CHECK_ERROR = 0x03 ,
  BA121_STATUS_TEMPERATURE_OUT_OF_RANGE = 0x04
}
 ba121 status enumeration definition More...

Functions

uint8_t ba121_info (ba121_info_t *info)
 get chip's information
uint8_t ba121_init (ba121_handle_t *handle)
 initialize the chip
uint8_t ba121_deinit (ba121_handle_t *handle)
 close the chip
uint8_t ba121_read (ba121_handle_t *handle, uint16_t *conductivity_raw, uint16_t *conductivity_us_cm, uint16_t *temperature_raw, float *temperature)
 read the data
uint8_t ba121_baseline_calibration (ba121_handle_t *handle)
 baseline calibration
uint8_t ba121_set_ntc_resistance (ba121_handle_t *handle, uint32_t ohm)
 set ntc resistance
uint8_t ba121_set_ntc_b (ba121_handle_t *handle, uint16_t value)
 set ntc b
uint8_t ba121_get_last_status (ba121_handle_t *handle, ba121_status_t *status)
 get last status

Detailed Description

ba121 basic driver modules

Typedef Documentation

◆ ba121_handle_t

ba121 handle structure definition

◆ ba121_info_t

typedef struct ba121_info_s ba121_info_t

ba121 information structure definition

Enumeration Type Documentation

◆ ba121_status_t

ba121 status enumeration definition

Enumerator
BA121_STATUS_OK 

ok

BA121_STATUS_FRAME_ERROR 

frame error

BA121_STATUS_BUSY 

busy

BA121_STATUS_CHECK_ERROR 

check error

BA121_STATUS_TEMPERATURE_OUT_OF_RANGE 

temperature out of range

Definition at line 62 of file driver_ba121.h.

Function Documentation

◆ ba121_baseline_calibration()

uint8_t ba121_baseline_calibration ( ba121_handle_t * handle)

baseline calibration

Parameters
[in]*handlepointer to a ba121 handle structure
Returns
status code
  • 0 success
  • 1 baseline calibration failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 frame error
  • 5 response error
Note
none

Definition at line 327 of file driver_ba121.c.

◆ ba121_deinit()

uint8_t ba121_deinit ( ba121_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a ba121 handle structure
Returns
status code
  • 0 success
  • 1 uart deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 222 of file driver_ba121.c.

◆ ba121_get_last_status()

uint8_t ba121_get_last_status ( ba121_handle_t * handle,
ba121_status_t * status )

get last status

Parameters
[in]*handlepointer to a ba121 handle structure
[out]*statuspointer to a status buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 537 of file driver_ba121.c.

◆ ba121_info()

uint8_t ba121_info ( ba121_info_t * info)

get chip's information

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

Definition at line 639 of file driver_ba121.c.

◆ ba121_init()

uint8_t ba121_init ( ba121_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a ba121 handle structure
Returns
status code
  • 0 success
  • 1 uart initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 153 of file driver_ba121.c.

◆ ba121_read()

uint8_t ba121_read ( ba121_handle_t * handle,
uint16_t * conductivity_raw,
uint16_t * conductivity_us_cm,
uint16_t * temperature_raw,
float * temperature )

read the data

Parameters
[in]*handlepointer to a ba121 handle structure
[out]*conductivity_rawpointer to a conductivity raw data buffer
[out]*conductivity_us_cmpointer to a conductivity uS/cm data buffer
[out]*temperature_rawpointer to a temperature raw data buffer
[out]*temperaturepointer to a converted temperature data buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 frame error
Note
none

Definition at line 259 of file driver_ba121.c.

◆ ba121_set_ntc_b()

uint8_t ba121_set_ntc_b ( ba121_handle_t * handle,
uint16_t value )

set ntc b

Parameters
[in]*handlepointer to a ba121 handle structure
[in]valuentc value
Returns
status code
  • 0 success
  • 1 set ntc b failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 frame error
  • 5 response error
Note
none

Definition at line 469 of file driver_ba121.c.

◆ ba121_set_ntc_resistance()

uint8_t ba121_set_ntc_resistance ( ba121_handle_t * handle,
uint32_t ohm )

set ntc resistance

Parameters
[in]*handlepointer to a ba121 handle structure
[in]ohmresistance ohm
Returns
status code
  • 0 success
  • 1 set ntc resistance failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 frame error
  • 5 response error
Note
none

Definition at line 398 of file driver_ba121.c.