Mercurial > public > hwos_code
comparison src/i2c.asm @ 20:9b7dd3103545
minor cleanup
author | heinrichsweikamp |
---|---|
date | Wed, 03 Jul 2013 23:19:57 +0200 |
parents | 4e3f133dfbf4 |
children | f3062a611eef |
comparison
equal
deleted
inserted
replaced
19:06e19a880df6 | 20:9b7dd3103545 |
---|---|
239 movlw 0x00 | 239 movlw 0x00 |
240 rcall I2C_TX | 240 rcall I2C_TX |
241 ; movlw b'01101001' ; ConfigA: 3Hz, 8 Samples averaged, Test Mode (Positive Bias) | 241 ; movlw b'01101001' ; ConfigA: 3Hz, 8 Samples averaged, Test Mode (Positive Bias) |
242 movlw b'01101000' ; ConfigA: 3Hz, 8 Samples averaged | 242 movlw b'01101000' ; ConfigA: 3Hz, 8 Samples averaged |
243 rcall I2C_TX | 243 rcall I2C_TX |
244 bra I2C_init_compass_common | |
245 | |
246 global I2C_init_compass_fast | |
247 I2C_init_compass_fast: | |
248 bsf SSP1CON2,SEN ; Start condition | |
249 rcall WaitMSSP | |
250 movlw 0x3C ; address | |
251 rcall I2C_TX | |
252 movlw 0x00 | |
253 rcall I2C_TX | |
254 movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged | |
255 ; movlw b'00111001' ; ConfigA: 75Hz, 2 Samples averaged, Test Mode (Positive Bias) | |
256 rcall I2C_TX | |
257 I2C_init_compass_common: | |
244 movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) | 258 movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) |
245 swapf i2c_temp,F | 259 swapf i2c_temp,F |
246 comf i2c_temp,F | 260 comf i2c_temp,F |
247 bcf STATUS,C | 261 bcf STATUS,C |
248 rlcf i2c_temp | 262 rlcf i2c_temp |
254 bsf SSP1CON2,PEN ; Stop condition | 268 bsf SSP1CON2,PEN ; Stop condition |
255 rcall WaitMSSP | 269 rcall WaitMSSP |
256 bsf compass_enabled | 270 bsf compass_enabled |
257 return | 271 return |
258 | 272 |
259 global I2C_init_compass_fast | |
260 I2C_init_compass_fast: | |
261 bsf SSP1CON2,SEN ; Start condition | |
262 rcall WaitMSSP | |
263 movlw 0x3C ; address | |
264 rcall I2C_TX | |
265 movlw 0x00 | |
266 rcall I2C_TX | |
267 movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged | |
268 ; movlw b'00111001' ; ConfigA: 75Hz, 2 Samples averaged, Test Mode (Positive Bias) | |
269 rcall I2C_TX | |
270 movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) | |
271 swapf i2c_temp,F | |
272 comf i2c_temp,F | |
273 bcf STATUS,C | |
274 rlcf i2c_temp | |
275 movf i2c_temp,W | |
276 clrf i2c_temp | |
277 rcall I2C_TX | |
278 movlw b'00000000' ; Continous Mode | |
279 rcall I2C_TX | |
280 bsf SSP1CON2,PEN ; Stop condition | |
281 rcall WaitMSSP | |
282 bsf compass_enabled | |
283 return | |
284 | |
285 | |
286 global I2C_sleep_compass | 273 global I2C_sleep_compass |
287 I2C_sleep_compass: | 274 I2C_sleep_compass: |
288 bsf SSP1CON2,SEN ; Start condition | 275 bsf SSP1CON2,SEN ; Start condition |
289 rcall WaitMSSP | 276 rcall WaitMSSP |
290 movlw 0x3C ; address | 277 movlw 0x3C ; address |