This commit is contained in:
cfif 2025-06-02 13:26:41 +03:00
commit f90d51dad3
2 changed files with 38 additions and 0 deletions

28
Inc/I2cIO.h Normal file
View File

@ -0,0 +1,28 @@
//
// Created by xemon on 12.10.22.
//
#ifndef UVEOS_ON_NATION_I2CPORTINTERFACE_H
#define UVEOS_ON_NATION_I2CPORTINTERFACE_H
#include "stdint.h"
//typedef enum {
// I2C_RW_OK = 0x00U,
// I2C_RW_ERROR = 0x01U,
// I2C_RW_BUSY = 0x02U,
// I2C_RW_TIMEOUT = 0x03U
//} I2cIOResult;
typedef uint16_t ( *I2C_IO_Operation )(void *env, uint16_t devAddress, uint8_t *data, uint16_t size, uint32_t timeout);
typedef struct {
void *env;
I2C_IO_Operation read;
I2C_IO_Operation write;
} tI2cIO;
#define I2cRead(IO, DEV_ADDR, DATA, SIZE, TIMEOUT) IO->read((IO)->env,DEV_ADDR, DATA, SIZE, TIMEOUT)
#define I2cWrite(IO, DEV_ADDR, DATA, SIZE, TIMEOUT) IO->write((IO)->env,DEV_ADDR, DATA, SIZE, TIMEOUT)
#endif //UVEOS_ON_NATION_I2CPORTINTERFACE_H

10
modular.json Normal file
View File

@ -0,0 +1,10 @@
{
"cmake": {
"inc_dirs": [
"Inc"
],
"srcs": [
"Src/**.c"
]
}
}