Browse Source
started adding ledring stuff (yawn). found out i2c was broken, stopped.
started adding ledring stuff (yawn). found out i2c was broken, stopped.
default rc input is now pwm (non-nerds won) added deadband to config git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@110 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61master
timecop
13 years ago
8 changed files with 109 additions and 23 deletions
-
42baseflight.uvopt
-
10baseflight.uvproj
-
2src/board.h
-
7src/config.c
-
53src/drv_ledring.c
-
5src/drv_ledring.h
-
12src/mw.c
-
1src/mw.h
@ -0,0 +1,53 @@ |
|||
#include "board.h" |
|||
#include "mw.h" |
|||
|
|||
// Driver for DFRobot I2C Led Ring |
|||
#define LED_RING_ADDRESS 0x6D |
|||
|
|||
bool ledringDetect(void) |
|||
{ |
|||
bool ack = false; |
|||
uint8_t sig = 'e'; |
|||
|
|||
ack = 0; // i2cWrite(LED_RING_ADDRESS, 0xFF, 1, &sig); |
|||
if (!ack) |
|||
return false; |
|||
return true; |
|||
} |
|||
|
|||
void ledringState(void) |
|||
{ |
|||
uint8_t b[10]; |
|||
static uint8_t state; |
|||
|
|||
if (state == 0) { |
|||
b[0] = 'z'; |
|||
b[1] = (180 - heading) / 2; // 1 unit = 2 degrees; |
|||
// i2cWrite(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); |
|||
state = 2; |
|||
} else if (state == 2) { |
|||
b[0] = 'd'; // all unicolor GREEN |
|||
b[1] = 1; |
|||
if (armed) |
|||
b[2] = 1; |
|||
else |
|||
b[2] = 0; |
|||
// i2cWrite(LED_RING_ADDRESS, 0xFF, 3, b); |
|||
state = 0; |
|||
} |
|||
} |
|||
|
|||
void ledringBlink(void) |
|||
{ |
|||
uint8_t b[3]; |
|||
b[0] = 'k'; |
|||
b[1] = 10; |
|||
b[2] = 10; |
|||
// i2cWrite(LED_RING_ADDRESS, 0xFF, 3, b); |
|||
} |
@ -0,0 +1,5 @@ |
|||
#pragma once |
|||
|
|||
bool ledringDetect(void); |
|||
void ledringState(void); |
|||
void ledringBlink(void); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue