2 more files removed

This commit is contained in:
bsongis
2014-03-05 14:24:51 +01:00
parent 3b1ac9f5d8
commit 7f6a137ce8
16 changed files with 432 additions and 768 deletions
@@ -44,22 +44,6 @@ extern "C" {
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
#define PIN_MODE_MASK 0x0003
#define PIN_INPUT 0x0000
#define PIN_OUTPUT 0x0001
#define PIN_PERIPHERAL 0x0002
#define PIN_ANALOG 0x0003
#define PIN_PULL_MASK 0x000C
#define PIN_PULLUP 0x0004
#define PIN_NO_PULLUP 0x0000
#define PIN_PULLDOWN 0x0008
#define PIN_NO_PULLDOWN 0x0000
#define PIN_PERI_MASK 0x00F0
#define PIN_PUSHPULL 0x0000
#define PIN_ODRAIN 0x8000
#define PIN_PORT_MASK 0x0700
#define PIN_SPEED_MASK 0x6000
#if !defined(SIMU)
void configure_pins( uint32_t pins, uint16_t config )
{
@@ -106,32 +90,6 @@ void configure_pins( uint32_t pins, uint16_t config )
}
#endif
bool usbPlugged(void)
{
return GPIO_ReadInputDataBit(GPIOA, PIN_FS_VBUS);
}
#if !defined(SIMU)
extern "C" {
USB_OTG_CORE_HANDLE USB_OTG_dev;
void OTG_FS_IRQHandler(void)
{
USBD_OTG_ISR_Handler (&USB_OTG_dev);
}
}
void usbInit()
{
USB_OTG_BSP_Init(&USB_OTG_dev);
}
void usbStart()
{
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
}
#endif
void watchdogInit(unsigned int duration)
{
IWDG->KR = 0x5555 ; // Unlock registers
+24 -2
View File
@@ -75,6 +75,22 @@ extern "C" {
#define JACK_PPM_OUT()
#define JACK_PPM_IN()
#define PIN_MODE_MASK 0x0003
#define PIN_INPUT 0x0000
#define PIN_OUTPUT 0x0001
#define PIN_PERIPHERAL 0x0002
#define PIN_ANALOG 0x0003
#define PIN_PULL_MASK 0x000C
#define PIN_PULLUP 0x0004
#define PIN_NO_PULLUP 0x0000
#define PIN_PULLDOWN 0x0008
#define PIN_NO_PULLDOWN 0x0000
#define PIN_PERI_MASK 0x00F0
#define PIN_PUSHPULL 0x0000
#define PIN_ODRAIN 0x8000
#define PIN_PORT_MASK 0x0700
#define PIN_SPEED_MASK 0x6000
void configure_pins( uint32_t pins, uint16_t config );
#define strcpy_P strcpy
@@ -160,6 +176,10 @@ extern volatile uint16_t Analog_values[];
#define BATT_SCALE 150
#endif
#ifdef __cplusplus
extern "C" {
#endif
// Power driver
void pwrInit(void);
uint32_t pwrCheck(void);
@@ -176,13 +196,15 @@ void pwrOff(void);
#define __BACKLIGHT_OFF TIM10->CCR1 = 0
#define IS_BACKLIGHT_ON() (TIM10->CCR1 != 0)
#if !defined(BOOT)
// USB driver
int usbPlugged(void);
#define BOOTLOADER_REQUEST() (0)
#define usbBootloader()
void usbInit(void);
void usbStart(void);
bool usbPlugged(void);
#ifdef __cplusplus
}
#endif
// EEPROM driver
@@ -34,26 +34,8 @@
*
*/
#include "../../opentx.h"
void pwrOff()
{
GPIO_ResetBits(GPIOPWR,PIN_MCU_PWR);
}
uint32_t pwrCheck()
{
#if defined(SIMU)
return e_power_on;
#else
if (GPIO_ReadInputDataBit(GPIOPWR, PIN_PWR_STATUS) == Bit_RESET)
return e_power_on;
else if (usbPlugged())
return e_power_usb;
else
return e_power_off;
#endif
}
#include "board_taranis.h"
#include "../src/pwr.h"
void pwrInit()
{
@@ -101,5 +83,25 @@ void pwrInit()
#endif
// Soft power ON
GPIO_SetBits(GPIOPWR,PIN_MCU_PWR);
GPIO_SetBits(GPIOPWR, PIN_MCU_PWR);
}
void pwrOff()
{
GPIO_ResetBits(GPIOPWR, PIN_MCU_PWR);
}
// TODO enums should be UPPERCASE
uint32_t pwrCheck()
{
#if defined(SIMU)
return e_power_on;
#else
if (GPIO_ReadInputDataBit(GPIOPWR, PIN_PWR_STATUS) == Bit_RESET)
return e_power_on;
else if (usbPlugged())
return e_power_usb;
else
return e_power_off;
#endif
}
+59
View File
@@ -0,0 +1,59 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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.
*
*/
#include "board_taranis.h"
int usbPlugged(void)
{
return GPIO_ReadInputDataBit(GPIOA, PIN_FS_VBUS);
}
USB_OTG_CORE_HANDLE USB_OTG_dev;
void OTG_FS_IRQHandler(void)
{
USBD_OTG_ISR_Handler (&USB_OTG_dev);
}
void usbInit()
{
USB_OTG_BSP_Init(&USB_OTG_dev);
}
void usbStart()
{
USBD_Init(&USB_OTG_dev, USB_OTG_FS_CORE_ID, &USR_desc, &USBD_MSC_cb, &USR_cb);
}