diff --git a/include/zh_avr_i2c.h b/include/zh_avr_i2c.h index fa26375..b0bee04 100644 --- a/include/zh_avr_i2c.h +++ b/include/zh_avr_i2c.h @@ -1,3 +1,42 @@ +#pragma once + +#include "stdlib.h" +#include "stdint.h" +#include "string.h" +#include "stdbool.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + typedef enum + { + AVR_FAIL = -1, + AVR_OK, + AVR_ERR_NO_MEM, + AVR_ERR_INVALID_ARG, + AVR_ERR_INVALID_STATE, + AVR_ERR_INVALID_SIZE, + AVR_ERR_NOT_FOUND, + AVR_ERR_NOT_SUPPORTED, + AVR_ERR_TIMEOUT, + AVR_ERR_INVALID_RESPONSE, + AVR_ERR_INVALID_CRC, + AVR_ERR_INVALID_VERSION, + AVR_ERR_NOT_FINISHED, + AVR_ERR_NOT_ALLOWED + } avr_err_t; + + avr_err_t zh_avr_i2c_master_init(void); + avr_err_t zh_avr_i2c_master_transmit(const uint8_t addr, uint8_t *data, uint8_t size, size_t delay); + avr_err_t zh_avr_i2c_master_receive(const uint8_t addr, uint8_t *data, uint8_t size, size_t delay); + avr_err_t zh_avr_i2c_master_transmit_receive(const uint8_t addr, uint8_t *write_data, uint8_t write_size, uint8_t *read_data, uint8_t read_size, size_t delay); + +#ifdef __cplusplus +} +#endif + #ifndef IICULTIMATE_H #define IICULTIMATE_H diff --git a/zh_avr_i2c.c b/zh_avr_i2c.c index c10dc42..e191a05 100644 --- a/zh_avr_i2c.c +++ b/zh_avr_i2c.c @@ -1,5 +1,21 @@ #include "zh_avr_i2c.h" +avr_err_t zh_avr_i2c_master_init(void) +{ +} + +avr_err_t zh_avr_i2c_master_transmit(const uint8_t addr, uint8_t *data, uint8_t size, size_t delay) +{ +} + +avr_err_t zh_avr_i2c_master_receive(const uint8_t addr, uint8_t *data, uint8_t size, size_t delay) +{ +} + +avr_err_t zh_avr_i2c_master_transmit_receive(const uint8_t addr, uint8_t *write_data, uint8_t write_size, uint8_t *read_data, uint8_t read_size, size_t delay) +{ +} + void DoNothing(void); uint8_t i2c_Do; // Переменная состояния передатчика IIC