Mercurial > public > hwos_code
comparison src/sleepmode.asm @ 491:66b9b8c082a9
minor new sleepmode fix
author | heinrichsweikamp |
---|---|
date | Thu, 30 Mar 2017 10:41:43 +0200 |
parents | 8dfb93e80338 |
children | beeac8806b93 |
comparison
equal
deleted
inserted
replaced
490:8dfb93e80338 | 491:66b9b8c082a9 |
---|---|
62 bsf power_sw2 | 62 bsf power_sw2 |
63 movlw .4 ; Wait for button circuity | 63 movlw .4 ; Wait for button circuity |
64 movwf apnoe_max_pressure+0 ; Used as temp | 64 movwf apnoe_max_pressure+0 ; Used as temp |
65 bcf onesecupdate | 65 bcf onesecupdate |
66 sleeploop_pre1: | 66 sleeploop_pre1: |
67 sleep | 67 rcall sleepmode_sleep |
68 sleep | |
69 btfss onesecupdate ; Wait 1 second | 68 btfss onesecupdate ; Wait 1 second |
70 bra sleeploop_pre1 | 69 bra sleeploop_pre1 |
71 bcf onesecupdate | 70 bcf onesecupdate |
72 decfsz apnoe_max_pressure+0,F | 71 decfsz apnoe_max_pressure+0,F |
73 bra sleeploop_pre1 | 72 bra sleeploop_pre1 |
100 btfss sleepmode ; wake up? (This bit will be set in other routines) | 99 btfss sleepmode ; wake up? (This bit will be set in other routines) |
101 goto restart ; yes | 100 goto restart ; yes |
102 | 101 |
103 btfsc deep_sleep ; Enter deep sleep? | 102 btfsc deep_sleep ; Enter deep sleep? |
104 bra deepsleep ; Yes | 103 bra deepsleep ; Yes |
105 | 104 no_deepsleep: |
105 | |
106 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup) | 106 rcall sleepmode_sleep ; Wait at least 35ms (every 62,5ms Timer7 wakeup) |
107 | 107 |
108 ; Any button pressed in sleep? | 108 ; Any button pressed in sleep? |
109 ; btfsc switch_left | 109 ; btfsc switch_left |
110 ; rcall onesec_sleep1a | 110 ; rcall onesec_sleep1a |
116 | 116 |
117 bra sleeploop_loop ; do loop until someting happens | 117 bra sleeploop_loop ; do loop until someting happens |
118 | 118 |
119 deepsleep: | 119 deepsleep: |
120 btfss analog_switches | 120 btfss analog_switches |
121 return ; no analog switches | 121 bra no_deepsleep ; no analog switches, no deep sleep required |
122 | 122 |
123 bcf PIE1,0 ; Stop Timer 1 Interrupt | 123 bcf PIE1,0 ; Stop Timer 1 Interrupt |
124 bcf PIE2,1 ; Stop Timer 2 Interrupt | 124 bcf PIE2,1 ; Stop Timer 2 Interrupt |
125 bcf PIE5,3 ; Stop Timer 7 Interrupt | 125 bcf PIE5,3 ; Stop Timer 7 Interrupt |
126 bcf INTCON,4 ; Stop INT0 Interrupt | 126 bcf INTCON,4 ; Stop INT0 Interrupt |
135 rcall onesec_deepsleep ; check accelerometer | 135 rcall onesec_deepsleep ; check accelerometer |
136 | 136 |
137 btfsc onesecupdate ; one second in sleep? | 137 btfsc onesecupdate ; one second in sleep? |
138 rcall onesec_sleep ; check switches, check pressure sensor, etc. | 138 rcall onesec_sleep ; check switches, check pressure sensor, etc. |
139 | 139 |
140 sleep | 140 rcall sleepmode_sleep |
141 | 141 |
142 btfss deep_sleep ; Enter normal sleepmode? | 142 btfss deep_sleep ; Enter normal sleepmode? |
143 bra sleeploop_pre ; Yes | 143 bra sleeploop_pre ; Yes |
144 | 144 |
145 bra deepsleep_loop ; do loop until someting happens | 145 bra deepsleep_loop ; do loop until someting happens |