You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
2.9 KiB
110 lines
2.9 KiB
#include "app_config.h"
|
|
#include "../bsp/cs1232.h"
|
|
#include "../bsp/chipid.h"
|
|
#include "../msp/eeprom.h"
|
|
|
|
GlobalParam G;
|
|
GlobalRegister R;
|
|
int i;
|
|
|
|
// void L3_param_init(void)
|
|
// {
|
|
// #if 0
|
|
// G.xx = 0;
|
|
// //L3_eeprom_read_param();
|
|
// #endif
|
|
// }
|
|
|
|
|
|
//读取reg内容,写入iap
|
|
// void L3_reg_2_iap(void)
|
|
// {
|
|
// #if 0
|
|
// iapData.slaver_id = R.p.slaver_id;
|
|
// iapData.adc_ch_status = R.p.adc_ch_status;
|
|
// iapData.weight_max = R.p.weight_max;
|
|
// iapData.lmd = R.p.lmd;
|
|
// iapData.adc_blur_mid = R.p.adc_blur_mid;
|
|
// iapData.adc_blur_avg = R.p.adc_blur_avg;
|
|
// iapData.adc_blur_shift[0] = R.p.adc_blur_shift[0];
|
|
// iapData.adc_blur_shift[1] = R.p.adc_blur_shift[1];
|
|
// iapData.adc_blur_shift[2] = R.p.adc_blur_shift[2];
|
|
// iapData.adc_blur_threshold[0] = R.p.adc_blur_threshold[0];
|
|
// iapData.adc_blur_threshold[1] = R.p.adc_blur_threshold[1];
|
|
// //写入eeprom
|
|
// if(L1_eep_write_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, (U8*)&iapData,sizeof(IapData),TRUE) == 0)
|
|
// {
|
|
// L0_uart0_sendstr("e2p write success");
|
|
// }
|
|
// #endif
|
|
// if(L1_eep_write_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&R.p,sizeof(R.p),TRUE) == 0)
|
|
// {
|
|
// L0_uart0_sendstr("e2p write success");
|
|
// return;
|
|
// }
|
|
// L0_uart0_sendstr("e2p write failed");
|
|
// }
|
|
|
|
// //读取iap内容,写入reg
|
|
// void L3_iap_2_reg(void)
|
|
// {
|
|
// #if 0
|
|
// if(L1_eep_read_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, (U8*)&iapData, NULL) == 1)
|
|
// {
|
|
// L0_uart0_sendstr("e2p read failed");
|
|
// }
|
|
// L0_uart0_sendstr("e2p read success");
|
|
// R.p.slaver_id = iapData.slaver_id;
|
|
// R.p.adc_ch_status = iapData.adc_ch_status;
|
|
// R.p.weight_max = iapData.weight_max ;
|
|
// R.p.lmd = iapData.lmd;
|
|
// R.p.adc_blur_mid = iapData.adc_blur_mid;
|
|
// R.p.adc_blur_avg = iapData.adc_blur_avg;
|
|
// R.p.adc_blur_shift[0] = iapData.adc_blur_shift[0];
|
|
// R.p.adc_blur_shift[1] = iapData.adc_blur_shift[1];
|
|
// R.p.adc_blur_shift[2] = iapData.adc_blur_shift[2];
|
|
// R.p.adc_blur_threshold[0] = iapData.adc_blur_threshold[0];
|
|
// R.p.adc_blur_threshold[1] = iapData.adc_blur_threshold[1];
|
|
// #endif
|
|
// if(L1_eep_read_block(D_EEP_PARAM_IN_SECTOR, D_EEP_PARAM_IN_BLOCK, D_EEP_SECTOR_BLOCK_SIZE, (U8*)&R.p, NULL) == 0)
|
|
// {
|
|
// L0_uart0_sendstr("e2p read success");
|
|
// return;
|
|
// }
|
|
// L0_uart0_sendstr("e2p read failed");
|
|
// }
|
|
|
|
void L3_reg_reset(void)
|
|
{
|
|
R.slave_id = 0x01;
|
|
R.low_power_mode = 0;
|
|
R.func_btn = 0;
|
|
R.nfc.nfc_no[0] = 0;
|
|
R.nfc.nfc_no[1] = 0;
|
|
for(i=0;i<4;i++){
|
|
R.rfids[i].rfid_no[0] = 0;
|
|
R.rfids[i].rfid_no[1] = 0;
|
|
R.rfids[i].rssi = 0;
|
|
R.rfids[i].ant = 0;
|
|
};
|
|
|
|
//for test
|
|
// R.slave_id = 0x01;
|
|
// R.low_power_mode = 0;
|
|
// R.func_btn = 1;
|
|
// R.nfc.nfc_no[0] = 0x01;
|
|
// R.nfc.nfc_no[1] = 0x23;
|
|
// for(i=0;i<4;i++){
|
|
// R.rfids[i].rfid_no[0] = 0xA0;
|
|
// R.rfids[i].rfid_no[1] = 0xB0;
|
|
// R.rfids[i].rssi = 0x61;
|
|
// R.rfids[i].ant = i;
|
|
// };
|
|
}
|
|
|
|
void L3_reg_init(void)
|
|
{
|
|
L3_reg_reset();
|
|
//L3_iap_2_reg();
|
|
}
|
|
|
|
|