ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcbI2C Class Reference

#include <ngcbI2C.hpp>

Inheritance diagram for ngcbI2C:
ngcbI2C_IO

Public Member Functions

 ngcbI2C ()
 
 ngcbI2C (int cnt)
 
 ngcbI2C (int scl, int sda)
 
 ngcbI2C (int scl, int sda, int cnt)
 
 ngcbI2C (int scl, int sda, int sclIn, int sdaIn, int ackIn, int cnt)
 
virtual ~ngcbI2C ()
 Destructor.
 
char * ErrMsg ()
 Return error-message buffer.
 
void AckOn ()
 Enable acknowledge handling.
 
void AckOff ()
 Disable acknowledge handling.
 
void SCL_IN (int bit)
 Define clock-line bit fot read (clock-stretching)
 
void SDA_IN (int bit)
 Define data-line bit for read (by default ack-line is the same)
 
void ACK_IN (int bit)
 Define ack-line bit.
 
void SDA_DIR_SWITCH (int bit)
 Define SDA direction switch bit.
 
void SCL_DIR_SWITCH (int bit)
 Define SCL direction switch bit.
 
void ClkStretching (int rx, int tx)
 Set clock-stretching capabilities.
 
void ClkStretchCnt (int cnt)
 Set counter for clock-stretching.
 
int ClkStretchCnt ()
 Return clock-stretching counter.
 
int Write (int addr, const char *byte, int n)
 Standard 7-bit write operation.
 
int Write10 (int addr, const char *byte, int n)
 10-bit write operation
 
int Read (int addr, char *byte, int n)
 Standard 7-bit read operation.
 
int Read10 (int addr, char *byte, int n)
 10-bit read operation
 
int LastState ()
 Return last state of SDA and SCL.
 

Protected Member Functions

virtual int OutCB (int d, int *resultCode, char *erms)
 Output call-back (1 word)
 
virtual int InCB (int *d, int *resultCode, char *erms)
 Input call-back (1 word)
 

Detailed Description

Serial I2C register class

Constructor & Destructor Documentation

◆ ngcbI2C() [1/5]

ngcbI2C::ngcbI2C ( )
inline

Constructor method. This sets the clock-line to bit 0 and the data-line to bit 1. Clock-stretching is disabled by default.

◆ ngcbI2C() [2/5]

ngcbI2C::ngcbI2C ( int cnt)
inlineexplicit

Constructor method specifying just the polling counter for clock-stretching. The clock-line is on bit 0 and the data-line is on bit 1.

◆ ngcbI2C() [3/5]

ngcbI2C::ngcbI2C ( int scl,
int sda )
inline

Constructor method specifying clock-line (scl) and data-line (sda). Clock-stretching is disabled by default.

◆ ngcbI2C() [4/5]

ngcbI2C::ngcbI2C ( int scl,
int sda,
int cnt )
inline

Constructor method specifying clock-line (scl), data-line (sda) and the polling counter for clock-stretching. If the polling counter is set to zero (default), then clock-stretching is disabled in all cases for both read- and write-operations as well as for receiving the acknowledge bit. However the acknowledge bit is still considered unless explicitely ignored via the AckOff() function.

◆ ngcbI2C() [5/5]

ngcbI2C::ngcbI2C ( int scl,
int sda,
int sclIn,
int sdaIn,
int ackIn,
int cnt )
inline

Constructor method specifying all signal lines and the polling counter.

◆ ~ngcbI2C()

virtual ngcbI2C::~ngcbI2C ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ ACK_IN()

void ngcbI2C::ACK_IN ( int bit)
inline

Define ack-line bit.

◆ AckOff()

void ngcbI2C::AckOff ( )
inline

Disable acknowledge handling.

◆ AckOn()

void ngcbI2C::AckOn ( )
inline

Enable acknowledge handling.

◆ ClkStretchCnt() [1/2]

int ngcbI2C::ClkStretchCnt ( )
inline

Return clock-stretching counter.

◆ ClkStretchCnt() [2/2]

void ngcbI2C::ClkStretchCnt ( int cnt)
inline

Set counter for clock-stretching.

◆ ClkStretching()

void ngcbI2C::ClkStretching ( int rx,
int tx )
inline

Set clock-stretching capabilities.

◆ ErrMsg()

char * ngcbI2C::ErrMsg ( )
inline

Return error-message buffer.

◆ InCB()

virtual int ngcbI2C::InCB ( int * d,
int * resultCode,
char * erms )
inlineprotectedvirtual

Input call-back (1 word)

Reimplemented in ngcbI2C_IO.

◆ LastState()

int ngcbI2C::LastState ( )
inline

Return last state of SDA and SCL.

◆ OutCB()

virtual int ngcbI2C::OutCB ( int d,
int * resultCode,
char * erms )
inlineprotectedvirtual

Output call-back (1 word)

Reimplemented in ngcbI2C_IO.

◆ Read()

int ngcbI2C::Read ( int addr,
char * byte,
int n )
inline

Standard 7-bit read operation.

◆ Read10()

int ngcbI2C::Read10 ( int addr,
char * byte,
int n )
inline

10-bit read operation

◆ SCL_DIR_SWITCH()

void ngcbI2C::SCL_DIR_SWITCH ( int bit)
inline

Define SCL direction switch bit.

◆ SCL_IN()

void ngcbI2C::SCL_IN ( int bit)
inline

Define clock-line bit fot read (clock-stretching)

◆ SDA_DIR_SWITCH()

void ngcbI2C::SDA_DIR_SWITCH ( int bit)
inline

Define SDA direction switch bit.

◆ SDA_IN()

void ngcbI2C::SDA_IN ( int bit)
inline

Define data-line bit for read (by default ack-line is the same)

◆ Write()

int ngcbI2C::Write ( int addr,
const char * byte,
int n )
inline

Standard 7-bit write operation.

◆ Write10()

int ngcbI2C::Write10 ( int addr,
const char * byte,
int n )
inline

10-bit write operation


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