本文整理匯總了C++中EE_ReadVariable函數的典型用法代碼示例。如果您正苦於以下問題:C++ EE_ReadVariable函數的具體用法?C++ EE_ReadVariable怎麽用?C++ EE_ReadVariable使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了EE_ReadVariable函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: EE_ReadVariable
void ANO_Param::READ_GYRO_OFFSET(void)
{
uint16_t temp[3];
EE_ReadVariable(VirtAddVarTab[EE_6050_GYRO_X_OFFSET_ADDR], &temp[0]);
EE_ReadVariable(VirtAddVarTab[EE_6050_GYRO_Y_OFFSET_ADDR], &temp[1]);
EE_ReadVariable(VirtAddVarTab[EE_6050_GYRO_Z_OFFSET_ADDR], &temp[2]);
mpu6050.Gyro_Offset.x = temp[0];
mpu6050.Gyro_Offset.y = temp[1];
mpu6050.Gyro_Offset.z = temp[2];
}
示例2: EE_READ_Attitude_PID
/*====================================================================================================*/
static void EE_READ_Attitude_PID(void)
{
int16_t _temp;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_PITCH_P],&_temp);
// 參數為0 說明已經清空flash 則使用默認參數
if(_temp==0) return;
ctrl.pitch.core.kp =(float)_temp / 100;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_PITCH_I],&_temp);
ctrl.pitch.core.ki =(float)_temp / 1000;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_PITCH_D],&_temp);
ctrl.pitch.core.kd = (float)_temp / 100;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_ROLL_P],&_temp);
ctrl.roll.core.kp =(float)_temp / 100;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_ROLL_I],&_temp);
ctrl.roll.core.ki = (float)_temp / 1000;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_ROLL_D],&_temp);
ctrl.roll.core.kd = (float)_temp / 100;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_YAW_P],&_temp);
ctrl.yaw.core.kp =(float)_temp / 100;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_YAW_I],&_temp);
ctrl.yaw.core.ki =(float)_temp / 1000;
EE_ReadVariable(VirtAddVarTab[EE_PID_CORE_YAW_D], &_temp);
ctrl.yaw.core.kd =(float)_temp / 100;
}
示例3: readFlashParameter
/* read from flash and set --------------------------------------------------*/
u16 readFlashParameter(u16 para)
{
u16 val;
if (para == PARA_SET)
{
EE_ReadVariable(VirtAddVarTab[PARA_SET], &val);
parameter[PARA_SET] = val;
}
else
{
EE_ReadVariable(VirtAddVarTab[para+parameter[PARA_SET]], &val);
parameter[para+parameter[PARA_SET]] = val;
}
return val;
}
示例4: getHowMany
/*
* Pobranie informacji o ilosci aktualnie zapisanych wcisniec
* klawiszy
*/
void getHowMany(void)
{
EE_ReadVariable(VirtAddVarTab[63], &howMany);
if (howMany < 0x00 || howMany > 0x3F)
{
resetEEPROM();
howMany = 0x00;
}
}
示例5: conf_general_read_app_configuration
/**
* Read app_configuration from EEPROM. If this fails, default values will be used.
*
* @param conf
* A pointer to a app_configuration struct to write the read configuration to.
*/
void conf_general_read_app_configuration(app_configuration *conf) {
bool is_ok = true;
uint8_t *conf_addr = (uint8_t*)conf;
uint16_t var;
for (unsigned int i = 0;i < (sizeof(app_configuration) / 2);i++) {
if (EE_ReadVariable(EEPROM_BASE_APPCONF + i, &var) == 0) {
conf_addr[2 * i] = (var >> 8) & 0xFF;
conf_addr[2 * i + 1] = var & 0xFF;
} else {
示例6: readFlashParameter
/* read from flash and set --------------------------------------------------*/
u16 readFlashParameter(u16 para)
{
u16 val;
if (para == PARA_SET)
{
EE_ReadVariable(VirtAddVarTab[PARA_SET], &val);
parameter[PARA_SET] = val;
}
else
{
EE_ReadVariable(VirtAddVarTab[para+parameter[PARA_SET]], &val);
parameter[para+parameter[PARA_SET]] = val;
// if we change the SW Parameter we have to init the filter
if (para == PARA_SW) // = 4
{
initFilter(gyroAngle, copterAngle);
}
}
return val;
}
示例7: eeprom_read_block
void eeprom_read_block(void *__dst, const void *__src, size_t __n) {
uint16_t data = 0xFF;
uint16_t eeprom_address = (unsigned) __src;
eeprom_init();
for (uint8_t c = 0; c < __n; c++) {
EE_ReadVariable(eeprom_address+c, &data);
*((uint8_t*)__dst + c) = data;
}
}
示例8: eeprom_read_byte
uint8_t eeprom_read_byte(uint8_t *pos) {
uint16_t data = 0xFF;
uint16_t eeprom_address = (unsigned)pos;
eeprom_init();
if (EE_ReadVariable(eeprom_address, &data) != EE_OK) {
return (unsigned char)data;
}
return (unsigned char)data;
}
示例9: eeprom_restore
/* eeprom: 01,23,45 -> Read results: (10)(32)(54) -> buffer: 012345 */
uint8_t eeprom_restore(uint8_t *buf, uint8_t virt_addr)
{
uint8_t i, retVal = 0;
for(i=0; i<3; i++) {
if (EE_ReadVariable(virt_addr + i, (uint16_t *) &buf[2*i])) {
/* the variable was not found or no valid page was found */
*((uint16_t *) &buf[2*i]) = 0xFFFF;
retVal = 1;
}
}
return retVal;
}
示例10: setup_FLASH
void setup_FLASH()
{
uint16_t tmp_eeprom_data_structure_version;
FLASH_Unlock();
EE_Init();
EE_ReadVariable(VirtAddVarTab[index_eeprom_data_structure_version],&tmp_eeprom_data_structure_version); //eeprom_data_structure_version lesen
if (tmp_eeprom_data_structure_version != eeprom_data_structure_version)
{
EE_Format();
EE_WriteVariable(VirtAddVarTab[index_eeprom_data_structure_version],eeprom_data_structure_version);
}
}
示例11: main
/**
* @brief Main program.
* @param None
* @retval None
*/
int main(void)
{
/* STM32F103xB HAL library initialization:
- Configure the Flash prefetch
- Systick timer is configured by default as source of time base, but user
can eventually implement his proper time base source (a general purpose
timer for example or other time source), keeping in mind that Time base
duration should be kept 1ms since PPP_TIMEOUT_VALUEs are defined and
handled in milliseconds basis.
- Set NVIC Group Priority to 4
- Low Level Initialization
*/
HAL_Init();
/* Configure the system clock to 64 MHz */
SystemClock_Config();
/* Unlock the Flash Program Erase controller */
HAL_FLASH_Unlock();
/* EEPROM Init */
EE_Init();
/* --- Store successively many values of the three variables in the EEPROM ---*/
/* Store 0x1000 values of Variable1 in EEPROM */
for (VarValue = 1; VarValue <= 0x1000; VarValue++)
{
EE_WriteVariable(VirtAddVarTab[0], VarValue);
}
/* read the last stored variables data*/
EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]);
/* Store 0x2000 values of Variable2 in EEPROM */
for (VarValue = 1; VarValue <= 0x2000; VarValue++)
{
EE_WriteVariable(VirtAddVarTab[1], VarValue);
}
/* read the last stored variables data*/
EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]);
EE_ReadVariable(VirtAddVarTab[1], &VarDataTab[1]);
/* Store 0x3000 values of Variable3 in EEPROM */
for (VarValue = 1; VarValue <= 0x3000; VarValue++)
{
EE_WriteVariable(VirtAddVarTab[2], VarValue);
}
/* read the last stored variables data*/
EE_ReadVariable(VirtAddVarTab[0], &VarDataTab[0]);
EE_ReadVariable(VirtAddVarTab[1], &VarDataTab[1]);
EE_ReadVariable(VirtAddVarTab[2], &VarDataTab[2]);
while (1)
{
};
}
示例12: loadParameter
/* load Parameter from virtual EEPROM ---------------------------------------*/
void loadParameter()
{
u16 val;
u16 i;
// test if flash is clear
EE_ReadVariable(401, &val);
if (val != 99)
{
loadDefault();
}
EE_WriteVariable(401, 99);
for (i = 0;i <= USED_PARAMETER; i++)
{
EE_ReadVariable(VirtAddVarTab[i], &val);
parameter[i] = val;
// for test
print_para(i);
Delay(2); // prevent txbuffer overvlow
}
}
示例13: display_info_get
void display_info_get(uint8_t *distortion_type, uint8_t *buf)
{
bool found_display_info = 1;
uint16_t temp_distortion = default_distortion_type;
EE_ReadVariable(EE_DISPLAY_INFO_DISTORTION_TYPE, &temp_distortion);
*distortion_type = temp_distortion;
uint16_t *readbuf = (uint16_t *)buf;
for (uint8_t i = 0; i < EE_DISPLAY_INFO_SIZE; i++) {
if (EE_ReadVariable(EE_DISPLAY_INFO_START+i, &readbuf[i])) {
found_display_info = 0;
break;
}
}
// if display info stuff wasn't found in EEPROM, load the defaults
if (!found_display_info) {
// offset back to the start of the buffer
generate_default_display_info(buf-4);
}
}
示例14: getConfig
void getConfig()
{
FLASH_Unlock();
uint16_t i;
uint16_t *ptr;
EE_Init();
EE_ReadVariable(EADDR_IS_INITIALIZED,&i);
if(i != 0x5253)
{
//empty or corrupted EEPROM detected: write default config
//EE_Format();
EE_WriteVariable(EADDR_IS_INITIALIZED, 0x5253);
s.commutationMethod = commutationMethod_HALL;
s.inputMethod = inputMethod_stepDir;
s.encoder_PPR = 4000;
s.encoder_poles = 4;
s.encoder_counts_per_step = 10;
s.pid_Kp = 10;
s.pid_Ki = 0;
s.pid_Kd = 0;
s.usart_baud = 1152;
writeConfig(s);
return;
}
ptr = (uint16_t *)&s;
for(i=0; i<sizeof(servoConfig)/2;i++)
{
if(EE_ReadVariable(EADDR_CONFIG_START+i, ptr)!=0)
usart_sendStr("Flash Error\n\r");
ptr++;
}
return;
}
示例15: eeprom_restore
/* eeprom: 01,23,45 -> Read results: (10)(32)(54) -> memcpy 01|23|45 -> buffer: 012345 */
uint8_t eeprom_restore(uint8_t *buf, uint8_t virt_addr)
{
uint8_t i, retVal = 0;
uint16_t EE_Data;
for(i=0; i<3; i++) {
if (EE_ReadVariable(virt_addr + i, &EE_Data)) {
/* the variable was not found or no valid page was found */
EE_Data = 0xFFFF;
retVal = 1;
}
memcpy(&buf[2*i], &EE_Data, 2);
}
return retVal;
}