Skip to content

Commit

Permalink
hardware config for the m9912 copter
Browse files Browse the repository at this point in the history
  • Loading branch information
stawel committed Apr 25, 2016
1 parent 7f3e2d7 commit 4549a1e
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 43 deletions.
6 changes: 3 additions & 3 deletions OpenMicro/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// battery saver
// do not start software if battery is too low
// flashes 2 times repeatedly at startup
#define STOP_LOWBATTERY
//#define STOP_LOWBATTERY

// under this voltage the software will not start
// if STOP_LOWBATTERY is defined above
Expand Down Expand Up @@ -125,8 +125,8 @@

// Radio protocol selection
// select only one
#define RX_CG023_PROTOCOL
//#define RX_H7_PROTOCOL
//#define RX_CG023_PROTOCOL
#define RX_H7_PROTOCOL
//#define RX_BAYANG_PROTOCOL
//#define RX_CX10BLUE_PROTOCOL

Expand Down
73 changes: 37 additions & 36 deletions OpenMicro/src/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@
// do not set PA13 , PA14 (stm32f031) as this will break the programming interface
// to disable led pins set number to zero

#define LED_NUMBER 4
#define LED_NUMBER 3

#define LED1PIN GPIO_Pin_4
#define LED1PORT GPIOA
#define LED1PIN GPIO_Pin_6
#define LED1PORT GPIOB

#define LED2PIN GPIO_Pin_2
#define LED2PORT GPIOA
#define LED2PIN GPIO_Pin_1
#define LED2PORT GPIOB

#define LED3PIN GPIO_Pin_12
#define LED3PORT GPIOA
#define LED3PIN GPIO_Pin_4
#define LED3PORT GPIOB

#define LED4PIN GPIO_Pin_0
#define LED4PORT GPIOB
// ??
//#define LED4PIN GPIO_Pin_0
//#define LED4PORT GPIOA

// aux leds

#define AUX_LED_NUMBER 1
#define AUX_LED_NUMBER 0

#define AUX_LED1PIN GPIO_Pin_2
#define AUX_LED1PORT GPIOB
Expand All @@ -51,17 +52,17 @@
#define SOFTI2C_SDAPIN GPIO_Pin_7
#define SOFTI2C_SDAPORT GPIOB

#define SOFTI2C_SCLPIN GPIO_Pin_6
#define SOFTI2C_SCLPIN GPIO_Pin_8
#define SOFTI2C_SCLPORT GPIOB

#define SOFTI2C_GYRO_ADDRESS 0x68
//#define SOFTI2C_GYRO_ADDRESS 0x69
//#define SOFTI2C_GYRO_ADDRESS 0x68
#define SOFTI2C_GYRO_ADDRESS 0x69

// Analog battery input pin and adc channel

#define BATTERYPIN GPIO_Pin_7
#define BATTERYPIN GPIO_Pin_2
#define BATTERYPORT GPIOA
#define BATTERY_ADC_CHANNEL ADC_Channel_7
#define BATTERY_ADC_CHANNEL ADC_Channel_2


// SPI PINS DEFINITONS ( for radio ic )
Expand All @@ -70,17 +71,17 @@
//disable pins so they don't interfere with other pins
//#define DISABLE_SPI_PINS

#define SPI_MOSI_PIN GPIO_Pin_3
#define SPI_MOSI_PORT GPIOB

#define SPI_MISO_PIN GPIO_Pin_15
#define SPI_MISO_PIN GPIO_Pin_6
#define SPI_MISO_PORT GPIOA

#define SPI_CLK_PIN GPIO_Pin_4
#define SPI_CLK_PORT GPIOB
#define SPI_MOSI_PIN GPIO_Pin_7
#define SPI_MOSI_PORT GPIOA

#define SPI_CLK_PIN GPIO_Pin_5
#define SPI_CLK_PORT GPIOA

#define SPI_SS_PIN GPIO_Pin_5
#define SPI_SS_PORT GPIOB
#define SPI_SS_PIN GPIO_Pin_4
#define SPI_SS_PORT GPIOA


