[taranis] SD card detection, 2nd PPM initialised as input (temporary), external module powered up (temporary)
This commit is contained in:
@@ -219,6 +219,16 @@ void boardInit()
|
||||
eepromInit();
|
||||
sportInit();
|
||||
usbInit();
|
||||
|
||||
//Temporary: Configure second PPM pin as input (done after USB init in case the lib already initialises USB_ID)
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIO_EXTPPM, ENABLE);
|
||||
GPIO_InitStructure.GPIO_Pin = PIN_EXTPPM_OUT;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(GPIO_EXTPPM, &GPIO_InitStructure);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ void sdInit();
|
||||
void sdPoll10ms();
|
||||
#define sdMountPoll()
|
||||
uint32_t sdMounted();
|
||||
#define SD_CARD_PRESENT() (1)
|
||||
#define SD_CARD_PRESENT() (~SD_PRESENT_GPIO->IDR & SD_PRESENT_GPIO_Pin)
|
||||
#endif
|
||||
|
||||
// Pulses driver
|
||||
@@ -164,7 +164,7 @@ void pwrOff();
|
||||
#define setBacklight(xx)
|
||||
#define __BACKLIGHT_ON GPIO_SetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define __BACKLIGHT_OFF GPIO_ResetBits(GPIOB, GPIO_Pin_BL)
|
||||
#define IS_BACKLIGHT_ON() GPIO_IsSet(GPIOB, GPIO_Pin_BL)
|
||||
#define IS_BACKLIGHT_ON() GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_BL)
|
||||
|
||||
// EEPROM driver
|
||||
#if !defined(SIMU)
|
||||
|
||||
+10
-2
@@ -156,7 +156,16 @@ static inline DWORD socket_is_write_protected(void)
|
||||
|
||||
static void socket_cp_init(void)
|
||||
{
|
||||
return;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_SD_PRESENT, ENABLE);
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = SD_PRESENT_GPIO_Pin;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_OD;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||
GPIO_Init(SD_PRESENT_GPIO, &GPIO_InitStructure);
|
||||
}
|
||||
|
||||
static inline DWORD socket_is_empty(void)
|
||||
@@ -364,7 +373,6 @@ void power_on (void)
|
||||
/* Enable SPI clock, SPI1: APB2, SPI2: APB1 */
|
||||
RCC_APBPeriphClockCmd_SPI_SD(RCC_APBPeriph_SPI_SD, ENABLE);
|
||||
|
||||
|
||||
card_power(1);
|
||||
|
||||
socket_cp_init();//Empty return
|
||||
|
||||
+9
-3
@@ -156,14 +156,15 @@
|
||||
#define RCC_AHB1Periph_GPIOPWR RCC_AHB1Periph_GPIOC | RCC_AHB1Periph_GPIOD
|
||||
#define GPIOPWRLED GPIOC
|
||||
#define GPIOPWR GPIOD
|
||||
#define GPIOTRNDET GPIOA
|
||||
#define PIN_TRNDET GPIO_Pin_8
|
||||
#define PIN_INT_RF_PWR GPIO_Pin_15
|
||||
#define PIN_EXT_RF_PWR GPIO_Pin_8
|
||||
|
||||
// Trainer Port
|
||||
#define GPIO_TR_INOUT GPIOC
|
||||
#define PIN_TR_PPM_IN GPIO_Pin_8 //PC.08
|
||||
#define PIN_TR_PPM_OUT GPIO_Pin_9 //PC.09
|
||||
#define GPIOTRNDET GPIOA
|
||||
#define PIN_TRNDET GPIO_Pin_8
|
||||
|
||||
// TODO merge these constants
|
||||
#define PIN_PER_1 0x0010
|
||||
@@ -181,6 +182,10 @@
|
||||
#define PIN_CPPM_OUT GPIO_Pin_7 //PA.07
|
||||
#define GPIOCPPM GPIOA
|
||||
#define GPIO_PinSource_CPPM GPIO_PinSource7
|
||||
#define RCC_AHB1Periph_GPIO_EXTPPM RCC_AHB1Periph_GPIOA
|
||||
#define PIN_EXTPPM_OUT GPIO_Pin_10 //PA.10
|
||||
#define GPIO_EXTPPM GPIOA
|
||||
#define GPIO_PinSource_EXTPPM GPIO_PinSource10
|
||||
|
||||
// Heart Beat
|
||||
#define PIN_HEART_BEAT GPIO_Pin_7 //PC.07
|
||||
@@ -274,7 +279,8 @@
|
||||
#endif
|
||||
|
||||
// SD - SPI2
|
||||
#define SD_PRESENT_GPIO GPIOD->IDR
|
||||
#define RCC_AHB1Periph_SD_PRESENT RCC_AHB1Periph_GPIOD
|
||||
#define SD_PRESENT_GPIO GPIOD
|
||||
#define SD_PRESENT_GPIO_Pin GPIO_Pin_9 //PD.09
|
||||
#define GPIO_Pin_SPI_SD_CS GPIO_Pin_12 //PB.12
|
||||
#define GPIO_Pin_SPI_SD_SCK GPIO_Pin_13 //PB.13
|
||||
|
||||
@@ -122,6 +122,7 @@ void disable_pxx()
|
||||
// Pin is AF1 function for timer 1
|
||||
void init_main_ppm()
|
||||
{
|
||||
EXTERNAL_RF_ON();
|
||||
// Timer1
|
||||
setupPulsesPPM() ;
|
||||
ppmStreamPtr = ppmStream ;
|
||||
@@ -163,6 +164,7 @@ void disable_main_ppm()
|
||||
NVIC_DisableIRQ(TIM1_UP_TIM10_IRQn) ;
|
||||
TIM1->DIER &= ~TIM_DIER_CC2IE & ~TIM_DIER_UIE ;
|
||||
TIM1->CR1 &= ~TIM_CR1_CEN ;
|
||||
EXTERNAL_RF_OFF();
|
||||
}
|
||||
|
||||
extern "C" void TIM1_CC_IRQHandler()
|
||||
|
||||
Reference in New Issue
Block a user