LIN ok
This commit is contained in:
parent
f3329c6c49
commit
f378cc9d72
@ -659,7 +659,7 @@
|
|||||||
<option>
|
<option>
|
||||||
<name>OOCOutputFormat</name>
|
<name>OOCOutputFormat</name>
|
||||||
<version>3</version>
|
<version>3</version>
|
||||||
<state>3</state>
|
<state>1</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OCOutputOverride</name>
|
<name>OCOutputOverride</name>
|
||||||
@ -667,7 +667,7 @@
|
|||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OOCOutputFile</name>
|
<name>OOCOutputFile</name>
|
||||||
<state>META_Test.bin</state>
|
<state>application.hex</state>
|
||||||
</option>
|
</option>
|
||||||
<option>
|
<option>
|
||||||
<name>OOCCommandLineProducer</name>
|
<name>OOCCommandLineProducer</name>
|
||||||
|
@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
|
|||||||
|
|
||||||
@echo on
|
@echo on
|
||||||
|
|
||||||
"E:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
"e:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
goto end
|
goto end
|
||||||
@ -34,7 +34,7 @@ goto end
|
|||||||
|
|
||||||
@echo on
|
@echo on
|
||||||
|
|
||||||
"E:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" "--debug_file=%~1" --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
"e:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" "--debug_file=%~1" --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
||||||
|
|
||||||
@echo off
|
@echo off
|
||||||
:end
|
:end
|
@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
if ($debugfile -eq "")
|
if ($debugfile -eq "")
|
||||||
{
|
{
|
||||||
& "E:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
& "e:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
& "E:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" --debug_file=$debugfile --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
& "e:\IAR Systems\Embedded Workbench 8.3\common\bin\cspybat" -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.general.xcl" --debug_file=$debugfile --backend -f "F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\settings\application.Release.driver.xcl"
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
"E:\IAR Systems\Embedded Workbench 8.3\arm\bin\armproc.dll"
|
"e:\IAR Systems\Embedded Workbench 8.3\arm\bin\armproc.dll"
|
||||||
|
|
||||||
"E:\IAR Systems\Embedded Workbench 8.3\arm\bin\armjlink2.dll"
|
"e:\IAR Systems\Embedded Workbench 8.3\arm\bin\armjlink2.dll"
|
||||||
|
|
||||||
"F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\Release\Exe\realplumPro_app.out"
|
"F:\FCB_project\temp\K74\K74B_CODE\K74B\app_Indie\Release\Exe\realplumPro_app.out"
|
||||||
|
|
||||||
--plugin="E:\IAR Systems\Embedded Workbench 8.3\arm\bin\armbat.dll"
|
--plugin="e:\IAR Systems\Embedded Workbench 8.3\arm\bin\armbat.dll"
|
||||||
|
|
||||||
--flash_loader="E:\IAR Systems\Embedded Workbench 8.3\arm\config\flashloader\IndieSemi\FlashLoader_metaLite.board"
|
--flash_loader="e:\IAR Systems\Embedded Workbench 8.3\arm\config\flashloader\IndieSemi\FlashLoader_metaLite.board"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
39
app_Indie/settings/application_Release.jlink
Normal file
39
app_Indie/settings/application_Release.jlink
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
[BREAKPOINTS]
|
||||||
|
ForceImpTypeAny = 0
|
||||||
|
ShowInfoWin = 1
|
||||||
|
EnableFlashBP = 2
|
||||||
|
BPDuringExecution = 0
|
||||||
|
[CFI]
|
||||||
|
CFISize = 0x00
|
||||||
|
CFIAddr = 0x00
|
||||||
|
[CPU]
|
||||||
|
MonModeVTableAddr = 0xFFFFFFFF
|
||||||
|
MonModeDebug = 0
|
||||||
|
MaxNumAPs = 0
|
||||||
|
LowPowerHandlingMode = 0
|
||||||
|
OverrideMemMap = 0
|
||||||
|
AllowSimulation = 1
|
||||||
|
ScriptFile=""
|
||||||
|
[FLASH]
|
||||||
|
CacheExcludeSize = 0x00
|
||||||
|
CacheExcludeAddr = 0x00
|
||||||
|
MinNumBytesFlashDL = 0
|
||||||
|
SkipProgOnCRCMatch = 1
|
||||||
|
VerifyDownload = 1
|
||||||
|
AllowCaching = 1
|
||||||
|
EnableFlashDL = 2
|
||||||
|
Override = 0
|
||||||
|
Device="ARM7"
|
||||||
|
[GENERAL]
|
||||||
|
WorkRAMSize = 0x00
|
||||||
|
WorkRAMAddr = 0x00
|
||||||
|
RAMUsageLimit = 0x00
|
||||||
|
[SWO]
|
||||||
|
SWOLogFile=""
|
||||||
|
[MEM]
|
||||||
|
RdOverrideOrMask = 0x00
|
||||||
|
RdOverrideAndMask = 0xFFFFFFFF
|
||||||
|
RdOverrideAddr = 0xFFFFFFFF
|
||||||
|
WrOverrideOrMask = 0x00
|
||||||
|
WrOverrideAndMask = 0xFFFFFFFF
|
||||||
|
WrOverrideAddr = 0xFFFFFFFF
|
@ -17,10 +17,21 @@
|
|||||||
#include <pdsTask.h>
|
#include <pdsTask.h>
|
||||||
#include <linStackTask.h>
|
#include <linStackTask.h>
|
||||||
#include "PINdef.h"
|
#include "PINdef.h"
|
||||||
|
#include "hwCtrl.h"
|
||||||
/*static uint8_t ledNum = LED0;*/
|
/*static uint8_t ledNum = LED0;*/
|
||||||
static TaskState_t applState = TASK_STATE_INIT;
|
static TaskState_t applState = TASK_STATE_INIT;
|
||||||
void ApplTimerExpired(SoftTimer_t *timer);
|
void ApplTimerExpired(SoftTimer_t *timer);
|
||||||
|
|
||||||
|
void KeyScanTimerExpired(SoftTimer_t *timer);
|
||||||
|
void TxMsgPro(void);
|
||||||
|
|
||||||
|
|
||||||
|
static SoftTimer_t KeyScanTimer = {
|
||||||
|
.mode = TIMER_PERIODIC_MODE,
|
||||||
|
.interval = 5U,
|
||||||
|
.handler = KeyScanTimerExpired
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static uint8_t LED_State = 0U;
|
static uint8_t LED_State = 0U;
|
||||||
|
|
||||||
@ -55,6 +66,7 @@ void APPL_TaskHandler(void)
|
|||||||
switch(applState){
|
switch(applState){
|
||||||
case TASK_STATE_INIT:
|
case TASK_STATE_INIT:
|
||||||
SoftTimer_Start(&ApplTimer);
|
SoftTimer_Start(&ApplTimer);
|
||||||
|
SoftTimer_Start(&KeyScanTimer);
|
||||||
applState = TASK_STATE_ACTIVE;
|
applState = TASK_STATE_ACTIVE;
|
||||||
break;
|
break;
|
||||||
case TASK_STATE_ACTIVE:
|
case TASK_STATE_ACTIVE:
|
||||||
@ -72,15 +84,36 @@ void APPL_HandleControlCommands(LIN_Device_Frame_t const *frame)
|
|||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
//BYTE 0
|
||||||
|
uint8_t HG:2;//»¬¹ì
|
||||||
|
uint8_t AM:2;//°´Ä¦
|
||||||
|
uint8_t KB:2;//¿¿±³
|
||||||
|
uint8_t REVERSE01:2;
|
||||||
|
//BYTE 1
|
||||||
|
uint8_t TT:2;
|
||||||
|
uint8_t REVERSE11:2;
|
||||||
|
uint8_t ZY:2;
|
||||||
|
uint8_t REVERSE12:2;
|
||||||
|
//BYTE 2
|
||||||
|
uint8_t REVERSE21:4;
|
||||||
|
uint8_t FW:1;//¸´Î»
|
||||||
|
uint8_t REVERSE22:3;
|
||||||
|
//3-7
|
||||||
|
uint8_t REVERSE3;
|
||||||
|
uint8_t REVERSE4;
|
||||||
|
uint8_t REVERSE5;
|
||||||
|
uint8_t REVERSE6;
|
||||||
|
uint8_t REVERSE7;
|
||||||
|
}LIN_MSG_TYPE;
|
||||||
|
|
||||||
|
LIN_MSG_TYPE LIN_msg_buf;
|
||||||
|
const uint8_t LIN_Init_data[] = {0x00,0x00,0x80,0xff,0xff,0xff,0xff,0x0f};
|
||||||
|
|
||||||
static uint16_t keydelay[KEY_NUM]={0};
|
static uint16_t keydelay[KEY_NUM]={0};
|
||||||
static uint8_t keyflag[KEY_NUM]={0};
|
static uint8_t keyflag[KEY_NUM]={0};
|
||||||
void KeyScanTimerExpired(SoftTimer_t *timer);
|
|
||||||
|
|
||||||
static SoftTimer_t KeyScanTimer = {
|
|
||||||
.mode = TIMER_PERIODIC_MODE,
|
|
||||||
.interval = 5U,
|
|
||||||
.handler = KeyScanTimerExpired
|
|
||||||
};
|
|
||||||
|
|
||||||
#define KEY_DELAY_TIME 6
|
#define KEY_DELAY_TIME 6
|
||||||
void KeyScanTimerExpired(SoftTimer_t *timer)
|
void KeyScanTimerExpired(SoftTimer_t *timer)
|
||||||
@ -106,5 +139,64 @@ void KeyScanTimerExpired(SoftTimer_t *timer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
TxMsgPro();
|
||||||
|
}
|
||||||
|
extern uint16_t g_AdVal[3];
|
||||||
|
uint8_t fan_state,heat_state;
|
||||||
|
void LED_Ctrl(void)
|
||||||
|
{
|
||||||
|
//fan_state = (g_rxbuf[0]&0xc0)>>6;
|
||||||
|
//heat_state = (g_rxbuf[0]&0x30)>>4;
|
||||||
|
FanLED_Ctrl(fan_state);
|
||||||
|
HeatLED_Ctrl(heat_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t GetKeyFlag(uint8_t keyid)
|
||||||
|
{
|
||||||
|
if (keyid > 0 && keyid <= KEY_NUM)
|
||||||
|
{
|
||||||
|
return keyflag[keyid-1]?1:0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uint8_t g_rxbuf[8],g_txbuf1[8],g_txbuf2[8];
|
||||||
|
void TxMsgPro(void)
|
||||||
|
{
|
||||||
|
uint8_t temp=0,i;
|
||||||
|
temp = 0xf0;
|
||||||
|
#if BOARDCFG == LEFT_BOARD
|
||||||
|
LIN_msg_buf.FW = GetKeyFlag(SIGID_KEY13);
|
||||||
|
LIN_msg_buf.TT = GetKeyFlag(SIGID_KEY6)<<1|GetKeyFlag(SIGID_KEY5);
|
||||||
|
LIN_msg_buf.HG = GetKeyFlag(SIGID_KEY3)<<1|GetKeyFlag(SIGID_KEY4);
|
||||||
|
LIN_msg_buf.AM = GetKeyFlag(SIGID_KEY8)<<1|GetKeyFlag(SIGID_KEY7);
|
||||||
|
LIN_msg_buf.KB = GetKeyFlag(SIGID_KEY9)<<1|GetKeyFlag(SIGID_KEY11);
|
||||||
|
LIN_msg_buf.ZY = GetKeyFlag(SIGID_KEY12)<<1|GetKeyFlag(SIGID_KEY10);
|
||||||
|
temp |= GetKeyFlag(SIGID_KEY1)<<1;
|
||||||
|
temp |= GetKeyFlag(SIGID_KEY2)<<0;
|
||||||
|
#else
|
||||||
|
LIN_msg_buf.FW = GetKeyFlag(SIGID_KEY13);
|
||||||
|
LIN_msg_buf.HG = GetKeyFlag(SIGID_KEY5)<<1|GetKeyFlag(SIGID_KEY6);
|
||||||
|
LIN_msg_buf.TT = GetKeyFlag(SIGID_KEY4)<<1|GetKeyFlag(SIGID_KEY3);
|
||||||
|
LIN_msg_buf.AM = GetKeyFlag(SIGID_KEY7)<<1|GetKeyFlag(SIGID_KEY8);
|
||||||
|
LIN_msg_buf.KB = GetKeyFlag(SIGID_KEY9)<<1|GetKeyFlag(SIGID_KEY11);
|
||||||
|
LIN_msg_buf.ZY = GetKeyFlag(SIGID_KEY10)<<1|GetKeyFlag(SIGID_KEY12);
|
||||||
|
temp |= GetKeyFlag(SIGID_KEY1)<<0;
|
||||||
|
temp |= GetKeyFlag(SIGID_KEY2)<<1;
|
||||||
|
#endif
|
||||||
|
LIN_msg_buf.REVERSE01 = LIN_msg_buf.KB?1:0;
|
||||||
|
|
||||||
|
LIN_msg_buf.REVERSE4 = g_AdVal[0]>>8;
|
||||||
|
LIN_msg_buf.REVERSE5 = g_AdVal[0]&0xff;
|
||||||
|
LIN_msg_buf.REVERSE6 = g_AdVal[1]>>8;
|
||||||
|
LIN_msg_buf.REVERSE7 = g_AdVal[1]&0xff;
|
||||||
|
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
g_txbuf1[i] = ((uint8_t *)(&LIN_msg_buf))[i];
|
||||||
|
}
|
||||||
|
g_txbuf2[0] = temp;
|
||||||
|
g_txbuf2[1] = 0x0b;
|
||||||
}
|
}
|
||||||
|
@ -295,33 +295,23 @@ void UnconditionalPublishedCmdsTxFinishedISR(uint8_t fid, uint8_t resvd)
|
|||||||
User defined published frame callback function which from LINS ISR
|
User defined published frame callback function which from LINS ISR
|
||||||
please fill frame data[0-7] only, please don't do any changes on the left info except data[x]!!!!
|
please fill frame data[0-7] only, please don't do any changes on the left info except data[x]!!!!
|
||||||
*///TODO
|
*///TODO
|
||||||
|
extern uint8_t g_txbuf1[8];
|
||||||
|
extern uint8_t g_txbuf2[8];
|
||||||
void UnconditionalPublishedCmdsISR(LIN_Device_Frame_t *const frame)
|
void UnconditionalPublishedCmdsISR(LIN_Device_Frame_t *const frame)
|
||||||
{
|
{
|
||||||
/* feed buffer to frame */
|
/* feed buffer to frame */
|
||||||
|
uint8_t i;
|
||||||
if (frame->frame_id == UnconditionalCmdsTable[FID_TFJR_INDEX].frame_id){
|
if (frame->frame_id == UnconditionalCmdsTable[FID_TFJR_INDEX].frame_id){
|
||||||
/* status management frame */
|
/* status management frame */
|
||||||
// lin_status_t status = ls_ifc_read_status();
|
for (i = 0; i < 8; i++)
|
||||||
// frame->data[0] = (uint8_t)status.payload;
|
{
|
||||||
// frame->data[1] = LINS_GetPIDFromFID(status.pid);
|
frame->data[i] = g_txbuf2[i];
|
||||||
// frame->data[2] = ls_read_error_code_log();
|
}
|
||||||
// for (uint8_t i = 2U; i < 8U; i++){
|
|
||||||
// frame->data[i] = 0xFFU;
|
|
||||||
// }
|
|
||||||
lin_status_t status = ls_ifc_read_status();
|
|
||||||
frame->data[0] = (uint8_t)status.payload;
|
|
||||||
frame->data[1] = SAFM_TransferState();
|
|
||||||
frame->data[2] = (uint8_t)SAFM_GetMotorcurrent();
|
|
||||||
frame->data[3] = (uint8_t)SAFM_GetMotorcurrent()>>8;
|
|
||||||
frame->data[4] = (uint8_t)SAFM_GetMotorcurrent();
|
|
||||||
frame->data[5] = (uint8_t)SAFM_GetMotorcurrent()>>8;
|
|
||||||
frame->data[6] = Motor_GetCurrentPosition();
|
|
||||||
frame->data[7] = Motor_GetCurrentPosition() >> 8;
|
|
||||||
|
|
||||||
}else if (frame->frame_id == UnconditionalCmdsTable[FID_KEY_INDEX].frame_id){
|
}else if (frame->frame_id == UnconditionalCmdsTable[FID_KEY_INDEX].frame_id){
|
||||||
/* user defined data report */
|
/* user defined data report */
|
||||||
frame->data[0] = (APPL_GetLEDState()) | (eventTriggeredLedOn << 1U) | 0xF8U;
|
for (i = 1U; i < LIN_BUFF_SIZE; i++){
|
||||||
for (uint8_t i = 1U; i < LIN_BUFF_SIZE; i++){
|
frame->data[i] = g_txbuf1[i];
|
||||||
frame->data[i] = 0xFFU;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
/* intent to empty */
|
/* intent to empty */
|
||||||
|
@ -31,12 +31,12 @@ void pmu_init(void);
|
|||||||
|
|
||||||
void gpios_init(void)
|
void gpios_init(void)
|
||||||
{
|
{
|
||||||
GPIO_Init(IO_KEY3,GPIO_DIR_INPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_KEY3,GPIO_DIR_INPUT,GPIO_PULL_UP);
|
||||||
GPIO_Init(IO_KEY4,GPIO_DIR_INPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_KEY4,GPIO_DIR_INPUT,GPIO_PULL_UP);
|
||||||
GPIO_Init(IO_KEY5,GPIO_DIR_INPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_KEY5,GPIO_DIR_INPUT,GPIO_PULL_UP);
|
||||||
GPIO_Init(IO_KEY6,GPIO_DIR_INPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_KEY6,GPIO_DIR_INPUT,GPIO_PULL_UP);
|
||||||
GPIO_Init(IO_KEY7,GPIO_DIR_INPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_KEY7,GPIO_DIR_INPUT,GPIO_PULL_UP);
|
||||||
GPIO_Init(IO_KEY8,GPIO_DIR_INPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_KEY8,GPIO_DIR_INPUT,GPIO_PULL_UP);
|
||||||
|
|
||||||
GPIO_Init(IO_LED1,GPIO_DIR_OUTPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_LED1,GPIO_DIR_OUTPUT,GPIO_PULL_NONE);
|
||||||
GPIO_Init(IO_LED2,GPIO_DIR_OUTPUT,GPIO_PULL_NONE);
|
GPIO_Init(IO_LED2,GPIO_DIR_OUTPUT,GPIO_PULL_NONE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user