Merge remote-tracking branch 'refs/remotes/upstream/master' into feature-timer
This commit is contained in:
commit
3ee60ef857
7
Makefile
7
Makefile
|
@ -35,7 +35,7 @@ SERIAL_DEVICE ?= /dev/ttyUSB0
|
|||
|
||||
FORKNAME = cleanflight
|
||||
|
||||
VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 CC3D CJMCU EUSTM32F103RC MASSIVEF3
|
||||
VALID_TARGETS = NAZE NAZE32PRO OLIMEXINO STM32F3DISCOVERY CHEBUZZF3 CC3D CJMCU EUSTM32F103RC MASSIVEF3 PORT103R
|
||||
|
||||
# Valid targets for OP BootLoader support
|
||||
OPBL_VALID_TARGETS = CC3D
|
||||
|
@ -98,7 +98,7 @@ TARGET_FLAGS := $(TARGET_FLAGS) -DSTM32F3DISCOVERY
|
|||
endif
|
||||
|
||||
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),EUSTM32F103RC))
|
||||
else ifeq ($(TARGET),$(filter $(TARGET),EUSTM32F103RC PORT103R))
|
||||
|
||||
|
||||
STDPERIPH_DIR = $(ROOT)/lib/main/STM32F10x_StdPeriph_Driver
|
||||
|
@ -267,6 +267,7 @@ EUSTM32F103RC_SRC = startup_stm32f10x_hd_gcc.S \
|
|||
drivers/compass_hmc5883l.c \
|
||||
drivers/display_ug2864hsweg01.h \
|
||||
drivers/gpio_stm32f10x.c \
|
||||
drivers/inverter.c \
|
||||
drivers/light_led_stm32f10x.c \
|
||||
drivers/light_ws2811strip.c \
|
||||
drivers/light_ws2811strip_stm32f10x.c \
|
||||
|
@ -284,6 +285,8 @@ EUSTM32F103RC_SRC = startup_stm32f10x_hd_gcc.S \
|
|||
$(HIGHEND_SRC) \
|
||||
$(COMMON_SRC)
|
||||
|
||||
PORT103R_SRC = $(EUSTM32F103RC_SRC)
|
||||
|
||||
OLIMEXINO_SRC = startup_stm32f10x_md_gcc.S \
|
||||
drivers/accgyro_mpu6050.c \
|
||||
drivers/adc.c \
|
||||
|
|
11
docs/Rx.md
11
docs/Rx.md
|
@ -20,7 +20,16 @@ Allows you to use MSP commands as the RC input. Only 8 channel support to maint
|
|||
|
||||
## SBUS
|
||||
|
||||
12 channels via serial currently supported.
|
||||
16 channels via serial currently supported.
|
||||
|
||||
### OpenTX configuration
|
||||
|
||||
If using OpenTX set the transmitter module to D16 mode and select CH1-16 on the transmitter before binding to allow reception
|
||||
of 16 channels.
|
||||
|
||||
OpenTX 2.09, which is shipped on some Taranis X9D Plus transmitters, has a bug - https://github.com/opentx/opentx/issues/1701
|
||||
The bug prevents use of all 16 channels. Upgrade to the latest OpenTX version to allow correct reception of all 16 channels,
|
||||
without the fix you are limited to 8 channels regardless of the CH1-16/D16 settings.
|
||||
|
||||
## SUMD
|
||||
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
11159
obj/cleanflight_NAZE.hex
11159
obj/cleanflight_NAZE.hex
File diff suppressed because it is too large
Load Diff
|
@ -236,6 +236,38 @@ void i2c_OLED_send_string(const char *string)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* according to http://www.adafruit.com/datasheets/UG-2864HSWEG01.pdf Chapter 4.4 Page 15
|
||||
*/
|
||||
#if 1
|
||||
void ug2864hsweg01InitI2C(void)
|
||||
{
|
||||
i2c_OLED_send_cmd(0xAE); // Set display OFF
|
||||
i2c_OLED_send_cmd(0xD4); // Set Display Clock Divide Ratio / OSC Frequency
|
||||
i2c_OLED_send_cmd(0x80); // Display Clock Divide Ratio / OSC Frequency
|
||||
i2c_OLED_send_cmd(0xA8); // Set Multiplex Ratio
|
||||
i2c_OLED_send_cmd(0x3F); // Multiplex Ratio for 128x64 (64-1)
|
||||
i2c_OLED_send_cmd(0xD3); // Set Display Offset
|
||||
i2c_OLED_send_cmd(0x00); // Display Offset
|
||||
i2c_OLED_send_cmd(0x40); // Set Display Start Line
|
||||
i2c_OLED_send_cmd(0x8D); // Set Charge Pump
|
||||
i2c_OLED_send_cmd(0x14); // Charge Pump (0x10 External, 0x14 Internal DC/DC)
|
||||
i2c_OLED_send_cmd(0xA1); // Set Segment Re-Map
|
||||
i2c_OLED_send_cmd(0xC8); // Set Com Output Scan Direction
|
||||
i2c_OLED_send_cmd(0xDA); // Set COM Hardware Configuration
|
||||
i2c_OLED_send_cmd(0x12); // COM Hardware Configuration
|
||||
i2c_OLED_send_cmd(0x81); // Set Contrast
|
||||
i2c_OLED_send_cmd(0xCF); // Contrast
|
||||
i2c_OLED_send_cmd(0xD9); // Set Pre-Charge Period
|
||||
i2c_OLED_send_cmd(0xF1); // Set Pre-Charge Period (0x22 External, 0xF1 Internal)
|
||||
i2c_OLED_send_cmd(0xDB); // Set VCOMH Deselect Level
|
||||
i2c_OLED_send_cmd(0x40); // VCOMH Deselect Level
|
||||
i2c_OLED_send_cmd(0xA4); // Set all pixels OFF
|
||||
i2c_OLED_send_cmd(0xA6); // Set display not inverted
|
||||
i2c_OLED_send_cmd(0xAF); // Set display On
|
||||
i2c_OLED_clear_display();
|
||||
}
|
||||
#else
|
||||
void ug2864hsweg01InitI2C(void)
|
||||
{
|
||||
i2c_OLED_send_cmd(0xae); //display off
|
||||
|
@ -273,3 +305,4 @@ void ug2864hsweg01InitI2C(void)
|
|||
i2c_OLED_clear_display();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -69,7 +69,7 @@ enum {
|
|||
MAP_TO_SERVO_OUTPUT,
|
||||
};
|
||||
|
||||
#if defined(NAZE) || defined(OLIMEXINO) || defined(NAZE32PRO) || defined(STM32F3DISCOVERY) || defined(EUSTM32F103RC) || defined(MASSIVEF3)
|
||||
#if defined(NAZE) || defined(OLIMEXINO) || defined(NAZE32PRO) || defined(STM32F3DISCOVERY) || defined(EUSTM32F103RC) || defined(MASSIVEF3) || defined(PORT103R)
|
||||
static const uint16_t multiPPM[] = {
|
||||
PWM1 | (MAP_TO_PPM_INPUT << 8), // PPM input
|
||||
PWM9 | (MAP_TO_MOTOR_OUTPUT << 8), // Swap to servo if needed
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
TIM4 4 channels
|
||||
*/
|
||||
|
||||
#if defined(CJMCU) || defined(EUSTM32F103RC) || defined(NAZE) || defined(OLIMEXINO)
|
||||
#if defined(CJMCU) || defined(EUSTM32F103RC) || defined(NAZE) || defined(OLIMEXINO) || defined(PORT103R)
|
||||
const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = {
|
||||
{ TIM2, GPIOA, Pin_0, TIM_Channel_1, TIM2_IRQn, 0, Mode_IPD}, // PWM1
|
||||
{ TIM2, GPIOA, Pin_1, TIM_Channel_2, TIM2_IRQn, 0, Mode_IPD}, // PWM2
|
||||
|
|
|
@ -67,6 +67,7 @@ typedef enum {
|
|||
PAGE_SENSORS,
|
||||
PAGE_RX,
|
||||
PAGE_PROFILE,
|
||||
PAGE_DEBUG
|
||||
} pageId_e;
|
||||
|
||||
const char* pageTitles[] = {
|
||||
|
@ -75,13 +76,15 @@ const char* pageTitles[] = {
|
|||
"BATTERY",
|
||||
"SENSORS",
|
||||
"RX",
|
||||
"PROFILE"
|
||||
"PROFILE",
|
||||
"DEBUG"
|
||||
};
|
||||
|
||||
#define PAGE_COUNT (PAGE_RX + 1)
|
||||
|
||||
const uint8_t cyclePageIds[] = {
|
||||
PAGE_PROFILE,
|
||||
PAGE_DEBUG,
|
||||
PAGE_BATTERY,
|
||||
PAGE_SENSORS,
|
||||
PAGE_RX
|
||||
|
@ -267,6 +270,20 @@ void showSensorsPage(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
#define PAGE_TITLE_LINE_COUNT 1
|
||||
|
||||
void showDebugPage(void)
|
||||
{
|
||||
uint8_t rowIndex;
|
||||
|
||||
for (rowIndex = 0; rowIndex < 4; rowIndex++) {
|
||||
tfp_sprintf(lineBuffer, "%d = %5d", rowIndex, debug[rowIndex]);
|
||||
padLineBuffer();
|
||||
i2c_OLED_set_line(rowIndex + PAGE_TITLE_LINE_COUNT);
|
||||
i2c_OLED_send_string(lineBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
void updateDisplay(void)
|
||||
{
|
||||
uint32_t now = micros();
|
||||
|
@ -329,6 +346,9 @@ void updateDisplay(void)
|
|||
case PAGE_PROFILE:
|
||||
showProfilePage();
|
||||
break;
|
||||
case PAGE_DEBUG:
|
||||
showDebugPage();
|
||||
break;
|
||||
}
|
||||
if (!armedState) {
|
||||
updateTicker();
|
||||
|
|
|
@ -119,28 +119,6 @@ void SetSysClock(void);
|
|||
void SetSysClock(bool overclock);
|
||||
#endif
|
||||
|
||||
// FIXME bad naming - this appears to be for some new board that hasn't been made available yet.
|
||||
#ifdef PROD_DEBUG
|
||||
void productionDebug(void)
|
||||
{
|
||||
gpio_config_t gpio;
|
||||
|
||||
// remap PB6 to USART1_TX
|
||||
gpio.pin = Pin_6;
|
||||
gpio.mode = Mode_AF_PP;
|
||||
gpio.speed = Speed_2MHz;
|
||||
gpioInit(GPIOB, &gpio);
|
||||
gpioPinRemapConfig(AFIO_MAPR_USART1_REMAP, true);
|
||||
serialInit(mcfg.serial_baudrate);
|
||||
delay(25);
|
||||
serialPrint(core.mainport, "DBG ");
|
||||
printf("%08x%08x%08x OK\n", U_ID_0, U_ID_1, U_ID_2);
|
||||
serialPrint(core.mainport, "EOF");
|
||||
delay(25);
|
||||
gpioPinRemapConfig(AFIO_MAPR_USART1_REMAP, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
void init(void)
|
||||
{
|
||||
uint8_t i;
|
||||
|
@ -251,11 +229,6 @@ void init(void)
|
|||
// drop out any sensors that don't seem to work, init all the others. halt if gyro is dead.
|
||||
sensorsOK = sensorsAutodetect(&masterConfig.sensorAlignmentConfig, masterConfig.gyro_lpf, masterConfig.acc_hardware, currentProfile->mag_declination);
|
||||
|
||||
// production debug output
|
||||
#ifdef PROD_DEBUG
|
||||
productionDebug();
|
||||
#endif
|
||||
|
||||
// if gyro was not detected due to whatever reason, we give up now.
|
||||
if (!sensorsOK)
|
||||
failureMode(3);
|
||||
|
|
|
@ -142,24 +142,3 @@ void alignSensors(int16_t *src, int16_t *dest, uint8_t rotation)
|
|||
if (!standardBoardAlignment)
|
||||
alignBoard(dest);
|
||||
}
|
||||
|
||||
#ifdef PROD_DEBUG
|
||||
void productionDebug(void)
|
||||
{
|
||||
gpio_config_t gpio;
|
||||
|
||||
// remap PB6 to USART1_TX
|
||||
gpio.pin = Pin_6;
|
||||
gpio.mode = Mode_AF_PP;
|
||||
gpio.speed = Speed_2MHz;
|
||||
gpioInit(GPIOB, &gpio);
|
||||
gpioPinRemapConfig(AFIO_MAPR_USART1_REMAP, true);
|
||||
serialInit(mcfg.serial_baudrate);
|
||||
delay(25);
|
||||
serialPrint(core.mainport, "DBG ");
|
||||
printf("%08x%08x%08x OK\n", U_ID_0, U_ID_1, U_ID_2);
|
||||
serialPrint(core.mainport, "EOF");
|
||||
delay(25);
|
||||
gpioPinRemapConfig(AFIO_MAPR_USART1_REMAP, false);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@ int32_t sonarAlt = -1; // in cm , -1 indicate sonar is not in range
|
|||
|
||||
void Sonar_init(void)
|
||||
{
|
||||
#if defined(NAZE) || defined(EUSTM32F103RC)
|
||||
#if defined(NAZE) || defined(EUSTM32F103RC) || defined(PORT103R)
|
||||
static const sonarHardware_t const sonarPWM56 = {
|
||||
.trigger_pin = Pin_8, // PWM5 (PB8) - 5v tolerant
|
||||
.echo_pin = Pin_9, // PWM6 (PB9) - 5v tolerant
|
||||
|
|
|
@ -19,6 +19,11 @@
|
|||
|
||||
#define TARGET_BOARD_IDENTIFIER "EUF1"
|
||||
|
||||
#define INVERTER_PIN Pin_2 // PB2 (BOOT1) abused as inverter select GPIO
|
||||
#define INVERTER_GPIO GPIOB
|
||||
#define INVERTER_PERIPHERAL RCC_APB2Periph_GPIOB
|
||||
#define INVERTER_USART USART2
|
||||
|
||||
#define MPU6000_CS_GPIO GPIOB
|
||||
#define MPU6000_CS_PIN GPIO_Pin_12
|
||||
#define MPU6000_SPI_INSTANCE SPI2
|
||||
|
@ -53,6 +58,7 @@
|
|||
#define MAG
|
||||
#define SONAR
|
||||
#define DISPLAY
|
||||
#define INVERTER
|
||||
|
||||
#define USE_USART1
|
||||
#define USE_USART2
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
* This file is part of Cleanflight.
|
||||
*
|
||||
* Cleanflight is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Cleanflight is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define TARGET_BOARD_IDENTIFIER "103R"
|
||||
|
||||
#define LED0_GPIO GPIOD
|
||||
#define LED0_PIN Pin_2 // PD2 (LED)
|
||||
#define LED0_PERIPHERAL RCC_APB2Periph_GPIOD
|
||||
|
||||
#define BEEP_GPIO GPIOA
|
||||
#define BEEP_PIN Pin_12 // PA12 (Beeper)
|
||||
#define BEEP_PERIPHERAL RCC_APB2Periph_GPIOA
|
||||
|
||||
#define BARO_XCLR_GPIO GPIOC
|
||||
#define BARO_XCLR_PIN Pin_13
|
||||
#define BARO_EOC_GPIO GPIOC
|
||||
#define BARO_EOC_PIN Pin_14
|
||||
#define BARO_APB2_PERIPHERALS RCC_APB2Periph_GPIOC
|
||||
|
||||
#define INVERTER_PIN Pin_2 // PB2 (BOOT1) abused as inverter select GPIO
|
||||
#define INVERTER_GPIO GPIOB
|
||||
#define INVERTER_PERIPHERAL RCC_APB2Periph_GPIOB
|
||||
#define INVERTER_USART USART2
|
||||
|
||||
#define MPU6000_CS_GPIO GPIOB
|
||||
#define MPU6000_CS_PIN GPIO_Pin_12
|
||||
#define MPU6000_SPI_INSTANCE SPI2
|
||||
|
||||
#define MPU6500_CS_GPIO GPIOB
|
||||
#define MPU6500_CS_PIN GPIO_Pin_12
|
||||
#define MPU6500_SPI_INSTANCE SPI2
|
||||
|
||||
#define ACC
|
||||
#define USE_FAKE_ACC
|
||||
//#define USE_ACC_ADXL345
|
||||
//#define USE_ACC_BMA280
|
||||
//#define USE_ACC_MMA8452
|
||||
//#define USE_ACC_MPU3050
|
||||
#define USE_ACC_MPU6050
|
||||
//#define USE_ACC_SPI_MPU6000
|
||||
//#define USE_ACC_SPI_MPU6500
|
||||
|
||||
#define GYRO
|
||||
#define USE_FAKE_GYRO
|
||||
//#define USE_GYRO_L3G4200D
|
||||
//#define USE_GYRO_L3GD20
|
||||
//#define USE_GYRO_MPU3050
|
||||
#define USE_GYRO_MPU6050
|
||||
//#define USE_GYRO_SPI_MPU6000
|
||||
//#define USE_GYRO_SPI_MPU6500
|
||||
|
||||
#define BARO
|
||||
#define USE_BARO_MS5611
|
||||
//#define USE_BARO_BMP085
|
||||
|
||||
#define MAG
|
||||
#define SONAR
|
||||
#define BEEPER
|
||||
#define LED0
|
||||
#define INVERTER
|
||||
#define DISPLAY
|
||||
|
||||
#define USE_USART1
|
||||
#define USE_USART2
|
||||
#define USE_SOFTSERIAL1
|
||||
#define USE_SOFTSERIAL2
|
||||
#define SERIAL_PORT_COUNT 4
|
||||
|
||||
#define SOFTSERIAL_1_TIMER TIM3
|
||||
#define SOFTSERIAL_1_TIMER_RX_HARDWARE 4 // PWM 5
|
||||
#define SOFTSERIAL_1_TIMER_TX_HARDWARE 5 // PWM 6
|
||||
#define SOFTSERIAL_2_TIMER TIM3
|
||||
#define SOFTSERIAL_2_TIMER_RX_HARDWARE 6 // PWM 7
|
||||
#define SOFTSERIAL_2_TIMER_TX_HARDWARE 7 // PWM 8
|
||||
|
||||
#define USE_I2C
|
||||
#define I2C_DEVICE (I2CDEV_2)
|
||||
|
||||
// #define SOFT_I2C // enable to test software i2c
|
||||
// #define SOFT_I2C_PB1011 // If SOFT_I2C is enabled above, need to define pinout as well (I2C1 = PB67, I2C2 = PB1011)
|
||||
// #define SOFT_I2C_PB67
|
||||
|
||||
#define SENSORS_SET (SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
|
||||
|
||||
#define LED0
|
||||
#define GPS
|
||||
#define LED_STRIP
|
||||
#define LED_STRIP_TIMER TIM3
|
||||
|
||||
#define TELEMETRY
|
||||
#define SERIAL_RX
|
||||
#define AUTOTUNE
|
||||
|
Loading…
Reference in New Issue