Mercurial > public > hwos_code
comparison src/i2c.asm @ 158:683321c09cfa
nicer boot into surfacemode
author | heinrichsweikamp |
---|---|
date | Thu, 04 Sep 2014 17:40:24 +0200 |
parents | f3062a611eef |
children | 30ebaf72170d |
comparison
equal
deleted
inserted
replaced
157:5ee76921e359 | 158:683321c09cfa |
---|---|
122 I2C_RX_accelerometer: | 122 I2C_RX_accelerometer: |
123 bsf SSP1CON2,SEN ; Start condition | 123 bsf SSP1CON2,SEN ; Start condition |
124 rcall WaitMSSP | 124 rcall WaitMSSP |
125 movlw 0x38 ; address | 125 movlw 0x38 ; address |
126 rcall I2C_TX | 126 rcall I2C_TX |
127 movlw 0x01 | 127 movlw 0x00 |
128 rcall I2C_TX | 128 rcall I2C_TX |
129 bsf SSP1CON2,RSEN ; Repeated start condition (!) | 129 bsf SSP1CON2,RSEN ; Repeated start condition (!) |
130 rcall WaitMSSP | 130 rcall WaitMSSP |
131 movlw 0x39 ; address | 131 movlw 0x39 ; address |
132 rcall I2C_TX | 132 rcall I2C_TX |
133 | |
134 rcall I2C_OneByteRX ; Get Status Byte | |
135 movf SSP1BUF,W | |
133 | 136 |
134 ; Chip orientation on the PCB requires | 137 ; Chip orientation on the PCB requires |
135 ; Original = Corrected | 138 ; Original = Corrected |
136 ; x = -x | 139 ; x = -x |
137 ; y = -y | 140 ; y = -y |
138 ; z = -z | 141 ; z = -z |
139 | |
140 | 142 |
141 rcall I2C_TwoBytesRX_div16 ; Get two bytes and devide /16 (signed) | 143 rcall I2C_TwoBytesRX_div16 ; Get two bytes and devide /16 (signed) |
142 comf hi ; 16bit sign change. | 144 comf hi ; 16bit sign change. |
143 negf lo | 145 negf lo |
144 btfsc STATUS,C ; Carry to propagate ? | 146 btfsc STATUS,C ; Carry to propagate ? |