Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1464 → Rev 1465

/branches/V0.76g-acid/servoboard/servoboard.c
11,11 → 11,12
uint8_t eeprom_neutral_pos[6] EEMEM;
uint16_t eeprom_pwm_limit[6] EEMEM;
 
volatile uint8_t pwm_signal[6];
volatile uint8_t pwm_neutral_position[6];
volatile uint8_t pwm_position[6];
volatile uint16_t pwm_limit[6];
volatile uint8_t pwm_active;
uint8_t pwm_signal[6];
uint8_t pwm_neutral_position[6];
uint8_t pwm_position[6];
uint16_t pwm_limit[6];
uint8_t pwm_active;
uint8_t pwm_status = 1;
 
 
void pwm_init() {
61,11 → 62,11
 
// check if pwm is configured
pwm_active = (pwm_limit[0] != 0xffff) ? (1 << SERVO1) : 0;
pwm_active |= (pwm_limit[1] != 0xffff) ? (2 << SERVO1) : 0;
pwm_active |= (pwm_limit[2] != 0xffff) ? (3 << SERVO1) : 0;
pwm_active |= (pwm_limit[3] != 0xffff) ? (4 << SERVO1) : 0;
pwm_active |= (pwm_limit[4] != 0xffff) ? (5 << SERVO1) : 0;
pwm_active |= (pwm_limit[5] != 0xffff) ? (6 << SERVO1) : 0;
pwm_active |= (pwm_limit[1] != 0xffff) ? (1 << SERVO2) : 0;
pwm_active |= (pwm_limit[2] != 0xffff) ? (1 << SERVO3) : 0;
pwm_active |= (pwm_limit[3] != 0xffff) ? (1 << SERVO4) : 0;
pwm_active |= (pwm_limit[4] != 0xffff) ? (1 << SERVO5) : 0;
pwm_active |= (pwm_limit[5] != 0xffff) ? (1 << SERVO6) : 0;
 
}
 
130,14 → 131,21
if (pwm_active == 0) { // not configured
 
blink = 50;
pwm_status = 1;
 
} else {
 
if (I2C_timeout == 0) { // no i2c signal
blink = 0;
pwm_status = 2;
} else {
I2C_timeout--;
if (I2C_timeout == 0) {
set_pwm_neutral();
set_pwm();
}
blink = 5;
pwm_status = 0;
}
 
}
/branches/V0.76g-acid/servoboard/servoboard.h
1,11 → 1,12
 
 
#define VERSION "0.3"
#define VERSION "0.32"
 
extern volatile uint8_t pwm_position[6];
extern volatile uint8_t pwm_neutral_position[6];
extern volatile uint16_t pwm_limit[6];
extern volatile uint8_t pwm_active;
extern uint8_t pwm_position[6];
extern uint8_t pwm_neutral_position[6];
extern uint16_t pwm_limit[6];
extern uint8_t pwm_active;
extern uint8_t pwm_status;
 
 
void set_pwm();
/branches/V0.76g-acid/servoboard/twislave.c
33,7 → 33,7
Byte_Counter = 0;
return;
case SR_PREV_ACK:
I2C_timeout = 5;
I2C_timeout = 3;
if (Byte_Counter < 32) {
I2C_RXBuffer[Byte_Counter++] = TWDR;
}
/branches/V0.76g-acid/servoboard/uart.c
12,6 → 12,7
uint8_t rx_pos, tx_pos;
uint8_t current_servo = 0;
 
 
void uart_init() {
 
rx_pos = 0;