motorcontroldemo_035/Vinclude/V_i2cMem.h
2019-08-15 18:38:50 +03:00

43 lines
1.1 KiB
C

/*
* V_i2cMem.h
*
* Created on: 15 àâã. 2019 ã.
* Author: Dmitry
*/
#ifndef INCLUDE_V_I2CMEM_H_
#define INCLUDE_V_I2CMEM_H_
#define EEPROM_MEM_LENGTH 32768 //äëèíà ôëåøêè â áàéòàõ (256 êáèò)
struct SI2cMem;
typedef volatile struct SI2cMem TI2cMem;
struct SI2cMem {
Uint16 MEMstartaddr; //! Àäðåñ íà flash
Uint16 data_length; //! Äëèíà äàííûõ â áàéòàõ
Uint16 *DSPstartaddr; //! Àäðåñ íà ìàññèâ ñ äàííûìè
Uint16 LastErr; //! Êîä îøèáêè (åñëè âîçíèêëà)
void (*init)(TI2cMem*);
void (*write)(TI2cMem*);
void (*read)(TI2cMem*);
void (*clearMem)(TI2cMem*);
};
void I2CMEM_Init(TI2cMem*);
void I2CMEM_Write(TI2cMem*);
void I2CMEM_Read(TI2cMem*);
void I2CMEM_Clear(TI2cMem*);
//!Èíèöèàëèçàòîð ïî óìîë÷àíèþ
#define I2CMEM_DEFAULTS { .init = I2CMEM_Init, \
.write = I2CMEM_Write,\
.read = I2CMEM_Read,\
.clearMem = I2CMEM_Clear,\
}
extern TI2cMem i2cMem;
#endif /* INCLUDE_V_I2CMEM_H_ */