Mercurial > public > hwos_code
diff src/i2c.asm @ 20:9b7dd3103545
minor cleanup
author | heinrichsweikamp |
---|---|
date | Wed, 03 Jul 2013 23:19:57 +0200 |
parents | 4e3f133dfbf4 |
children | f3062a611eef |
line wrap: on
line diff
--- a/src/i2c.asm Wed Jul 03 11:51:46 2013 +0200 +++ b/src/i2c.asm Wed Jul 03 23:19:57 2013 +0200 @@ -241,6 +241,20 @@ ; movlw b'01101001' ; ConfigA: 3Hz, 8 Samples averaged, Test Mode (Positive Bias) movlw b'01101000' ; ConfigA: 3Hz, 8 Samples averaged rcall I2C_TX + bra I2C_init_compass_common + + global I2C_init_compass_fast +I2C_init_compass_fast: + bsf SSP1CON2,SEN ; Start condition + rcall WaitMSSP + movlw 0x3C ; address + rcall I2C_TX + movlw 0x00 + rcall I2C_TX + movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged +; movlw b'00111001' ; ConfigA: 75Hz, 2 Samples averaged, Test Mode (Positive Bias) + rcall I2C_TX +I2C_init_compass_common: movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) swapf i2c_temp,F comf i2c_temp,F @@ -256,33 +270,6 @@ bsf compass_enabled return - global I2C_init_compass_fast -I2C_init_compass_fast: - bsf SSP1CON2,SEN ; Start condition - rcall WaitMSSP - movlw 0x3C ; address - rcall I2C_TX - movlw 0x00 - rcall I2C_TX - movlw b'00111000' ; ConfigA: 75Hz, 2 Samples averaged -; movlw b'00111001' ; ConfigA: 75Hz, 2 Samples averaged, Test Mode (Positive Bias) - rcall I2C_TX - movff opt_compass_gain,i2c_temp ; 0-7 (230LSB/Gauss to 1370LSB/Gaus) - swapf i2c_temp,F - comf i2c_temp,F - bcf STATUS,C - rlcf i2c_temp - movf i2c_temp,W - clrf i2c_temp - rcall I2C_TX - movlw b'00000000' ; Continous Mode - rcall I2C_TX - bsf SSP1CON2,PEN ; Stop condition - rcall WaitMSSP - bsf compass_enabled - return - - global I2C_sleep_compass I2C_sleep_compass: bsf SSP1CON2,SEN ; Start condition