This commit is contained in:
sunbeam 2024-10-12 15:36:29 +08:00
parent 28c5f3cf08
commit 53b057bb05
23 changed files with 59 additions and 167 deletions

View File

@ -3024,7 +3024,7 @@
</Effect>
</IICA0>
<ProjectName Name="PrjName" Text="K80" />
<ProjectPath Name="PrjPath" Text="F:\FCB_project\temp\K80\code\K80_CODE" />
<ProjectPath Name="PrjPath" Text="F:\FCB_project\temp\K67A\K67_CODE" />
<ProjectKind Name="PrjKind" Text="Project78K0R" />
<DeviceName Name="DeviceName" Fixed="" Text="RL78G12" />
<MCUName Name="MCUName" Text="RL78G12_20pin" />
@ -3095,7 +3095,7 @@
<P20 Name="P20/ANI0/AVREFP" AltFunc="P20" Point="I/O" />
<P21 Name="P21/ANI1/AVREFM" AltFunc="P21" Point="I/O" />
<P22 Name="P22/ANI2" AltFunc="P22" Point="I/O" />
<P23 Name="P23/ANI3" AltFunc="P23" Point="I/O" />
<P23 Name="P23/ANI3" AltFunc="" Point="I/O" />
</Port2>
<Port4 Chip="RL78G12_20pin,RL78G12_24pin" Pullup="true">
<P40 Name="P40/KR0/TOOL0" AltFunc="" Point="I/O" />
@ -3108,7 +3108,7 @@
</Port6>
<Port12 Chip="RL78G12_20pin,RL78G12_24pin">
<P121 Name="P121/KR3/X1" AltFunc="" Point="I" />
<P122 Name="P122/KR2/X2/EXCLK" AltFunc="P122" Point="I" />
<P122 Name="P122/KR2/X2/EXCLK" AltFunc="" Point="I" />
<P125 Name="P125/KR1/SI01/_RESET" Pullup="true" AltFunc="" Point="I" />
</Port12>
<Port13>
@ -3885,14 +3885,14 @@
<setting name="Output_value" value="0" />
</P21>
<P22>
<setting name="Operation" value="output" />
<setting name="Operation" value="input" />
<setting name="Pull_up" value="unused" />
<setting name="TTL_buffer" value="unused" />
<setting name="N-ch_open-drain" value="unused" />
<setting name="Output_value" value="0" />
</P22>
<P23>
<setting name="Operation" value="output" />
<setting name="Operation" value="unused" />
<setting name="Pull_up" value="unused" />
<setting name="TTL_buffer" value="unused" />
<setting name="N-ch_open-drain" value="unused" />
@ -3947,7 +3947,7 @@
<setting name="Output_value" value="0" />
</P121>
<P122>
<setting name="Operation" value="input" />
<setting name="Operation" value="unused" />
<setting name="Pull_up" value="unused" />
<setting name="TTL_buffer" value="unused" />
<setting name="N-ch_open-drain" value="unused" />

View File

@ -226,7 +226,7 @@
</Effect>
</IICA0>
<ProjectName Name="PrjName" Text="K80" />
<ProjectPath Name="PrjPath" Text="F:\FCB_project\temp\K80\code\K80_CODE" />
<ProjectPath Name="PrjPath" Text="F:\FCB_project\temp\K67A\K67_CODE" />
<ProjectKind Name="PrjKind" Text="Project78K0R" />
<DeviceName Name="DeviceName" Fixed="" Text="RL78G12" />
<MCUName Name="MCUName" Text="RL78G12_20pin" />
@ -297,7 +297,7 @@
<P20 Name="P20/ANI0/AVREFP" AltFunc="P20" Point="I/O" />
<P21 Name="P21/ANI1/AVREFM" AltFunc="P21" Point="I/O" />
<P22 Name="P22/ANI2" AltFunc="P22" Point="I/O" />
<P23 Name="P23/ANI3" AltFunc="P23" Point="I/O" />
<P23 Name="P23/ANI3" AltFunc="" Point="I/O" />
</Port2>
<Port4 Chip="RL78G12_20pin,RL78G12_24pin" Pullup="true">
<P40 Name="P40/KR0/TOOL0" AltFunc="" Point="I/O" />
@ -310,7 +310,7 @@
</Port6>
<Port12 Chip="RL78G12_20pin,RL78G12_24pin">
<P121 Name="P121/KR3/X1" AltFunc="" Point="I" />
<P122 Name="P122/KR2/X2/EXCLK" AltFunc="P122" Point="I" />
<P122 Name="P122/KR2/X2/EXCLK" AltFunc="" Point="I" />
<P125 Name="P125/KR1/SI01/_RESET" Pullup="true" AltFunc="" Point="I" />
</Port12>
<Port13>
@ -1087,14 +1087,14 @@
<setting name="Output_value" value="0" />
</P21>
<P22>
<setting name="Operation" value="output" />
<setting name="Operation" value="input" />
<setting name="Pull_up" value="unused" />
<setting name="TTL_buffer" value="unused" />
<setting name="N-ch_open-drain" value="unused" />
<setting name="Output_value" value="0" />
</P22>
<P23>
<setting name="Operation" value="output" />
<setting name="Operation" value="unused" />
<setting name="Pull_up" value="unused" />
<setting name="TTL_buffer" value="unused" />
<setting name="N-ch_open-drain" value="unused" />
@ -1149,7 +1149,7 @@
<setting name="Output_value" value="0" />
</P121>
<P122>
<setting name="Operation" value="input" />
<setting name="Operation" value="unused" />
<setting name="Pull_up" value="unused" />
<setting name="TTL_buffer" value="unused" />
<setting name="N-ch_open-drain" value="unused" />

