SWILIB API (X75)    
Loading...
Searching...
No Matches
i2c.h
Go to the documentation of this file.
1#pragma once
2
11#ifndef __IN_SWILIB__
12#include "base.h"
13#endif
14
16
17typedef struct I2C_MSG I2C_MSG;
18
22struct I2C_MSG {
23 uint8_t chip_addr;
24#ifdef NEWSGOLD
25 char unk1;
26 char unk2;
27 char unk3;
28 short nRegister;
29#else
30 char unk1;
31 short nRegister;
32 char unk2;
33 uint8_t tf;
34#endif
35 uint16_t cb_data;
36 int (*i2c_msg)(I2C_MSG *);
37 void *data;
38 int size;
39};
40
46__swi_begin(0x2EC)
48__swi_end(0x2EC, i2c_transfer, (msg));
49
55__swi_begin(0x2ED)
57__swi_end(0x2ED, i2c_receive, (msg));
58
60
#define __swilib_begin
Definition doxygen.h:29
#define __swi_end(number, func, call)
Definition doxygen.h:33
#define __swi_begin(number)
Definition doxygen.h:32
#define __swilib_end
Definition doxygen.h:30
uint8_t tf
Definition i2c.h:33
int(* i2c_msg)(I2C_MSG *)
Callback, which will be called at the end of the transfer.
Definition i2c.h:36
char unk1
Definition i2c.h:30
uint8_t chip_addr
7-bit address.
Definition i2c.h:23
int size
Size of the data for reading or writing.
Definition i2c.h:38
short nRegister
ID of SMBUS register.
Definition i2c.h:31
uint16_t cb_data
Unknown.
Definition i2c.h:35
void * data
Reading buffer (i2c_receive) or data for sending (i2c_transfer).
Definition i2c.h:37
char unk2
Definition i2c.h:32
int i2c_receive(I2C_MSG *msg)
Write data to the I2C device (SMBUS).
int i2c_transfer(I2C_MSG *msg)
Read data from the I2C device (SMBUS).
I2C SMBUS message.
Definition i2c.h:22