[X7] S.PORT devices update is now done on the bottom connector (#4457)
* [X7] S.PORT devices update is now done on the bottom connector * [X7] I introduce a PCBREV option, as previous versions didn't have this S.PORT bottom connector * [X7] Introduce a PCBREV PIN to avoid having different 2 different firmware on X7 * Compilation fix * [X7] PCBREV PIN was inverted * [X7] PULL DOWN on PCBREV PIN * S.PORT bottom connector is powered by PB.02, not PB.01 * [X7] PCBREV resistor changed * [X7] PCBREV resistor changed
This commit is contained in:
@@ -182,7 +182,7 @@ const char * sportUpdatePowerOn(ModuleIndex module)
|
|||||||
if (module == INTERNAL_MODULE)
|
if (module == INTERNAL_MODULE)
|
||||||
INTERNAL_MODULE_ON();
|
INTERNAL_MODULE_ON();
|
||||||
else
|
else
|
||||||
EXTERNAL_MODULE_ON();
|
SPORT_UPDATE_POWER_ON();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sportWaitState(SPORT_IDLE, 50); // Clear the fifo
|
sportWaitState(SPORT_IDLE, 50); // Clear the fifo
|
||||||
@@ -196,7 +196,8 @@ const char * sportUpdatePowerOn(ModuleIndex module)
|
|||||||
if (sportWaitState(SPORT_POWERUP_ACK, 100))
|
if (sportWaitState(SPORT_POWERUP_ACK, 100))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return "Module not responding";
|
|
||||||
|
return TR("Not responding", "Module not responding");
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * sportUpdateReqVersion()
|
const char * sportUpdateReqVersion()
|
||||||
@@ -305,7 +306,7 @@ void sportFlashDevice(ModuleIndex module, const char * filename)
|
|||||||
|
|
||||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||||
INTERNAL_MODULE_OFF();
|
INTERNAL_MODULE_OFF();
|
||||||
EXTERNAL_MODULE_OFF();
|
SPORT_UPDATE_POWER_OFF();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sportWaitState(SPORT_IDLE, 500); // Clear the fifo
|
sportWaitState(SPORT_IDLE, 500); // Clear the fifo
|
||||||
|
|||||||
@@ -490,6 +490,10 @@ void telemetryPortSetDirectionOutput(void);
|
|||||||
void sportSendBuffer(uint8_t * buffer, uint32_t count);
|
void sportSendBuffer(uint8_t * buffer, uint32_t count);
|
||||||
uint8_t telemetryGetByte(uint8_t * byte);
|
uint8_t telemetryGetByte(uint8_t * byte);
|
||||||
|
|
||||||
|
// Sport update driver
|
||||||
|
#define SPORT_UPDATE_POWER_ON() EXTERNAL_MODULE_ON()
|
||||||
|
#define SPORT_UPDATE_POWER_OFF() EXTERNAL_MODULE_OFF()
|
||||||
|
|
||||||
// Haptic driver
|
// Haptic driver
|
||||||
void hapticInit(void);
|
void hapticInit(void);
|
||||||
void hapticDone(void);
|
void hapticDone(void);
|
||||||
|
|||||||
@@ -111,10 +111,39 @@ const pm_uchar bmp_lock[] PROGMEM = {
|
|||||||
};
|
};
|
||||||
#endif // defined(PCBX9E) && !defined(SIMU)
|
#endif // defined(PCBX9E) && !defined(SIMU)
|
||||||
|
|
||||||
|
#if defined(PCBX7)
|
||||||
|
void sportUpdateInit()
|
||||||
|
{
|
||||||
|
GPIO_InitTypeDef GPIO_InitStructure;
|
||||||
|
GPIO_InitStructure.GPIO_Pin = SPORT_UPDATE_PWR_GPIO_PIN;
|
||||||
|
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||||
|
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||||
|
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||||
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
|
||||||
|
GPIO_Init(SPORT_UPDATE_PWR_GPIO, &GPIO_InitStructure);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sportUpdatePowerOn()
|
||||||
|
{
|
||||||
|
if (IS_PCBREV_40())
|
||||||
|
GPIO_SetBits(SPORT_UPDATE_PWR_GPIO, SPORT_UPDATE_PWR_GPIO_PIN);
|
||||||
|
else
|
||||||
|
EXTERNAL_MODULE_ON();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sportUpdatePowerOff()
|
||||||
|
{
|
||||||
|
if (IS_PCBREV_40())
|
||||||
|
GPIO_ResetBits(SPORT_UPDATE_PWR_GPIO, SPORT_UPDATE_PWR_GPIO_PIN);
|
||||||
|
else
|
||||||
|
EXTERNAL_MODULE_OFF();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void boardInit()
|
void boardInit()
|
||||||
{
|
{
|
||||||
#if !defined(SIMU)
|
#if !defined(SIMU)
|
||||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SD_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TRAINER_RCC_AHB1Periph | HEARTBEAT_RCC_AHB1Periph, ENABLE);
|
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | PCBREV_RCC_AHB1Periph | KEYS_RCC_AHB1Periph | LCD_RCC_AHB1Periph | AUDIO_RCC_AHB1Periph | BACKLIGHT_RCC_AHB1Periph | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SD_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph | INTMODULE_RCC_AHB1Periph | EXTMODULE_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | SPORT_UPDATE_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TRAINER_RCC_AHB1Periph | HEARTBEAT_RCC_AHB1Periph, ENABLE);
|
||||||
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph, ENABLE);
|
RCC_APB1PeriphClockCmd(LCD_RCC_APB1Periph | AUDIO_RCC_APB1Periph | BACKLIGHT_RCC_APB1Periph | INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SD_RCC_APB1Periph | TRAINER_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph | SERIAL_RCC_APB1Periph, ENABLE);
|
||||||
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
|
RCC_APB2PeriphClockCmd(BACKLIGHT_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph | INTMODULE_RCC_APB2Periph | EXTMODULE_RCC_APB2Periph | HEARTBEAT_RCC_APB2Periph, ENABLE);
|
||||||
|
|
||||||
@@ -200,6 +229,13 @@ void boardInit()
|
|||||||
#else
|
#else
|
||||||
backlightInit();
|
backlightInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PCBX7)
|
||||||
|
if (IS_PCBREV_40()) {
|
||||||
|
sportUpdateInit();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // !defined(SIMU)
|
#endif // !defined(SIMU)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -487,6 +487,22 @@ void sportSendBuffer(uint8_t * buffer, uint32_t count);
|
|||||||
uint8_t telemetryGetByte(uint8_t * byte);
|
uint8_t telemetryGetByte(uint8_t * byte);
|
||||||
extern uint32_t telemetryErrors;
|
extern uint32_t telemetryErrors;
|
||||||
|
|
||||||
|
// PCBREV driver
|
||||||
|
#if defined(PCBX7)
|
||||||
|
#define IS_PCBREV_40() (GPIO_ReadInputDataBit(PCBREV_GPIO, PCBREV_GPIO_PIN) == Bit_SET)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Sport update driver
|
||||||
|
#if defined(PCBX7)
|
||||||
|
void sportUpdatePowerOn(void);
|
||||||
|
void sportUpdatePowerOff(void);
|
||||||
|
#define SPORT_UPDATE_POWER_ON() sportUpdatePowerOn()
|
||||||
|
#define SPORT_UPDATE_POWER_OFF() sportUpdatePowerOff()
|
||||||
|
#else
|
||||||
|
#define SPORT_UPDATE_POWER_ON() EXTERNAL_MODULE_ON()
|
||||||
|
#define SPORT_UPDATE_POWER_OFF() EXTERNAL_MODULE_OFF()
|
||||||
|
#endif
|
||||||
|
|
||||||
// Audio driver
|
// Audio driver
|
||||||
void audioInit(void) ;
|
void audioInit(void) ;
|
||||||
void audioEnd(void) ;
|
void audioEnd(void) ;
|
||||||
|
|||||||
@@ -551,6 +551,24 @@
|
|||||||
#define TELEMETRY_USART_IRQHandler USART2_IRQHandler
|
#define TELEMETRY_USART_IRQHandler USART2_IRQHandler
|
||||||
#define TELEMETRY_USART_IRQn USART2_IRQn
|
#define TELEMETRY_USART_IRQn USART2_IRQn
|
||||||
|
|
||||||
|
// PCBREV
|
||||||
|
#if defined(PCBX7)
|
||||||
|
#define PCBREV_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
||||||
|
#define PCBREV_GPIO GPIOA
|
||||||
|
#define PCBREV_GPIO_PIN GPIO_Pin_14 // PA.14
|
||||||
|
#else
|
||||||
|
#define PCBREV_RCC_AHB1Periph 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// SPORT update connector
|
||||||
|
#if defined(PCBX7)
|
||||||
|
#define SPORT_UPDATE_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
||||||
|
#define SPORT_UPDATE_PWR_GPIO GPIOB
|
||||||
|
#define SPORT_UPDATE_PWR_GPIO_PIN GPIO_Pin_2 // PB.02
|
||||||
|
#else
|
||||||
|
#define SPORT_UPDATE_RCC_AHB1Periph 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// Heartbeat
|
// Heartbeat
|
||||||
#define HEARTBEAT_RCC_AHB1Periph RCC_AHB1Periph_GPIOC
|
#define HEARTBEAT_RCC_AHB1Periph RCC_AHB1Periph_GPIOC
|
||||||
#define HEARTBEAT_RCC_APB2Periph RCC_APB2Periph_USART6
|
#define HEARTBEAT_RCC_APB2Periph RCC_APB2Periph_USART6
|
||||||
|
|||||||
@@ -47,7 +47,15 @@ void pwrInit()
|
|||||||
|
|
||||||
GPIO_InitStructure.GPIO_Pin = TRAINER_DETECT_GPIO_PIN;
|
GPIO_InitStructure.GPIO_Pin = TRAINER_DETECT_GPIO_PIN;
|
||||||
GPIO_Init(TRAINER_DETECT_GPIO, &GPIO_InitStructure);
|
GPIO_Init(TRAINER_DETECT_GPIO, &GPIO_InitStructure);
|
||||||
|
|
||||||
|
#if defined(PCBX7)
|
||||||
|
// Init PCBREV PIN
|
||||||
|
GPIO_ResetBits(PCBREV_GPIO, PCBREV_GPIO_PIN);
|
||||||
|
GPIO_InitStructure.GPIO_Pin = PCBREV_GPIO_PIN;
|
||||||
|
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN;
|
||||||
|
GPIO_Init(PCBREV_GPIO, &GPIO_InitStructure);
|
||||||
|
#endif
|
||||||
|
|
||||||
pwrOn();
|
pwrOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user