View File

@ -179,13 +179,9 @@ void MsgPro(uint8_t len)
switch (Rxdata[1])
{
case 0x1a:
motor_state = 1;
break;
case 0x1b:
motor_state = 2;
break;
case 0x1c:
motor_state = 3;
motor_state = 1;
break;
case 0x1d:
motor_state = 0;
@ -225,12 +221,8 @@ void keyLogic(uint8_t keyno)
break;
case KEY_AM:
motor_txstate = motor_state + 1;
if (motor_txstate > 3)
{
motor_txstate = 0;
}
else
motor_txstate = !motor_state;
if (motor_txstate != 0)
{
am_counter = 0;
}
@ -281,7 +273,7 @@ void LED_Ctrl(void)
{
FanLED_Ctrl(fan_state);
HeatLED_Ctrl(heat_state);
AnmoLED_Ctrl(motor_state);
AnmoLED_Ctrl(motor_state?1:0);
}
void AppTask(void)

145
hwCtrl.c
View File

@ -12,38 +12,34 @@
#if BOARD == K74R
//RIGHT
#define LEDF1 P1_bit.no1
#define LEDF2 P1_bit.no2
#define LEDF3 P1_bit.no3
#define LEDH1 P4_bit.no2
#define LEDH2 P1_bit.no0
#define LEDH3 P1_bit.no1
#define LEDH3 P4_bit.no1
#define LEDM1 P1_bit.no2
#define LEDM2 P1_bit.no3
#define LEDM3 P1_bit.no4
#define LEDF1 P4_bit.no1
#define LEDF2 P2_bit.no3
#define LEDF3 P2_bit.no2
#define LEDM1 P2_bit.no1
#else
//LEFT
#define LEDH1 P4_bit.no2
#define LEDH2 P1_bit.no0
#define LEDH3 P1_bit.no1
#define LEDH1 P1_bit.no1
#define LEDH2 P1_bit.no2
#define LEDH3 P1_bit.no3
#define LEDF1 P1_bit.no2
#define LEDF2 P1_bit.no3
#define LEDF3 P1_bit.no4
#define LEDF1 P4_bit.no2
#define LEDF2 P1_bit.no0
#define LEDF3 P4_bit.no1
#define LEDM1 P4_bit.no1
#define LEDM2 P2_bit.no3
#define LEDM3 P2_bit.no2
#define LEDM1 P1_bit.no4
#endif
#define IO_KEY1 P2_bit.no0
#define IO_KEY2 P2_bit.no1
#define IO_KEY5 P12_bit.no2
#define IO_KEY6 P13_bit.no7
#define IO_KEYFAN P2_bit.no0
#define IO_KEYANMO P2_bit.no1
#define IO_KEYHEAT P2_bit.no2
@ -51,87 +47,15 @@
extern uint16_t g_AdVal[3];
#if BOARD == K74R
void FanLED_Ctrl(uint8_t state)
{
switch (state)
{
case 0:
LEDF1 = LED_OFF;
LEDF2 = LED_ON;
LEDF3 = LED_ON;
break;
case 3:
LEDF1 = LED_ON;
LEDF2 = LED_ON;
LEDF3 = LED_ON;
break;
case 2:
LEDF1 = LED_ON;
LEDF2 = LED_OFF;
LEDF3 = LED_ON;
break;
case 1:
LEDF1 = LED_ON;
LEDF2 = LED_OFF;
LEDF3 = LED_OFF;
break;
default:
break;
}
}
void AnmoLED_Ctrl(uint8_t state)
{
switch (state)
{
case 0:
LEDM1 = LED_OFF;
LEDM2 = LED_OFF;
LEDM3 = LED_OFF;
break;
case 3:
LEDM1 = LED_ON;
LEDM2 = LED_OFF;
LEDM3 = LED_OFF;
break;
case 2:
LEDM1 = LED_ON;
LEDM2 = LED_ON;
LEDM3 = LED_OFF;
break;
case 1:
LEDM1 = LED_ON;
LEDM2 = LED_ON;
LEDM3 = LED_ON;
break;
default:
break;
}
}
#else
void AnmoLED_Ctrl(uint8_t state)
{
switch (state)
{
case 0:
LEDM1 = LED_OFF;
LEDM2 = LED_ON;
LEDM3 = LED_ON;
break;
case 3:
LEDM1 = LED_ON;
LEDM2 = LED_ON;
LEDM3 = LED_ON;
break;
case 2:
LEDM1 = LED_ON;
LEDM2 = LED_OFF;
LEDM3 = LED_ON;
break;
case 1:
LEDM1 = LED_ON;
LEDM2 = LED_OFF;
LEDM3 = LED_OFF;
break;
default:
break;
@ -165,7 +89,7 @@ void FanLED_Ctrl(uint8_t state)
break;
}
}
#endif
void HeatLED_Ctrl(uint8_t state)
{
@ -197,43 +121,20 @@ void HeatLED_Ctrl(uint8_t state)
}
#define KEY_AD_V1 690
#define KEY_AD_V2 510
#define KEY_AD_TH 50
#define KEY5_AD_V1 KEY_AD_TH //0
#define KEY5_AD_V2 254
#define KEY5_AD_V3 455
#define KEY5_AD_V4 658
#define KEY5_AD_V5 902
uint8_t GetKeyState(uint8_t keyno)
{
switch (keyno)
{
#if BOARD == K74R
//RIGHT
case KEY_FAN:
return IO_KEY1==0?1:0;
case KEY_AM:
return IO_KEYANMO==0?1:0;
break;
case KEY_JR:
return IO_KEY2==0?1:0;
break;
case KEY_AM:
return (IO_KEY5==0)?1:0;
break;
#else
//left
case KEY_AM:
return IO_KEY1==0?1:0;
break;
case KEY_JR:
return IO_KEY2==0?1:0;
return IO_KEYHEAT==0?1:0;
break;
case KEY_FAN:
return (IO_KEY5==0)?1:0;
return IO_KEYFAN==0?1:0;
break;
#endif
default:
return 0;
break;

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef CGC_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for CGC module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements general head file.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef STATUS_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************
@ -56,14 +56,13 @@ Global variables and functions
void R_PORT_Create(void)
{
P1 = _01_Pn0_OUTPUT_1 | _02_Pn1_OUTPUT_1 | _04_Pn2_OUTPUT_1 | _08_Pn3_OUTPUT_1 | _10_Pn4_OUTPUT_1;
P2 = _00_Pn2_OUTPUT_0 | _00_Pn3_OUTPUT_0;
P4 = _02_Pn1_OUTPUT_1 | _04_Pn2_OUTPUT_1;
PMC1 = _00_PMCn0_DI_ON | _00_PMCn1_DI_ON | _00_PMCn2_DI_ON | _00_PMCn3_DI_ON | _00_PMCn4_DI_ON | _E0_PMC1_DEFAULT;
PMC4 = _00_PMCn1_DI_ON | _00_PMCn2_DI_ON | _F9_PMC4_DEFAULT;
ADPC = _01_ADPC_DI_ON;
PM1 = _00_PMn0_MODE_OUTPUT | _00_PMn1_MODE_OUTPUT | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT |
_00_PMn4_MODE_OUTPUT | _E0_PM1_DEFAULT;
PM2 = _01_PMn0_MODE_INPUT | _02_PMn1_MODE_INPUT | _00_PMn2_MODE_OUTPUT | _00_PMn3_MODE_OUTPUT | _F0_PM2_DEFAULT;
PM2 = _01_PMn0_MODE_INPUT | _02_PMn1_MODE_INPUT | _04_PMn2_MODE_INPUT | _08_PMn3_NOT_USE | _F0_PM2_DEFAULT;
PM4 = _01_PMn0_NOT_USE | _00_PMn1_MODE_OUTPUT | _00_PMn2_MODE_OUTPUT | _F8_PM4_DEFAULT;
}

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef PORT_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for PORT module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for Serial module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for Serial module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef SERIAL_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for Serial module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef TAU_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for TAU module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file includes user definition.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef _USER_DEF_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
#ifndef WDT_H

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements device driver for WDT module.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements main function.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************

View File

@ -23,7 +23,7 @@
* Device(s) : R5F10268
* Tool-Chain : CCRL
* Description : This file implements system initializing function.
* Creation Date: 2024-05-24
* Creation Date: 2024-10-10
***********************************************************************************************************************/
/***********************************************************************************************************************