Dmitry Kovalev
/
LG
n
Fork of LG by
Revision 28:1c9acd3b224d, committed 2016-02-04
- Comitter:
- Kovalev_D
- Date:
- Thu Feb 04 10:21:57 2016 +0000
- Parent:
- 27:101340a22746
- Parent:
- 26:52ce5953a5c2
- Commit message:
- 13:21
Changed in this revision
diff -r 101340a22746 -r 1c9acd3b224d Parameters.h --- a/Parameters.h Wed Feb 03 14:48:02 2016 +0000 +++ b/Parameters.h Thu Feb 04 10:21:57 2016 +0000 @@ -35,11 +35,12 @@ - +/* #define SetV1 LPC_GPIO1->FIOSET=(1<<25); #define ClrV1 LPC_GPIO1->FIOCLR = (1<<25); #define SetV2 LPC_GPIO1->FIOSET = (1<<28); #define ClrV2 LPC_GPIO1->FIOCLR = (1<<28); +*/ #define LoopOn LPC_GPIO1->FIOSET = (1<<30); #define LoopOff LPC_GPIO1->FIOCLR = (1<<30); #define StartV1 0
diff -r 101340a22746 -r 1c9acd3b224d main.c --- a/main.c Wed Feb 03 14:48:02 2016 +0000 +++ b/main.c Thu Feb 04 10:21:57 2016 +0000 @@ -195,9 +195,8 @@ Time100K = 0; Time1Hz = 0; Clock1Hz = 0; - ShiftD = StartShiftD; - ShiftL = StartShiftL; - + Main.Discharg = StartDischarg; + Pulse_8Point = 0; Pulse_16Point = 0; Pulse_32Point = 0; @@ -247,14 +246,11 @@ Clock1Hz++; //============================= блок управления поджигом и подсветкой, сделанно через сдвиг====================== - if (ShiftD) { //Проверка поджига -// if (ShiftD & 0x01) - ShiftD = ShiftD >> 1; + if (Main.Discharg){ //Проверка поджига + if (Main.Discharg & 0x01) Main.PinReg |= PinRegBitD; else Main.PinReg &= ~PinRegBitD; + Main.Discharg = Main.Discharg >> 1; } - if (ShiftL) { //Проверка подсветки - ShiftL = ShiftL >> 1; - - } + } if (Event1K) {// событие раз в 1 кГц
diff -r 101340a22746 -r 1c9acd3b224d pin.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pin.c Thu Feb 04 10:21:57 2016 +0000 @@ -0,0 +1,65 @@ +#include "Global.h" + +void PinDiscarg(void) +{ + /* unsigned int temp; + temp = ((Main.Discharg & 0x1)<<4); + temp = temp<<4 ;*/ + Main.PinReg |= ((Main.Discharg & 0x1)<<4); + Main.Discharg=Main.Discharg>>1; +} + + +void PinCheng(void) +{ + unsigned int vib1, vib2, discarg, Light; + unsigned int error; + + if((Main.PinReg & PinRegBitD) != (Main.PinRegOld & PinRegBitD)) + + { + if(Main.PinReg & PinRegBitD) LightUpON else LightUpOFF + + } + + if((Main.PinReg & PinRegBitD) != (Main.PinRegOld & PinRegBitD)) + + { + if(Main.PinReg & PinRegBitD) LightUpON else LightUpOFF + + } + + + + Main.PinRegOld = Main.PinReg; + + + if(Main.PinReg!=Main.PinRegOld) + + { + vib1 = Main.PinReg & 0x1; + vib2 = Main.PinReg & 0x2; + Light = Main.PinReg & 0x4; + discarg = Main.PinReg & 0x8; + + if(vib1) { + SetV1 + } else ClrV1 + + if(vib2) { + SetV2 + } else ClrV2 + + if(Light) { + BackLightON + } else { + BackLightOFF + } + + if(discarg) { + LightUpON + } else { + LightUpOFF + } + } else {} +} \ No newline at end of file
diff -r 101340a22746 -r 1c9acd3b224d vibro.c --- a/vibro.c Wed Feb 03 14:48:02 2016 +0000 +++ b/vibro.c Thu Feb 04 10:21:57 2016 +0000 @@ -12,7 +12,7 @@ ///////////////////////////////////////////////////////////////////////////// /////////////////////////инициализация вибропривода////////////////////////// ///////////////////////////////////////////////////////////////////////////// -unsigned int init_Vibro () +void init_Vibro () { Main.FrqRate=40; Main.FrqMin=380; @@ -29,7 +29,6 @@ // Output.Str.T_Vibro=40; //LPC_GPIO0->FIOSET |= (1<<5); */ - return 0; }
diff -r 101340a22746 -r 1c9acd3b224d vibro.h --- a/vibro.h Wed Feb 03 14:48:02 2016 +0000 +++ b/vibro.h Thu Feb 04 10:21:57 2016 +0000 @@ -13,52 +13,71 @@ #define ClrV2 LPC_GPIO1->FIOSET = (1<<28); #define SetV2 LPC_GPIO1->FIOCLR = (1<<28); -#define LoopOn LPC_GPIO1->FIOSET = (1<<30); -#define LoopOff LPC_GPIO1->FIOCLR = (1<<30); -#define StartV1 0 -#define StartV2 15 +#define LoopOn LPC_GPIO1->FIOSET = (1<<30); +#define LoopOff LPC_GPIO1->FIOCLR = (1<<30); +#define StartV1 0 +#define StartV2 15 #define TIME_INTERVAL (7812) - struct MAIN { +struct MAIN { + + unsigned int RgConA; + unsigned int RgConB; + + + unsigned int Frq; // Непосредственное значение частоты для таймера. + unsigned int FrqHZ; // Частота в Гц. + unsigned int FrqRate; // Разброс частот при ошумлении. + unsigned int FrqMin; // Минимальное значение ошумленной частоты. + unsigned int FrqOld; // Значение частоты за прошлый такт. + + unsigned int Amp; + unsigned int AmpL; + unsigned int AmpT; + unsigned int AmpPer; + unsigned int AmpPerDel;//0-100% + unsigned int AmpN1; + unsigned int AmpN2; + unsigned int AmpMin; + unsigned int AmpTD; + + unsigned int CMD_In; + unsigned int SOC_Out; + unsigned int My_Addres; + unsigned int GLD_Serial; + unsigned int CRC; + unsigned int Firmware_Version; + unsigned int RsErrLine; + + unsigned int Cnt_Pls; + unsigned int Cnt_Mns; + unsigned int Cnt_Dif; + unsigned int T_Vib; + unsigned int F_ras; + + unsigned int PinReg; // bit5 bit4 bit 3 bit1 bit0 + unsigned int PinRegOld; // || светодиод || состояние поджига || состояние подсветки || состояние вибро 2 || состояние вибро 1 || + #define PinRegBitD 1<<8 + #define PinRegBitL 1<<4 + #define PinRegBit_1V 1<<1 + #define PinRegBit_2V 1<<2 + + + + + unsigned int Discharg; // последовательность бит харрактеризующая ворму сигнала поджига. + #define StartDischarg 0x00000005 - unsigned int RgConA; - unsigned int RgConB; - - - unsigned int Frq; // Непосредственное значение частоты для таймера. - unsigned int FrqHZ; // Частота в Гц. - unsigned int FrqRate; // Разброс частот при ошумлении. - unsigned int FrqMin; // Минимальное значение ошумленной частоты. - unsigned int FrqOld; // Значение частоты за прошлый такт. - - unsigned int Amp; - unsigned int AmpL; - unsigned int AmpT; - unsigned int AmpPer; - unsigned int AmpPerDel;//0-100% - unsigned int AmpN1; - unsigned int AmpN2; - unsigned int AmpMin; - unsigned int AmpTD; - - unsigned int CMD_In; - unsigned int SOC_Out; - unsigned int My_Addres; - unsigned int GLD_Serial; - unsigned int CRC; - unsigned int Firmware_Version; - unsigned int RsErrLine; - - unsigned int Cnt_Pls; - unsigned int Cnt_Mns; - unsigned int Cnt_Dif; - unsigned int T_Vib; - unsigned int F_ras; + + unsigned int BackLight; // последовательность бит харрактеризующая ворму сигнала подсветки. + + + }; extern struct MAIN Main; -extern unsigned int init_Vibro (); +extern void init_Vibro (); extern void cheng(void); extern void Noise(void); extern void VibroOut(void);