// PWM PINS DEFINITIONS
Expand All @@ -93,15 +94,15 @@

// pwm pin initialization
// enable the pwm pins to be used here ( multiple pins ok)
#define PWM_PA0
#define PWM_PA1
//#define PWM_PA0
//#define PWM_PA1
//#define PWM_PA2
//#define PWM_PA3
//#define PWM_PA5
#define PWM_PA8
#define PWM_PA9
//#define PWM_PA10
//#define PWM_PA11
#define PWM_PA10
#define PWM_PA11


// Assingment of pin to motor
Expand All @@ -110,24 +111,24 @@
// back-left motor
// motor 0 pin

#define MOTOR0_PIN_PA0
//#define MOTOR0_PIN_PA0
//#define MOTOR0_PIN_PA1
//#define MOTOR0_PIN_PA2
//#define MOTOR0_PIN_PA3
//#define MOTOR0_PIN_PA5
//#define MOTOR0_PIN_PA8
//#define MOTOR0_PIN_PA9
#define MOTOR0_PIN_PA9
//#define MOTOR0_PIN_PA10
//#define MOTOR0_PIN_PA11

// front-left motor
// motor 1 pin

//#define MOTOR1_PIN_PA0
#define MOTOR1_PIN_PA1
//#define MOTOR1_PIN_PA1
//#define MOTOR1_PIN_PA2
//#define MOTOR1_PIN_PA3
//#define MOTOR1_PIN_PA8
#define MOTOR1_PIN_PA8
//#define MOTOR1_PIN_PA9
//#define MOTOR1_PIN_PA10
//#define MOTOR1_PIN_PA11
Expand All @@ -139,10 +140,10 @@
//#define MOTOR2_PIN_PA1
//#define MOTOR2_PIN_PA2
//#define MOTOR2_PIN_PA3
#define MOTOR2_PIN_PA8
//#define MOTOR2_PIN_PA8
//#define MOTOR2_PIN_PA9
//#define MOTOR2_PIN_PA10
//#define MOTOR2_PIN_PA11
#define MOTOR2_PIN_PA11

// back-right motor
// motor 3 pin
Expand All @@ -152,8 +153,8 @@
//#define MOTOR3_PIN_PA2
//#define MOTOR3_PIN_PA3
//#define MOTOR3_PIN_PA8
#define MOTOR3_PIN_PA9
//#define MOTOR3_PIN_PA10
//#define MOTOR3_PIN_PA9
#define MOTOR3_PIN_PA10
//#define MOTOR3_PIN_PA11


Expand All @@ -162,7 +163,7 @@
// use this to rotate to the correct orientation
//#define SENSOR_ROTATE_90_CW
//#define SENSOR_ROTATE_90_CCW
//#define SENSOR_ROTATE_180
#define SENSOR_ROTATE_180



Expand Down
8 changes: 4 additions & 4 deletions OpenMicro/src/rx_h7_protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ void nextchannel(void)
int decode_h7(void) {
if (rxdata[8] != calc_checksum() ) return 0;

rx[3] = 0.0045000f * (225 - rxdata[0]);
rx[3] = 0.00390625f * (225 - rxdata[0]);

rx[1] = ( ((int)rxdata[3]) - 112) * 0.00888888f;
rx[1] = ( ((int)rxdata[3]) - 112) * 0.00166666f;

rx[0] = ( ((int)rxdata[2]) - 112) * 0.00888888f; // roll
rx[0] = ( ((int)rxdata[2]) - 112) * 0.00166666f; // roll

rx[2] = (-((int)rxdata[1]) + 112) * 0.00888888f;
rx[2] = (-((int)rxdata[1]) + 112) * 0.00166666f;

//rxdata[4] L-R: default:32, (63..1)
//rxdata[5] F-B: default:32, (1..63)
Expand Down

0 comments on commit 4549a1e

Please sign in to comment.