![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LGstaandart by
pin.c@208:19150d2b528f, 2017-02-07 (annotated)
- Committer:
- Kovalev_D
- Date:
- Tue Feb 07 10:11:35 2017 +0000
- Revision:
- 208:19150d2b528f
- Parent:
- 205:775d54fdf646
- Child:
- 209:224e7331a061
465
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kovalev_D | 28:1c9acd3b224d | 1 | #include "Global.h" |
Kovalev_D | 208:19150d2b528f | 2 | int Try=0,TimeDischarg=0; |
Kovalev_D | 208:19150d2b528f | 3 | int Light=0; |
Kovalev_D | 28:1c9acd3b224d | 4 | void PinCheng(void) |
Kovalev_D | 28:1c9acd3b224d | 5 | { |
Kovalev_D | 40:8a6494f61326 | 6 | //================ блок управления ногой поджига====================== |
Kovalev_D | 40:8a6494f61326 | 7 | if((Gyro.PinReg & PinRegBitD) != (Gyro.PinRegOld & PinRegBitD)) {//если текушее состояние бита поджига в регистре ног отличается от предыдущего то: |
Kovalev_D | 40:8a6494f61326 | 8 | if(Gyro.PinReg & PinRegBitD) LightUpON else LightUpOFF//если бита поджига еденица то включить поджиг если 0 отключить |
Kovalev_D | 40:8a6494f61326 | 9 | } |
igor_v | 42:6fc307c4963e | 10 | |
Kovalev_D | 40:8a6494f61326 | 11 | //============= блок управления подсветкой====================== |
Kovalev_D | 40:8a6494f61326 | 12 | if((Gyro.PinReg & PinRegBitL) != (Gyro.PinRegOld & PinRegBitL)) { |
Kovalev_D | 40:8a6494f61326 | 13 | if(Gyro.PinReg & PinRegBitL) BackLightON else BackLightOFF |
Kovalev_D | 40:8a6494f61326 | 14 | } |
Kovalev_D | 203:3a6615de9581 | 15 | /* |
Kovalev_D | 40:8a6494f61326 | 16 | //============= блок управления вибро нога 1====================== |
Kovalev_D | 40:8a6494f61326 | 17 | if((Gyro.PinReg & PinRegBit_1V) != (Gyro.PinRegOld & PinRegBit_1V)) { |
Kovalev_D | 47:d902ef6f7564 | 18 | if(Gyro.PinReg & PinRegBit_1V) ClrV1 else SetV1 |
Kovalev_D | 40:8a6494f61326 | 19 | } |
igor_v | 42:6fc307c4963e | 20 | |
Kovalev_D | 40:8a6494f61326 | 21 | //============= блок управления вибро нога 2====================== |
Kovalev_D | 40:8a6494f61326 | 22 | if((Gyro.PinReg & PinRegBit_2V) != (Gyro.PinRegOld & PinRegBit_2V)) { |
Kovalev_D | 47:d902ef6f7564 | 23 | if(Gyro.PinReg & PinRegBit_2V) ClrV2 else SetV2 |
Kovalev_D | 40:8a6494f61326 | 24 | } |
Kovalev_D | 188:4c523cc373cc | 25 | */ |
Kovalev_D | 47:d902ef6f7564 | 26 | |
Kovalev_D | 47:d902ef6f7564 | 27 | if((Gyro.PinReg & PinRegBitTXE) != (Gyro.PinRegOld & PinRegBitTXE)) { |
Kovalev_D | 47:d902ef6f7564 | 28 | if(Gyro.PinReg & PinRegBitTXE) TXOn else TXOff |
Kovalev_D | 47:d902ef6f7564 | 29 | } |
Kovalev_D | 190:289514f730ee | 30 | Gyro.PinRegOld = Gyro.PinReg; //сохранение текущего регистра как старого для следующего такта сравнения. |
Kovalev_D | 190:289514f730ee | 31 | } |
Kovalev_D | 190:289514f730ee | 32 | |
Kovalev_D | 28:1c9acd3b224d | 33 | |
Kovalev_D | 190:289514f730ee | 34 | void Discharg ()//проверка битового поля поджига и установка значения бита поджига |
Kovalev_D | 208:19150d2b528f | 35 | { |
Kovalev_D | 208:19150d2b528f | 36 | /* sprintf((Time),"%d %d\r\n",Gyro.RgConA, Gyro.RgConB); |
Kovalev_D | 208:19150d2b528f | 37 | WriteCon(Time); */ |
Kovalev_D | 208:19150d2b528f | 38 | |
Kovalev_D | 190:289514f730ee | 39 | if (Gyro.Discharg) |
Kovalev_D | 208:19150d2b528f | 40 | { |
Kovalev_D | 208:19150d2b528f | 41 | Spi.DAC_A = GyroP.Str.DAC_current_Start; |
Kovalev_D | 208:19150d2b528f | 42 | Gyro.Discharg = Gyro.Discharg >> 1; |
Kovalev_D | 208:19150d2b528f | 43 | Gyro.RgConA = 0x0000; |
Kovalev_D | 208:19150d2b528f | 44 | Gyro.RgConB = 0x0000; |
Kovalev_D | 190:289514f730ee | 45 | //Проверка здвигового поля(последовательности) поджига |
Kovalev_D | 190:289514f730ee | 46 | //если последний бит 1 то установить бит поджига в еденицу, иначе в 0; |
Kovalev_D | 208:19150d2b528f | 47 | if (Gyro.Discharg & 0x1) Gyro.PinReg |= PinRegBitD; |
Kovalev_D | 208:19150d2b528f | 48 | else Gyro.PinReg &= ~PinRegBitD; |
Kovalev_D | 190:289514f730ee | 49 | } |
Kovalev_D | 208:19150d2b528f | 50 | else if(TimeDischarg<3) |
Kovalev_D | 208:19150d2b528f | 51 | { |
Kovalev_D | 208:19150d2b528f | 52 | TimeDischarg++; |
Kovalev_D | 208:19150d2b528f | 53 | if(TimeDischarg==1) |
Kovalev_D | 208:19150d2b528f | 54 | { |
Kovalev_D | 208:19150d2b528f | 55 | if (Spi.ADC5>25000) |
Kovalev_D | 208:19150d2b528f | 56 | { |
Kovalev_D | 208:19150d2b528f | 57 | if (Try<10) |
Kovalev_D | 208:19150d2b528f | 58 | { |
Kovalev_D | 208:19150d2b528f | 59 | Gyro.Discharg = StartDischarg << ShiftStart0; |
Kovalev_D | 208:19150d2b528f | 60 | Gyro.BackLight = StartBackLight << ShiftStart0; |
Kovalev_D | 208:19150d2b528f | 61 | TimeDischarg=0; |
Kovalev_D | 208:19150d2b528f | 62 | Try++; |
Kovalev_D | 208:19150d2b528f | 63 | } |
Kovalev_D | 208:19150d2b528f | 64 | } |
Kovalev_D | 208:19150d2b528f | 65 | else |
Kovalev_D | 208:19150d2b528f | 66 | { |
Kovalev_D | 208:19150d2b528f | 67 | Spi.DAC_A = GyroP.Str.DAC_current_Work; |
Kovalev_D | 208:19150d2b528f | 68 | Gyro.LaserOn=1; |
Kovalev_D | 208:19150d2b528f | 69 | Gyro.RgConA = 0xffff; |
Kovalev_D | 208:19150d2b528f | 70 | Gyro.RgConB = 0xffff; |
Kovalev_D | 208:19150d2b528f | 71 | TimeDischarg=5; |
Kovalev_D | 208:19150d2b528f | 72 | Try=0; |
Kovalev_D | 208:19150d2b528f | 73 | } |
Kovalev_D | 208:19150d2b528f | 74 | } |
Kovalev_D | 208:19150d2b528f | 75 | } |
Kovalev_D | 208:19150d2b528f | 76 | else |
Kovalev_D | 208:19150d2b528f | 77 | { |
Kovalev_D | 208:19150d2b528f | 78 | /* if(Spi.ADC5>30000) { Gyro.LaserOn=0; Gyro.RgConA = 0x0; Gyro.RgConB = 0x0;} |
Kovalev_D | 208:19150d2b528f | 79 | else |
Kovalev_D | 208:19150d2b528f | 80 | { |
Kovalev_D | 208:19150d2b528f | 81 | //Gyro.RgConA = 0xffff; |
Kovalev_D | 208:19150d2b528f | 82 | // Gyro.RgConB = 0xffff; |
Kovalev_D | 208:19150d2b528f | 83 | Gyro.LaserOn=1; |
Kovalev_D | 208:19150d2b528f | 84 | Try=0; |
Kovalev_D | 208:19150d2b528f | 85 | }*/ |
Kovalev_D | 208:19150d2b528f | 86 | } |
Kovalev_D | 190:289514f730ee | 87 | } |
Kovalev_D | 190:289514f730ee | 88 | void BackLight () |
Kovalev_D | 190:289514f730ee | 89 | { |
Kovalev_D | 190:289514f730ee | 90 | if (Gyro.BackLight) |
Kovalev_D | 208:19150d2b528f | 91 | { Gyro.BackLight = Gyro.BackLight >> 1; |
Kovalev_D | 190:289514f730ee | 92 | //Проверка здвигового поля(последовательности) подсветки |
Kovalev_D | 190:289514f730ee | 93 | //если последний бит в битовом поле 1 то установить бит подсветки в еденицу, иначе в 0; |
Kovalev_D | 208:19150d2b528f | 94 | if (Gyro.BackLight & 0x1) Gyro.PinReg |= PinRegBitL; else Gyro.PinReg &= ~PinRegBitL; |
Kovalev_D | 208:19150d2b528f | 95 | } |
Kovalev_D | 28:1c9acd3b224d | 96 | } |