Flash internal module
This commit is contained in:
@@ -143,6 +143,7 @@ set(SRC
|
||||
tasks.cpp
|
||||
audio.cpp
|
||||
io/frsky_sport.cpp
|
||||
io/frsky_device_firmware_update.cpp
|
||||
telemetry/telemetry.cpp
|
||||
telemetry/telemetry_holders.cpp
|
||||
telemetry/telemetry_sensors.cpp
|
||||
|
||||
@@ -34,7 +34,7 @@ void intmodulePxxStart()
|
||||
// shouldn't be used anymore
|
||||
}
|
||||
|
||||
void intmodulePxx2Start()
|
||||
void intmoduleSerialStart(uint32_t baudrate)
|
||||
{
|
||||
INTERNAL_MODULE_ON();
|
||||
|
||||
@@ -58,7 +58,7 @@ void intmodulePxx2Start()
|
||||
|
||||
USART_DeInit(INTMODULE_USART);
|
||||
USART_InitTypeDef USART_InitStructure;
|
||||
USART_InitStructure.USART_BaudRate = INTMODULE_USART_PXX_BAUDRATE;
|
||||
USART_InitStructure.USART_BaudRate = baudrate;
|
||||
USART_InitStructure.USART_Parity = USART_Parity_No;
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
@@ -89,30 +89,35 @@ extern "C" void INTMODULE_USART_IRQHandler(void)
|
||||
}
|
||||
}
|
||||
|
||||
void intmoduleSendBuffer(const uint8_t * data, uint8_t size)
|
||||
{
|
||||
DMA_InitTypeDef DMA_InitStructure;
|
||||
DMA_DeInit(INTMODULE_DMA_STREAM);
|
||||
DMA_InitStructure.DMA_Channel = INTMODULE_DMA_CHANNEL;
|
||||
DMA_InitStructure.DMA_PeripheralBaseAddr = CONVERT_PTR_UINT(&INTMODULE_USART->DR);
|
||||
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
|
||||
DMA_InitStructure.DMA_Memory0BaseAddr = CONVERT_PTR_UINT(data);
|
||||
DMA_InitStructure.DMA_BufferSize = size;
|
||||
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
||||
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
||||
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
|
||||
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
|
||||
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
|
||||
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
|
||||
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
|
||||
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
|
||||
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
|
||||
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
|
||||
DMA_Init(INTMODULE_DMA_STREAM, &DMA_InitStructure);
|
||||
DMA_Cmd(INTMODULE_DMA_STREAM, ENABLE);
|
||||
USART_DMACmd(INTMODULE_USART, USART_DMAReq_Tx, ENABLE);
|
||||
}
|
||||
|
||||
void intmoduleSendNextFrame()
|
||||
{
|
||||
#if defined(PXX2)
|
||||
if (moduleSettings[INTERNAL_MODULE].protocol == PROTOCOL_CHANNELS_PXX2) {
|
||||
DMA_InitTypeDef DMA_InitStructure;
|
||||
DMA_DeInit(INTMODULE_DMA_STREAM);
|
||||
DMA_InitStructure.DMA_Channel = INTMODULE_DMA_CHANNEL;
|
||||
DMA_InitStructure.DMA_PeripheralBaseAddr = CONVERT_PTR_UINT(&INTMODULE_USART->DR);
|
||||
DMA_InitStructure.DMA_DIR = DMA_DIR_MemoryToPeripheral;
|
||||
DMA_InitStructure.DMA_Memory0BaseAddr = CONVERT_PTR_UINT(intmodulePulsesData.pxx2.getData());
|
||||
DMA_InitStructure.DMA_BufferSize = intmodulePulsesData.pxx2.getSize();
|
||||
DMA_InitStructure.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
||||
DMA_InitStructure.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
||||
DMA_InitStructure.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
|
||||
DMA_InitStructure.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
|
||||
DMA_InitStructure.DMA_Mode = DMA_Mode_Normal;
|
||||
DMA_InitStructure.DMA_Priority = DMA_Priority_VeryHigh;
|
||||
DMA_InitStructure.DMA_FIFOMode = DMA_FIFOMode_Disable;
|
||||
DMA_InitStructure.DMA_FIFOThreshold = DMA_FIFOThreshold_Full;
|
||||
DMA_InitStructure.DMA_MemoryBurst = DMA_MemoryBurst_Single;
|
||||
DMA_InitStructure.DMA_PeripheralBurst = DMA_PeripheralBurst_Single;
|
||||
DMA_Init(INTMODULE_DMA_STREAM, &DMA_InitStructure);
|
||||
DMA_Cmd(INTMODULE_DMA_STREAM, ENABLE);
|
||||
USART_DMACmd(INTMODULE_USART, USART_DMAReq_Tx, ENABLE);
|
||||
intmoduleSendBuffer(intmodulePulsesData.pxx2.getData(), intmodulePulsesData.pxx2.getSize());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
void intmoduleStop();
|
||||
void intmodulePxxStart();
|
||||
void intmodulePxx2Start();
|
||||
void intmoduleSerialStart(uint32_t baudrate);
|
||||
|
||||
void extmoduleStop();
|
||||
void extmodulePpmStart();
|
||||
@@ -48,7 +48,7 @@ void disable_ppm(uint8_t module)
|
||||
void init_pxx2(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmodulePxx2Start();
|
||||
intmoduleSerialStart(INTMODULE_USART_PXX_BAUDRATE);
|
||||
else
|
||||
extmodulePxx2Start();
|
||||
}
|
||||
|
||||
@@ -172,14 +172,27 @@ uint32_t isBootloaderStart(const uint8_t * buffer);
|
||||
|
||||
void init_ppm(uint8_t module);
|
||||
void disable_ppm(uint8_t module);
|
||||
void intmoduleSendNextFrame();
|
||||
void extmoduleSendNextFrame();
|
||||
void init_pxx2(uint8_t module);
|
||||
void disable_pxx2(uint8_t module);
|
||||
void init_pxx(uint8_t module);
|
||||
void disable_pxx(uint8_t module);
|
||||
void init_serial(uint8_t module, uint32_t baudrate, uint32_t period);
|
||||
void disable_serial(uint8_t module);
|
||||
void intmoduleStop();
|
||||
void intmodulePxxStart();
|
||||
void intmoduleSerialStart(uint32_t baudrate);
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
void intmodulePpmStart(void);
|
||||
#endif
|
||||
void intmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
||||
void intmoduleSendNextFrame();
|
||||
|
||||
void extmoduleStop();
|
||||
void extmodulePpmStart();
|
||||
void extmodulePxxStart();
|
||||
void extmodulePxx2Start();
|
||||
void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us);
|
||||
void extmoduleSendNextFrame();
|
||||
|
||||
// Trainer driver
|
||||
#define SLAVE_MODE() (g_model.trainerData.mode == TRAINER_MODE_SLAVE)
|
||||
|
||||
@@ -1165,8 +1165,6 @@
|
||||
#define I2CX_SCL_GPIO_PinSource GPIO_PinSource8
|
||||
#define I2CX_SDA_GPIO_PinSource GPIO_PinSource9
|
||||
#define I2CX_SPEED 400000
|
||||
#define I2CX_IMU_INT_GPIO GPIOC
|
||||
#define I2CX_IMU_INT_GPIO_PIN GPIO_Pin_8 // PC.08
|
||||
#endif
|
||||
|
||||
// SD - SPI2
|
||||
|
||||
@@ -65,7 +65,7 @@ void intmoduleSendNextFrame()
|
||||
}
|
||||
}
|
||||
|
||||
void intmodulePxx2Start()
|
||||
void intmoduleSerialStart(uint32_t baudrate)
|
||||
{
|
||||
// nothing, the pulses will be sent through telemetry port
|
||||
}
|
||||
|
||||
@@ -20,20 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
void intmoduleStop();
|
||||
void intmodulePxxStart();
|
||||
void intmodulePxx2Start();
|
||||
#if defined(TARANIS_INTERNAL_PPM)
|
||||
void intmodulePpmStart(void);
|
||||
#endif
|
||||
|
||||
void extmoduleStop();
|
||||
void extmoduleTimerStart(uint32_t period, uint8_t state);
|
||||
void extmodulePpmStart();
|
||||
void extmodulePxxStart();
|
||||
void extmodulePxx2Start();
|
||||
void extmoduleSerialStart(uint32_t baudrate, uint32_t period_half_us);
|
||||
|
||||
void init_pxx(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
@@ -53,7 +39,7 @@ void disable_pxx(uint8_t module)
|
||||
void init_pxx2(uint8_t module)
|
||||
{
|
||||
if (module == INTERNAL_MODULE)
|
||||
intmodulePxx2Start();
|
||||
intmoduleSerialStart(INTMODULE_USART_PXX_BAUDRATE);
|
||||
else
|
||||
extmodulePxx2Start();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user