You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
#ifndef __I2C_PORT_HEADERS__
|
|
#define __I2C_PORT_HEADERS__
|
|
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <sys/ioctl.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/i2c-dev.h>
|
|
|
|
#undef _LINUX_I2C_DEV_H
|
|
|
|
|
|
#include "../../data/transport/transportBus.h"
|
|
|
|
#define I2C_PAGE_BYTES 64
|
|
|
|
|
|
class i2cPort {
|
|
private:
|
|
int m_nFID;
|
|
basicLogCollection * m_pLog;
|
|
uint8_t m_bAddress;
|
|
//I2CDevice m_sDevice;
|
|
int _write( int fd, int device_addr, uint16_t offset, const char* data, int data_len );
|
|
int _read( int fd, int device_addr, uint16_t offset, char* data, int data_len );
|
|
//protected:
|
|
// virtual int sendBlock(unsigned char *Data, int DataSize);
|
|
// virtual int recptBlock(unsigned char *Buffer, int *BufferLength);
|
|
public:
|
|
explicit i2cPort( CSTR DevicePath, uint8_t DevAddr, int Speed = 0 );
|
|
virtual ~i2cPort();
|
|
bool readMZ( uint16_t offset, uint8_t *buffer, int len );
|
|
bool writeMZ( uint16_t offset, uint8_t *buffer, int len );
|
|
|
|
};
|
|
|
|
#endif
|