72 lines
2.0 KiB
C++
72 lines
2.0 KiB
C++
|
|
/*!\file
|
|||
|
|
* \brief Файл содержит модуль создания и связывания драйвера микросхемы еепром.
|
|||
|
|
* \detail ВНИМАНИЕ! МОДУЛЬ ПЛАТФОРМОЗАВИСИМЫЙ!
|
|||
|
|
*/
|
|||
|
|
/*
|
|||
|
|
* Eeprom24LCxxBSetup.h
|
|||
|
|
*
|
|||
|
|
* Created on: 4 июл. 2019 г.
|
|||
|
|
* Author: titov
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#ifndef SOURCE_APPLICATION_raw_signals_EEPROM24LCXXBSETUP_H_
|
|||
|
|
#define SOURCE_APPLICATION_raw_signals_EEPROM24LCXXBSETUP_H_
|
|||
|
|
|
|||
|
|
#include "../ISetupStep.hh"
|
|||
|
|
|
|||
|
|
#include "../../peripheral/II2c.hh"
|
|||
|
|
#include "../../driver/IDiscreteOutput.hh"
|
|||
|
|
|
|||
|
|
#include "../../driver/I2cEeprom24LCxxB.hh"
|
|||
|
|
|
|||
|
|
#include "../../peripheral/IMemoryAccess.hh"
|
|||
|
|
|
|||
|
|
#include <exception>
|
|||
|
|
|
|||
|
|
namespace application { namespace board {
|
|||
|
|
|
|||
|
|
struct Eeprom24LCxxBSetup : public ISetupStep {
|
|||
|
|
|
|||
|
|
typedef peripheral::II2c I2c;
|
|||
|
|
|
|||
|
|
I2c * i2c = nullptr;
|
|||
|
|
driver::IDiscreteOutput * write_en_pin = nullptr;
|
|||
|
|
|
|||
|
|
//!Структура описывает настройки для драйвера микросхемы EEPROM 24LC64B.
|
|||
|
|
struct Setting {
|
|||
|
|
uint16_t polling_time; //!<Максимальное время ожидания записи страницы, мс.
|
|||
|
|
uint16_t size; //!<Размер памяти EEPROM 24LC64B.
|
|||
|
|
uint16_t address; //!<Адрес на шине i2c.
|
|||
|
|
uint32_t baud_rate; //!<Частота SCL сигнала, Гц.
|
|||
|
|
uint16_t page_size; //!<Размер страницы данных в EEPROM.
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
const Setting & cfg;
|
|||
|
|
|
|||
|
|
struct Links {
|
|||
|
|
Environment::Id i2c_id;
|
|||
|
|
Environment::Id write_enable_id;
|
|||
|
|
|
|||
|
|
Environment::Id memory_id;
|
|||
|
|
|
|||
|
|
Environment::StatusId error_id;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
const Links & links;
|
|||
|
|
const configuration::ProcessConfig & params;
|
|||
|
|
|
|||
|
|
|
|||
|
|
bool input( Environment & env );
|
|||
|
|
bool prepare();
|
|||
|
|
void build( Environment & env );
|
|||
|
|
|
|||
|
|
|
|||
|
|
Eeprom24LCxxBSetup( const Links & links, const Setting & setting, const configuration::ProcessConfig & proc );
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
}}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endif /* SOURCE_APPLICATION_raw_signals_EEPROM24LCXXBSETUP_H_ */
|