1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 14:25:20 +03:00

Add RacePIT mini (#8387)

Add RacePIT mini
This commit is contained in:
Michael Keller 2019-06-09 11:57:59 +12:00 committed by mikeller
parent 6b75e1e0b4
commit a84ea9ab0f
11 changed files with 233 additions and 11 deletions

View file

@ -30,8 +30,21 @@
#include "pg/pinio.h"
#include "pg/piniobox.h"
#include "hardware_revision.h"
#include "sensors/gyro.h"
#include "pg/gyrodev.h"
void targetConfiguration(void)
{
if (hardwareRevision == FF_RACEPIT_REV_1) {
gyroDeviceConfigMutable(0)->align = CW180_DEG;
}
else {
gyroDeviceConfigMutable(0)->align = CW90_DEG_FLIP;
}
telemetryConfigMutable()->halfDuplex = false;
pinioConfigMutable()->config[1] = PINIO_CONFIG_OUT_INVERTED | PINIO_CONFIG_MODE_OUT_PP;

View file

@ -0,0 +1,57 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software 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 and Betaflight are distributed in the hope that they
* 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 this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "platform.h"
#include "build/build_config.h"
#include "drivers/io.h"
#include "drivers/time.h"
#include "hardware_revision.h"
#define HW_PIN PC5
uint8_t hardwareRevision = FF_RACEPIT_UNKNOWN;
static IO_t HWDetectPinA = IO_NONE;
void detectHardwareRevision(void)
{
HWDetectPinA = IOGetByTag(IO_TAG(HW_PIN));
IOInit(HWDetectPinA, OWNER_SYSTEM, 0);
IOConfigGPIO(HWDetectPinA, IOCFG_IPU);
delayMicroseconds(10); // allow configuration to settle
if (!IORead(HWDetectPinA)) {
hardwareRevision = FF_RACEPIT_REV_1;
} else {
hardwareRevision = FF_RACEPIT_REV_2;
}
}
void updateHardwareRevision(void)
{
}

View file

@ -0,0 +1,32 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software 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 and Betaflight are distributed in the hope that they
* 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 this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
typedef enum ffRacapitHardwareRevision_t {
FF_RACEPIT_UNKNOWN = 0,
FF_RACEPIT_REV_1, // RacePIT
FF_RACEPIT_REV_2, // RacePIT mini
} ffRacepitHardwareRevision_e;
extern uint8_t hardwareRevision;
void updateHardwareRevision(void);
void detectHardwareRevision(void);

View file

@ -23,6 +23,8 @@
#define USBD_PRODUCT_STRING "RacePit"
#define USE_TARGET_CONFIG
#define USE_HARDWARE_REVISION_DETECTION
/*--------------LED----------------*/
#define LED0_PIN PB9
#define LED1_PIN PB8
@ -56,8 +58,6 @@
#define GYRO_1_CS_PIN SPI1_NSS_PIN
#define GYRO_1_SPI_INSTANCE SPI1
#define GYRO_1_ALIGN CW90_DEG_FLIP
/*---------------------------------*/