Rev 1511 | Rev 1528 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1511 | Rev 1512 | ||
|---|---|---|---|
| Line 97... | Line 97... | ||
| 97 | gpio_set_statement(OUTPUT_OFF, OUTPUT_PIN); |
97 | gpio_set_statement(OUTPUT_OFF, OUTPUT_PIN); |
| 98 | gpio_set_out(act_protectedOutput_OUTPUT_PIN); |
98 | gpio_set_out(act_protectedOutput_OUTPUT_PIN); |
| 99 | 99 | ||
| 100 | outputTargetState = OUTPUT_OFF; |
100 | outputTargetState = OUTPUT_OFF; |
| 101 | diagState = DIAG_NORMAL; |
101 | diagState = DIAG_NORMAL; |
| 102 | - | ||
| 103 | //obsolete: replaced polling by PCINT callback |
- | |
| 104 | //Timer_SetTimeout(act_protectedOutput_DIAG_POLL_TIMER, act_protectedOutput_DIAG_POLL_TIMER_TIME_MS, TimerTypeFreeRunning, 0); |
- | |
| 105 | } |
102 | } |
| 106 | 103 | ||
| 107 | 104 | ||
| 108 | void act_protectedOutput_Process() { |
105 | void act_protectedOutput_Process() { |
| 109 | #if 0 |
- | |
| 110 | if (Timer_Expired(act_protectedOutput_DIAG_POLL_TIMER)) { |
- | |
| 111 | // time to poll DIAG pin |
- | |
| 112 | readDiagPin(); |
- | |
| 113 | updateOutput(); |
- | |
| 114 | if (diagState == DIAG_ASSERTED) { |
- | |
| 115 | // if DIAG was asserted, init retry timer |
- | |
| 116 | if (act_protectedOutput_RETRY_TIMER_TIME_S > 0) { |
- | |
| 117 | Timer_SetTimeout(act_protectedOutput_RETRY_TIMER, act_protectedOutput_RETRY_TIMER_TIME_S*1000, TimerTypeOneShot, 0); |
- | |
| 118 | } |
- | |
| 119 | } |
- | |
| 120 | } |
- | |
| 121 | #endif |
- | |
| 122 | 106 | ||
| 123 | // shall we retry to set target output state? |
107 | // shall we retry to set target output state? |
| 124 | if (Timer_Expired(act_protectedOutput_RETRY_TIMER)) { |
108 | if (Timer_Expired(act_protectedOutput_RETRY_TIMER)) { |
| 125 | // read DIAG pin again and update outputs accordingly |
109 | // read DIAG pin again and update outputs accordingly |
| 126 | readDiagPin(); |
110 | readDiagPin(); |
| 127 | updateOutput(); |
111 | updateOutput(); |
| - | 112 | if (diagState == DIAG_ASSERTED) { |
|
| 128 | // if DIAG was still asserted, initiate another timer run |
113 | // if DIAG was still asserted, initiate another timer run |
| 129 | Timer_SetTimeout(act_protectedOutput_RETRY_TIMER, act_protectedOutput_RETRY_TIMER_TIME_S*1000, TimerTypeOneShot, 0); |
114 | Timer_SetTimeout(act_protectedOutput_RETRY_TIMER, act_protectedOutput_RETRY_TIMER_TIME_S*1000, TimerTypeOneShot, 0); |
| - | 115 | } |
|
| - | 116 | else { |
|
| - | 117 | // things went back to normal. report this |
|
| - | 118 | diagReportPending = 1; |
|
| - | 119 | } |
|
| 130 | } |
120 | } |
| 131 | 121 | ||
| 132 | // shall we report diag status to CAN? |
122 | // shall we report diag status to CAN? |
| 133 | if (diagReportPending) { |
123 | if (diagReportPending) { |
| 134 | StdCan_Msg_t txMsg; |
124 | StdCan_Msg_t txMsg; |