New #define for AUX2
Posted: Sun Jan 15, 2012 10:06 pm
Hi,
I think for newbees that would be awesome to have an automatic config by using AUX2, not everyone dispose an PPM sum receiver.
The IMU boards are more and more used , the prices are sinking, so we don't need anymore the POWERPIN output.
BUZZERPIN is on the contrary usefull for low batt warning, buzzer or others signalings.
So I propose some #defines in the sketches to do this.
For those they have commercial boards, there are only 2 tracks to cut and solder wires.
in the fact:
- if we define RCAUXPIN8 ---> Buzzerpin is on D12
- if we define RCAUXPIN12 ---> Buzzerpin is on D8
- if all is commented ----------> Buzzerpin on D8 and Powerpin on D12
Here my modifs:
CONFIG.H :
........
/* possibility to use PIN8 or PIN12 as the AUX2 RC input
it activates in this case the BUZZER PIN on pin 12 or pin 8
POWERPIN no longer available
BUZZERPIN available for Low Batt Warning , buzzer, ...
*/
#define RCAUXPIN8
//#define RCAUXPIN12
........
DEF.H :
........
#if defined(PROMINI)
#if !defined(RCAUXPIN8) && !defined(RCAUXPIN12)
#define NO_AUX2
#endif
#define LEDPIN_PINMODE pinMode (13, OUTPUT);
#define LEDPIN_TOGGLE PINB |= 1<<5; //switch LEDPIN state (digital PIN 13)
#define LEDPIN_OFF PORTB &= ~(1<<5);
#define LEDPIN_ON PORTB |= (1<<5);
#if defined (NO_AUX2) // AUX1 ONLY, POWERPIN available
#define BUZZERPIN_PINMODE pinMode (8, OUTPUT);
#define BUZZERPIN_ON PORTB |= 1;
#define BUZZERPIN_OFF PORTB &= ~1;
#define POWERPIN_PINMODE pinMode (12, OUTPUT);
#define POWERPIN_ON PORTB |= 1<<4;
#define POWERPIN_OFF PORTB &= ~(1<<4); //switch OFF WMP, digital PIN 12
#endif
#define I2C_PULLUPS_ENABLE PORTC |= 1<<4; PORTC |= 1<<5; // PIN A4&A5 (SDA&SCL)
#define I2C_PULLUPS_DISABLE PORTC &= ~(1<<4); PORTC &= ~(1<<5);
......
......
#if defined(RCAUXPIN8) // BUZZERPIN on D12
#define BUZZERPIN_PINMODE pinMode (12, OUTPUT);
#define BUZZERPIN_ON PORTB |= 1<<4;
#define BUZZERPIN_OFF PORTB &= ~(1<<4);
#define RCAUXPIN
#endif
#if defined(RCAUXPIN12) // BUZZERPIN on D8
#define BUZZERPIN_PINMODE pinMode (8, OUTPUT);
#define BUZZERPIN_ON PORTB |= 1;
#define BUZZERPIN_OFF PORTB &= ~1;
#define RCAUXPIN
#endif
.......
MULTIWII.INO :
......
void setup() {
SerialOpen(0,115200);
LEDPIN_PINMODE;
BUZZERPIN_PINMODE;
STABLEPIN_PINMODE;
#if defined(NO_AUX2)
POWERPIN_PINMODE;
POWERPIN_OFF;
#endif
initOutput();
......
SENSORS.PDE :
......
void initSensors() {
#if defined(NO_AUX2)
delay(200);
POWERPIN_ON;
#endif
delay(100);
.....
Best regards
flyman777
I think for newbees that would be awesome to have an automatic config by using AUX2, not everyone dispose an PPM sum receiver.
The IMU boards are more and more used , the prices are sinking, so we don't need anymore the POWERPIN output.
BUZZERPIN is on the contrary usefull for low batt warning, buzzer or others signalings.
So I propose some #defines in the sketches to do this.
For those they have commercial boards, there are only 2 tracks to cut and solder wires.
in the fact:
- if we define RCAUXPIN8 ---> Buzzerpin is on D12
- if we define RCAUXPIN12 ---> Buzzerpin is on D8
- if all is commented ----------> Buzzerpin on D8 and Powerpin on D12
Here my modifs:
CONFIG.H :
........
/* possibility to use PIN8 or PIN12 as the AUX2 RC input
it activates in this case the BUZZER PIN on pin 12 or pin 8
POWERPIN no longer available
BUZZERPIN available for Low Batt Warning , buzzer, ...
*/
#define RCAUXPIN8
//#define RCAUXPIN12
........
DEF.H :
........
#if defined(PROMINI)
#if !defined(RCAUXPIN8) && !defined(RCAUXPIN12)
#define NO_AUX2
#endif
#define LEDPIN_PINMODE pinMode (13, OUTPUT);
#define LEDPIN_TOGGLE PINB |= 1<<5; //switch LEDPIN state (digital PIN 13)
#define LEDPIN_OFF PORTB &= ~(1<<5);
#define LEDPIN_ON PORTB |= (1<<5);
#if defined (NO_AUX2) // AUX1 ONLY, POWERPIN available
#define BUZZERPIN_PINMODE pinMode (8, OUTPUT);
#define BUZZERPIN_ON PORTB |= 1;
#define BUZZERPIN_OFF PORTB &= ~1;
#define POWERPIN_PINMODE pinMode (12, OUTPUT);
#define POWERPIN_ON PORTB |= 1<<4;
#define POWERPIN_OFF PORTB &= ~(1<<4); //switch OFF WMP, digital PIN 12
#endif
#define I2C_PULLUPS_ENABLE PORTC |= 1<<4; PORTC |= 1<<5; // PIN A4&A5 (SDA&SCL)
#define I2C_PULLUPS_DISABLE PORTC &= ~(1<<4); PORTC &= ~(1<<5);
......
......
#if defined(RCAUXPIN8) // BUZZERPIN on D12
#define BUZZERPIN_PINMODE pinMode (12, OUTPUT);
#define BUZZERPIN_ON PORTB |= 1<<4;
#define BUZZERPIN_OFF PORTB &= ~(1<<4);
#define RCAUXPIN
#endif
#if defined(RCAUXPIN12) // BUZZERPIN on D8
#define BUZZERPIN_PINMODE pinMode (8, OUTPUT);
#define BUZZERPIN_ON PORTB |= 1;
#define BUZZERPIN_OFF PORTB &= ~1;
#define RCAUXPIN
#endif
.......
MULTIWII.INO :
......
void setup() {
SerialOpen(0,115200);
LEDPIN_PINMODE;
BUZZERPIN_PINMODE;
STABLEPIN_PINMODE;
#if defined(NO_AUX2)
POWERPIN_PINMODE;
POWERPIN_OFF;
#endif
initOutput();
......
SENSORS.PDE :
......
void initSensors() {
#if defined(NO_AUX2)
delay(200);
POWERPIN_ON;
#endif
delay(100);
.....
Best regards
flyman777