libeasymcp2221 2.0.3
Public Attributes | List of all members
mcp2221_smbus Struct Reference

Caller-owned SMBus helper context. More...

#include <mcp2221_smbus.h>

Public Attributes

mcp2221_tmcp
 MCP2221 device handle used for SMBus transfers. More...
 
int owns_mcp
 Ownership flag for mcp. More...
 

Detailed Description

Caller-owned SMBus helper context.

Initialize the context with mcp2221_smbus_init() and release it with mcp2221_smbus_close().

When initialized with an existing MCP2221 handle, the context borrows that handle. When mcp2221_smbus_init() opens the device itself, the context owns the acquired reference and mcp2221_smbus_close() releases it.

Definition at line 35 of file mcp2221_smbus.h.

Member Data Documentation

◆ mcp

mcp2221_t* mcp2221_smbus::mcp

MCP2221 device handle used for SMBus transfers.

After successful initialization this points to the active MCP2221 handle. When mcp2221_smbus_init() receives a non-NULL existing_mcp, this is the borrowed handle supplied by the caller. Otherwise it is the handle opened by mcp2221_smbus_init().

The member is set to NULL before initialization is attempted and by mcp2221_smbus_close().

Note
Ownership of this handle is described by owns_mcp.

Definition at line 49 of file mcp2221_smbus.h.

◆ owns_mcp

int mcp2221_smbus::owns_mcp

Ownership flag for mcp.

A value of 0 means that mcp is borrowed from the caller and must not be closed by mcp2221_smbus_close(). A nonzero value means that the SMBus context acquired the handle itself and mcp2221_smbus_close() releases that reference.

This flag is maintained by mcp2221_smbus_init() and mcp2221_smbus_close(); applications should not modify it directly.

Definition at line 62 of file mcp2221_smbus.h.


The documentation for this struct was generated from the following file: