mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 00:05:33 +03:00
added i2cWriteBuffer() for ledring stuff
fixed ledring stuff fixed mag orientation (thanks GrootWitBaas) git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@111 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
6e88b8ae30
commit
204d25d491
5 changed files with 53 additions and 33 deletions
|
@ -9,7 +9,7 @@ bool ledringDetect(void)
|
|||
bool ack = false;
|
||||
uint8_t sig = 'e';
|
||||
|
||||
ack = 0; // i2cWrite(LED_RING_ADDRESS, 0xFF, 1, &sig);
|
||||
ack = i2cWrite(LED_RING_ADDRESS, 0xFF, sig);
|
||||
if (!ack)
|
||||
return false;
|
||||
return true;
|
||||
|
@ -23,13 +23,13 @@ void ledringState(void)
|
|||
if (state == 0) {
|
||||
b[0] = 'z';
|
||||
b[1] = (180 - heading) / 2; // 1 unit = 2 degrees;
|
||||
// i2cWrite(LED_RING_ADDRESS, 0xFF, 2, b);
|
||||
i2cWriteBuffer(LED_RING_ADDRESS, 0xFF, 2, b);
|
||||
state = 1;
|
||||
} else if (state == 1) {
|
||||
b[0] = 'y';
|
||||
b[1] = constrain(angle[ROLL] / 10 + 90, 0, 180);
|
||||
b[2] = constrain(angle[PITCH] / 10 + 90, 0, 180);
|
||||
// i2cWrite(LED_RING_ADDRESS, 0xFF, 3, b);
|
||||
i2cWriteBuffer(LED_RING_ADDRESS, 0xFF, 3, b);
|
||||
state = 2;
|
||||
} else if (state == 2) {
|
||||
b[0] = 'd'; // all unicolor GREEN
|
||||
|
@ -38,7 +38,7 @@ void ledringState(void)
|
|||
b[2] = 1;
|
||||
else
|
||||
b[2] = 0;
|
||||
// i2cWrite(LED_RING_ADDRESS, 0xFF, 3, b);
|
||||
i2cWriteBuffer(LED_RING_ADDRESS, 0xFF, 3, b);
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
|
@ -49,5 +49,5 @@ void ledringBlink(void)
|
|||
b[0] = 'k';
|
||||
b[1] = 10;
|
||||
b[2] = 10;
|
||||
// i2cWrite(LED_RING_ADDRESS, 0xFF, 3, b);
|
||||
i2cWriteBuffer(LED_RING_ADDRESS, 0xFF, 3, b);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue