Rev 173 | Rev 1111 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 173 | Rev 918 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /*############################################################################ |
1 | /*############################################################################ |
2 | ############################################################################*/ |
2 | ############################################################################*/ |
Line 3... | Line 3... | ||
3 | 3 | ||
Line 4... | Line 4... | ||
4 | #include "main.h" |
4 | #include "main.h" |
5 | 5 | ||
6 | unsigned char twi_state = 0; |
6 | volatile unsigned char twi_state = 0; |
7 | unsigned char motor = 0; |
7 | unsigned char motor = 0; |
Line 8... | Line 8... | ||
8 | unsigned char motorread = 0; |
8 | unsigned char motorread = 0; |
Line 145... | Line 145... | ||
145 | motorread++; |
145 | motorread++; |
146 | if (motorread>3) motorread=0; |
146 | if (motorread>3) motorread=0; |
147 | i2c_stop(); |
147 | i2c_stop(); |
148 | I2CTimeout = 10; |
148 | I2CTimeout = 10; |
149 | twi_state = 0; |
149 | twi_state = 0; |
- | 150 | break; |
|
- | 151 | case 8: // Gyro-Offset |
|
- | 152 | i2c_write_byte(0x98); // Address of the DAC |
|
- | 153 | break; |
|
- | 154 | case 9: |
|
- | 155 | i2c_write_byte(0x10); // Update Channel A |
|
- | 156 | break; |
|
- | 157 | case 10: |
|
- | 158 | i2c_write_byte(AnalogOffsetNick); // Value |
|
- | 159 | break; |
|
- | 160 | case 11: |
|
- | 161 | i2c_write_byte(0x80); // Value |
|
- | 162 | break; |
|
- | 163 | case 12: |
|
- | 164 | i2c_stop(); |
|
- | 165 | I2CTimeout = 10; |
|
- | 166 | i2c_start(); |
|
- | 167 | break; |
|
- | 168 | case 13: |
|
- | 169 | i2c_write_byte(0x98); // Address of the DAC |
|
- | 170 | break; |
|
- | 171 | case 14: |
|
- | 172 | i2c_write_byte(0x12); // Update Channel B |
|
- | 173 | break; |
|
- | 174 | case 15: |
|
- | 175 | i2c_write_byte(AnalogOffsetRoll); // Value |
|
- | 176 | break; |
|
- | 177 | case 16: |
|
- | 178 | i2c_write_byte(0x80); // Value |
|
- | 179 | break; |
|
- | 180 | case 17: |
|
- | 181 | i2c_stop(); |
|
- | 182 | I2CTimeout = 10; |
|
- | 183 | i2c_start(); |
|
- | 184 | break; |
|
- | 185 | case 18: |
|
- | 186 | i2c_write_byte(0x98); // Address of the DAC |
|
- | 187 | break; |
|
- | 188 | case 19: |
|
- | 189 | i2c_write_byte(0x14); // Update Channel C |
|
- | 190 | break; |
|
- | 191 | case 20: |
|
- | 192 | i2c_write_byte(AnalogOffsetGier); // Value |
|
- | 193 | break; |
|
- | 194 | case 21: |
|
- | 195 | i2c_write_byte(0x80); // Value |
|
- | 196 | break; |
|
- | 197 | case 22: |
|
- | 198 | i2c_stop(); |
|
- | 199 | I2CTimeout = 10; |
|
- | 200 | twi_state = 0; |
|
- | 201 | break; |
|
150 | } |
202 | } |
151 | TWCR |= 0x80; |
203 | TWCR |= 0x80; |
152 | } |
204 | } |