2019-07-29 08:17:46 +03:00
|
|
|
|
/*!
|
|
|
|
|
Copyright 2017 <EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <EFBFBD> <EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
\file V_UserMemory.h
|
|
|
|
|
\brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1921BK01 (<EFBFBD><EFBFBD>. TUserMemory)
|
|
|
|
|
\author <EFBFBD><EFBFBD><EFBFBD> "<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>". http://motorcontrol.ru
|
2019-08-15 18:38:50 +03:00
|
|
|
|
\version v 2.0 10/08/2019
|
2019-07-29 08:17:46 +03:00
|
|
|
|
|
2019-08-15 18:38:50 +03:00
|
|
|
|
\defgroup V_UserMemory <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> I2CMEM (<EFBFBD><EFBFBD>. TUserMemory)
|
2019-07-29 08:17:46 +03:00
|
|
|
|
@{
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef V_USERMEMORY_H
|
|
|
|
|
#define V_USERMEMORY_H
|
|
|
|
|
|
|
|
|
|
#include "DSP.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*! \class TUserMemory
|
2019-08-15 18:38:50 +03:00
|
|
|
|
\brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> I2c
|
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \a TUserMemory, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TUserMemory, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
|
|
|
|
|
flash <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> I2C.\n
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> UserMem \n
|
2019-07-29 08:17:46 +03:00
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n
|
2019-08-15 18:38:50 +03:00
|
|
|
|
UserMem.init(&UserMem);\n
|
2019-07-29 08:17:46 +03:00
|
|
|
|
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n
|
|
|
|
|
UserMem.spiaddr=0;\n
|
|
|
|
|
UserMem.startaddr=buff;\n
|
|
|
|
|
UserMem.data_length=1000;\n
|
|
|
|
|
UserMem.write(&spimem);\n
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//! <20><>. TUserMemory
|
|
|
|
|
|
|
|
|
|
struct SUserMemory {Uint16 MemStartAddr;//!<21><><EFBFBD><EFBFBD><EFBFBD> <20><> flash
|
|
|
|
|
Uint16 *MCUStartAddr; //!<21><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Uint16 data_length;//!<21><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int16 receivedCode;//!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
void (*init)(struct SUserMemory*);
|
|
|
|
|
void (*write)(struct SUserMemory*);
|
|
|
|
|
void (*read)(struct SUserMemory*);
|
|
|
|
|
void (*ms_calc)(struct SUserMemory*);
|
|
|
|
|
void (*slow_calc)(struct SUserMemory*);
|
2019-08-15 18:38:50 +03:00
|
|
|
|
void (*full_erase)(struct SUserMemory*);
|
2019-07-29 08:17:46 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct SUserMemory TUserMemory;
|
|
|
|
|
|
|
|
|
|
//!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2019-08-15 18:38:50 +03:00
|
|
|
|
#define USERMEMORY_DEFAULTS {.init = USERMEMORY_Init, \
|
|
|
|
|
.write = USERMEMORY_Write,\
|
|
|
|
|
.read = USERMEMORY_Read,\
|
|
|
|
|
.ms_calc = USERMEMORY_ms_calc,\
|
|
|
|
|
.slow_calc = USERMEMORY_slow_calc,\
|
|
|
|
|
.full_erase = USERMEMORY_Full_Erase,\
|
|
|
|
|
}
|
2019-07-29 08:17:46 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//! \memberof TUserMemory
|
|
|
|
|
void USERMEMORY_Init(TUserMemory*);
|
|
|
|
|
//! \memberof TUserMemory
|
|
|
|
|
void USERMEMORY_Write(TUserMemory*);
|
|
|
|
|
//! \memberof TUserMemory
|
|
|
|
|
void USERMEMORY_Read(TUserMemory*);
|
|
|
|
|
//! \memberof TUserMemory
|
|
|
|
|
void USERMEMORY_Full_Erase(TUserMemory*);
|
|
|
|
|
//! \memberof TUserMemory
|
|
|
|
|
void USERMEMORY_ms_calc(TUserMemory *p);
|
|
|
|
|
//! \memberof TUserMemory
|
|
|
|
|
void USERMEMORY_slow_calc(TUserMemory *p);
|
2019-08-15 18:38:50 +03:00
|
|
|
|
|
2019-07-29 08:17:46 +03:00
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*@}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|