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.
 
 
 
 
 
 

37 lines
1.1 KiB

#ifndef __SPI_PORT_HEADER__
#define __SPI_PORT_HEADER__
#include "../../components/base/basicTypes.h"
#include "../../data/transport/transportBus.h"
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
typedef enum E_SPI_MODES{
SPI_ADDR_8 = 0,
SPI_ADDR_16 = 1
} SPI_MODE;
class spiPort {
private:
basicLogCollection * m_pLog;
int m_nFID;
uint8_t m_bRegAddrBytes;
int _write( int fd, uint16_t offset, const char* data, int data_len );
int _read( int fd, uint16_t offset, char* data, int data_len );
public:
explicit spiPort( CSTR DevicePath, int Speed );
virtual ~spiPort();
bool readMZ( uint16_t offset, uint8_t *buffer, int len );
bool writeMZ( uint16_t offset, uint8_t *buffer, int len );
uint8_t read8( uint16_t offset );
bool write8( uint16_t offset, uint8_t byte );
};
#endif