ZMOD4510 Ultra-Low Power Ozone Firmware Documentation |

Files | Functions | Data Structures | Enumerations
ESCom Board API
Hardware Abstraction Layer API » ComBoard HAL

## Files
file | escom.h
| ESCom board type and function declarations.

## Functions
int | ESCom_Find (ESComInterface_t *boards, int *count)
int | ESCom_Connect (ESComInterface_t *board)
int | ESCom_Disconnect (ESComInterface_t *board)
int | ESCom_SetPower (ESComInterface_t *board, bool on)
int | ESCom_I2CWrite (ESComInterface_t *board, uint8_t slAddr, uint8_t *wData1, int wSize1, uint8_t *wData2, int wSize2)
int | ESCom_I2CRead (ESComInterface_t *board, uint8_t slAddr, uint8_t *wData, int wSize, uint8_t *rData, int rSize)
int | ESCom_GetSensorVoltage (ESComInterface_t *board, float *voltage)
char const * | ESCom_GetErrorString (int error, int scope, char *buf, int bufLen)

## Data Structures
struct | ESComInterface_t

## Enumerations
enum | ESComErrorScope_t { iesLibUSB = 0x11, iesI2C = 0x12, iesCommand = 0x14 }
enum | ESComMode_t { emUSB, emEVK }

## Detailed Description

## Data Structure Documentation

## ◆ ESComInterface_t

struct ESComInterface_t

Data structure containing ESCom board information

### Data Fields
libusb_device * | device
libusb_device_handle * | handle
uint8_t | outEP
uint8_t | inEP
wchar_t | serial [33]

## Enumeration Type Documentation

## ◆ ESComErrorScope_t

enum ESComErrorScope_t

ESCom error scopes

These codes identify the component that generated an error code

## Function Documentation

## ◆ ESCom_Connect()

int ESCom_Connect | ( | ESComInterface_t * | board | ) |

Connect ESCom board

This function tries to connect the ESCom board identified by `board` and allocates the required resources.

Parameters

  [in] | board | Pointer to an ::EScomInterface_t instance obtained through ESCom_Find()

Returns
  0 on success or error code on failure

## ◆ ESCom_Disconnect()

int ESCom_Disconnect | ( | ESComInterface_t * | board | ) |

Disconnect ESCom board and free associated resources

Parameters

  [in] | board | Pointer to an ::EScomInterface_t instance

Returns
  0 on success or error code on failure

## ◆ ESCom_Find()

int ESCom_Find | ( | ESComInterface_t * | boards,
|  | int * | count
| ) |  |

Enumerate ESCom boards connected to PC

Scan available USB interfaces and save those with matching VID/PID in the `boards` buffer. Value pointed to by `count` serves as input and output. As input, `count` specifies the size maximum number of boards to be stored in `boards`. The buffer must provide sufficient space. Before return, this function stores the number of detected EScom boards in count.

Parameters

  [in] | boards | Pointer to ESComInterface_t objects
  [in,out] | count | Maximum number of boards to be stored in `board` [in], actual number of boards stored in `board` [out]

Returns
  0 on success or error code on failure

## ◆ ESCom_GetErrorString()

char const* ESCom_GetErrorString | ( | int | error,
|  | int | scope,
|  | char * | buf,
|  | int | bufLen
| ) |  |

Generate a descriptive error message

Parameters

  [in] | error | Error code
  [in] | scope | Error scope

Returns
  Error string

## ◆ ESCom_GetSensorVoltage()

int ESCom_GetSensorVoltage | ( | ESComInterface_t * | board,
|  | float * | voltage
| ) |  |

Read out the measured sensor voltage

Parameters

  [in] | board | Pointer to an ::ESComInsteface_t instance
  [out] | voltage | voltage value measured by ESCom board

## ◆ ESCom_I2CRead()

int ESCom_I2CRead | ( | ESComInterface_t * | board,
|  | uint8_t | slAddr,
|  | uint8_t * | wData,
|  | int | wSize,
|  | uint8_t * | rData,
|  | int | rSize
| ) |  |

This is the ESCom implementation of HAL_t::i2cRead

## ◆ ESCom_I2CWrite()

int ESCom_I2CWrite | ( | ESComInterface_t * | board,
|  | uint8_t | slAddr,
|  | uint8_t * | wData1,
|  | int | wSize1,
|  | uint8_t * | wData2,
|  | int | wSize2
| ) |  |

This is the ESCom implementation of HAL_t::i2cWrite

## ◆ ESCom_SetPower()

int ESCom_SetPower | ( | ESComInterface_t * | board,
|  | bool | on
| ) |  |

Switch on or off the internal sensor supply voltage

Parameters

  [in] | board | Pointer to an ::ESComInsteface_t instance obtained
  [in] | on | Boolean indicating whether the sensor supply voltage shall be switched on

Returns
  0 on success or error code otherwise