mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
[Horus] Some LCD timings added in comments
This commit is contained in:
parent
d74092d6eb
commit
34fef4fefe
15 changed files with 44 additions and 64 deletions
|
@ -78,6 +78,9 @@ void debugPrintf(const char * format, ...);
|
|||
#define TRACE_WARNING_WP(...) debugPrintf(__VA_ARGS__)
|
||||
#define TRACE_ERROR(...) debugPrintf("-E- " __VA_ARGS__)
|
||||
|
||||
#define TIME_MEASURE_START(id) uint16_t t0 ## id = getTmr2MHz()
|
||||
#define TIME_MEASURE_STOP(id) TRACE("Measure(" # id ") = %.1fus", float((uint16_t)(getTmr2MHz() - t0 ## id))/2)
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
#define TRACE_BUFFER_LEN 50
|
||||
|
|
|
@ -345,7 +345,9 @@ bool menuMainView(evt_t event)
|
|||
break;
|
||||
}
|
||||
|
||||
TIME_MEASURE_START(backgroundbitmap);
|
||||
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
|
||||
TIME_MEASURE_STOP(backgroundbitmap); // 23ms
|
||||
|
||||
// Header
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
|
@ -378,7 +380,10 @@ bool menuMainView(evt_t event)
|
|||
drawTrims(mode);
|
||||
|
||||
// Model panel
|
||||
TIME_MEASURE_START(filledRect);
|
||||
lcdDrawFilledRect(MODELPANEL_LEFT, MODELPANEL_TOP, MODELPANEL_WIDTH, MODELPANEL_HEIGHT, SOLID, TEXT_BGCOLOR | OPACITY(5));
|
||||
TIME_MEASURE_STOP(filledRect); // 9ms !
|
||||
|
||||
lcdDrawBitmapPattern(MODELPANEL_LEFT+6, MODELPANEL_TOP+4, LBM_MODEL_ICON, TITLE_BGCOLOR);
|
||||
lcdDrawTextWithLen(MODELPANEL_LEFT+45, MODELPANEL_TOP+10, g_model.header.name, LEN_MODEL_NAME, ZCHAR|SMLSIZE);
|
||||
lcdDrawSolidHorizontalLine(MODELPANEL_LEFT+39, MODELPANEL_TOP+27, MODELPANEL_WIDTH-48, TITLE_BGCOLOR);
|
||||
|
|
|
@ -1048,7 +1048,11 @@ void doSplash()
|
|||
if (!(g_eeGeneral.splashMode & 0x04)) {
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
if (keyDown()) return;
|
||||
#else
|
||||
if (keyDown() || inputsMoved()) return;
|
||||
#endif
|
||||
|
||||
#if defined(FSPLASH)
|
||||
}
|
||||
|
|
|
@ -121,9 +121,6 @@ static void ADS7952_Init()
|
|||
|
||||
void adcInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(ADC_RCC_AHB1Periph, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(ADC_RCC_APB2Periph, ENABLE);
|
||||
|
||||
ADS7952_Init();
|
||||
|
||||
configure_pins( ADC_GPIO_PIN_MOUSE1 | ADC_GPIO_PIN_MOUSE2, PIN_ANALOG | PIN_PORTF );
|
||||
|
|
|
@ -58,27 +58,22 @@ void watchdogInit(unsigned int duration)
|
|||
// Start TIMER7 at 2000000Hz
|
||||
void init2MhzTimer()
|
||||
{
|
||||
// Now for timer 7
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM7EN ; // Enable clock
|
||||
|
||||
TIM7->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5 uS, 2 MHz
|
||||
TIM7->ARR = 65535;
|
||||
TIM7->CR2 = 0;
|
||||
TIM7->CR1 = TIM_CR1_CEN;
|
||||
TIMER_2MHz_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 2000000 - 1 ; // 0.5 uS, 2 MHz
|
||||
TIMER_2MHz_TIMER->ARR = 65535;
|
||||
TIMER_2MHz_TIMER->CR2 = 0;
|
||||
TIMER_2MHz_TIMER->CR1 = TIM_CR1_CEN;
|
||||
}
|
||||
|
||||
// Starts TIMER at 200Hz, 5mS period
|
||||
void init5msTimer()
|
||||
{
|
||||
// Timer14
|
||||
RCC->APB1ENR |= RCC_APB1ENR_TIM14EN ; // Enable clock
|
||||
TIM14->ARR = 999 ; // 5mS
|
||||
TIM14->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 1000000 - 1 ; // 1uS from 30MHz
|
||||
TIM14->CCER = 0 ;
|
||||
TIM14->CCMR1 = 0 ;
|
||||
TIM14->EGR = 0 ;
|
||||
TIM14->CR1 = 5 ;
|
||||
TIM14->DIER |= 1 ;
|
||||
INTERRUPT_5MS_TIMER->ARR = 999 ; // 5mS
|
||||
INTERRUPT_5MS_TIMER->PSC = (PERI1_FREQUENCY * TIMER_MULT_APB1) / 1000000 - 1 ; // 1uS from 30MHz
|
||||
INTERRUPT_5MS_TIMER->CCER = 0 ;
|
||||
INTERRUPT_5MS_TIMER->CCMR1 = 0 ;
|
||||
INTERRUPT_5MS_TIMER->EGR = 0 ;
|
||||
INTERRUPT_5MS_TIMER->CR1 = 5 ;
|
||||
INTERRUPT_5MS_TIMER->DIER |= 1 ;
|
||||
NVIC_EnableIRQ(TIM8_TRG_COM_TIM14_IRQn) ;
|
||||
NVIC_SetPriority(TIM8_TRG_COM_TIM14_IRQn, 7);
|
||||
}
|
||||
|
@ -121,6 +116,7 @@ extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
|
|||
interrupt5ms() ;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void pinCheck(GPIO_TypeDef * gpio, uint32_t pin, uint32_t RCC_AHB1Periph)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
@ -141,16 +137,20 @@ void pinCheck(GPIO_TypeDef * gpio, uint32_t pin, uint32_t RCC_AHB1Periph)
|
|||
delay_01us(10);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void boardInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph | LCD_RCC_AHB1Periph | KEYS_RCC_AHB1Periph_GPIO | ADC_RCC_AHB1Periph | I2C_RCC_AHB1Periph | SERIAL_RCC_AHB1Periph | TELEMETRY_RCC_AHB1Periph | HAPTIC_RCC_AHB1Periph, ENABLE);
|
||||
RCC_APB1PeriphClockCmd(INTERRUPT_5MS_APB1Periph | TIMER_2MHz_APB1Periph | I2C_RCC_APB1Periph | SERIAL_RCC_APB1Periph | TELEMETRY_RCC_APB1Periph, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph | ADC_RCC_APB2Periph | HAPTIC_RCC_APB2Periph, ENABLE);
|
||||
|
||||
pwrInit();
|
||||
ledInit();
|
||||
delaysInit();
|
||||
|
||||
ledRed();
|
||||
|
||||
|
||||
if (0) {
|
||||
// pinCheck(SERIAL_GPIO, SERIAL_GPIO_PIN_TX, SERIAL_RCC_AHB1Periph_GPIO);
|
||||
// pinCheck(EEPROM_GPIO, EEPROM_GPIO_PIN_SCK, RCC_AHB1Periph_GPIOB);
|
||||
|
|
|
@ -108,19 +108,19 @@
|
|||
#define ADC_IN_MOUSE2 7
|
||||
|
||||
// Power
|
||||
#define PWR_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOJ
|
||||
#define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOJ
|
||||
#define PWR_GPIO GPIOJ
|
||||
#define PWR_GPIO_PIN_ON GPIO_Pin_0 // PJ.00
|
||||
#define PWR_GPIO_PIN_SWITCH GPIO_Pin_1 // PJ.01
|
||||
|
||||
// Led
|
||||
#define LED_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOI
|
||||
#define LED_RCC_AHB1Periph RCC_AHB1Periph_GPIOI
|
||||
#define LED_GPIO GPIOI
|
||||
#define LED_GPIO_PIN GPIO_Pin_5 // PI.05
|
||||
|
||||
// Serial Port (DEBUG)
|
||||
#define SERIAL_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOB
|
||||
#define SERIAL_RCC_APB1Periph_USART RCC_APB1Periph_USART3
|
||||
#define SERIAL_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
||||
#define SERIAL_RCC_APB1Periph RCC_APB1Periph_USART3
|
||||
#define SERIAL_GPIO GPIOB
|
||||
#define SERIAL_GPIO_PIN_TX GPIO_Pin_10 // PB.10
|
||||
#define SERIAL_GPIO_PIN_RX GPIO_Pin_11 // PB.11
|
||||
|
@ -132,8 +132,8 @@
|
|||
#define SERIAL_USART_IRQn USART3_IRQn
|
||||
|
||||
// Telemetry
|
||||
#define TELEMETRY_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOD
|
||||
#define TELEMETRY_RCC_APB1Periph_USART RCC_APB1Periph_USART2
|
||||
#define TELEMETRY_RCC_AHB1Periph RCC_AHB1Periph_GPIOD
|
||||
#define TELEMETRY_RCC_APB1Periph RCC_APB1Periph_USART2
|
||||
#define TELEMETRY_GPIO_DIR GPIOD
|
||||
#define TELEMETRY_GPIO_PIN_DIR GPIO_Pin_4 // PD.04
|
||||
#define TELEMETRY_GPIO GPIOD
|
||||
|
@ -189,8 +189,8 @@
|
|||
// Audio
|
||||
|
||||
// I2C Bus: CAT5137
|
||||
#define I2C_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOB
|
||||
#define I2C_RCC_APB1Periph_I2C RCC_APB1Periph_I2C1
|
||||
#define I2C_RCC_AHB1Periph RCC_AHB1Periph_GPIOB
|
||||
#define I2C_RCC_APB1Periph RCC_APB1Periph_I2C1
|
||||
#define I2C I2C1
|
||||
#define I2C_GPIO GPIOB
|
||||
#define I2C_GPIO_PIN_SCL GPIO_Pin_8 // PB.08
|
||||
|
@ -202,10 +202,10 @@
|
|||
#define I2C_ADDRESS_CAT5137 0x5C
|
||||
|
||||
// Haptic
|
||||
#define HAPTIC_RCC_AHB1Periph_GPIO RCC_AHB1Periph_GPIOA
|
||||
#define HAPTIC_RCC_AHB1Periph RCC_AHB1Periph_GPIOA
|
||||
#define HAPTIC_RCC_APB2Periph RCC_APB2ENR_TIM11EN
|
||||
#define HAPTIC_GPIO GPIOA
|
||||
#define HAPTIC_GPIO_PIN GPIO_Pin_2
|
||||
#define HAPTIC_RCC_APB2Periph_TIMER RCC_APB2ENR_TIM11EN
|
||||
#define HAPTIC_GPIO_TIMER TIM11
|
||||
#define HAPTIC_GPIO_AF GPIO_AF_TIM11
|
||||
#define HAPTIC_GPIO_PinSource GPIO_PinSource2
|
||||
|
|
|
@ -51,9 +51,6 @@ void hapticOn(uint32_t pwmPercent)
|
|||
|
||||
void hapticInit(void)
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(HAPTIC_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(HAPTIC_RCC_APB2Periph_TIMER, ENABLE);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = HAPTIC_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
void i2cInit(void)
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(I2C_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
RCC_APB1PeriphClockCmd(I2C_RCC_APB1Periph_I2C, ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(I2C_GPIO, I2C_GPIO_PinSource_SCL, I2C_GPIO_AF);
|
||||
GPIO_PinAFConfig(I2C_GPIO, I2C_GPIO_PinSource_SDA, I2C_GPIO_AF);
|
||||
|
||||
|
|
|
@ -207,8 +207,6 @@ bool switchState(EnumKeys enuk)
|
|||
|
||||
void keysInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(KEYS_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
|
|
|
@ -349,9 +349,6 @@ void LCD_ControlLight(uint16_t dutyCycle)
|
|||
*/
|
||||
void LCD_Init(void)
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(LCD_RCC_AHB1Periph, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(LCD_RCC_APB2Periph, ENABLE);
|
||||
|
||||
/* Reset the LCD --------------------------------------------------------*/
|
||||
LCD_NRSTConfig();
|
||||
lcd_reset();
|
||||
|
@ -387,13 +384,6 @@ void LCD_SetLayer(uint32_t Layerx)
|
|||
}
|
||||
}
|
||||
|
||||
void LCD_Clear(uint16_t Color)
|
||||
{
|
||||
for (uint16_t * index = (uint16_t *)CurrentFrameBuffer; index < (uint16_t *)(CurrentFrameBuffer+DISPLAY_BUFFER_SIZE); index++) {
|
||||
*index = Color;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Configure the transparency.
|
||||
* @param transparency: specifies the transparency,
|
||||
|
@ -422,12 +412,12 @@ void lcdInit(void)
|
|||
|
||||
/* Set Background layer */
|
||||
LCD_SetLayer(LCD_FIRST_LAYER);
|
||||
LCD_Clear(0);
|
||||
// lcdClear();
|
||||
LCD_SetTransparency(0);
|
||||
|
||||
/* Set Foreground layer */
|
||||
LCD_SetLayer(LCD_SECOND_LAYER);
|
||||
LCD_Clear(0);
|
||||
lcdClear();
|
||||
LCD_SetTransparency(255);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
void ledInit()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(LED_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
RCC_AHB1PeriphClockCmd(LED_RCC_AHB1Periph, ENABLE);
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Pin = LED_GPIO_PIN;
|
||||
|
@ -51,7 +51,7 @@ void ledInit()
|
|||
|
||||
void ledOff()
|
||||
{
|
||||
RCC_AHB1PeriphClockCmd(LED_RCC_AHB1Periph_GPIO, DISABLE);
|
||||
RCC_AHB1PeriphClockCmd(LED_RCC_AHB1Periph, DISABLE);
|
||||
}
|
||||
|
||||
void ledRed()
|
||||
|
|
|
@ -55,7 +55,7 @@ void init_no_pulses(uint32_t port)
|
|||
// Timer1, channel 1
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
RCC_AHB1PeriphClockCmd(EXTMODULE_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = EXTMODULE_GPIO_PIN;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT ;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
|
|
|
@ -44,9 +44,6 @@ void pwrInit()
|
|||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
/* Clock enable */
|
||||
RCC_AHB1PeriphClockCmd(PWR_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
|
||||
/* GPIO Configuration*/
|
||||
GPIO_InitStructure.GPIO_Pin = PWR_GPIO_PIN_ON;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
|
||||
|
|
|
@ -46,8 +46,6 @@ void uart3Setup(unsigned int baudrate)
|
|||
USART_InitTypeDef USART_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(SERIAL_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(SERIAL_GPIO, SERIAL_GPIO_PinSource_RX, SERIAL_GPIO_AF);
|
||||
GPIO_PinAFConfig(SERIAL_GPIO, SERIAL_GPIO_PinSource_TX, SERIAL_GPIO_AF);
|
||||
|
||||
|
@ -58,8 +56,6 @@ void uart3Setup(unsigned int baudrate)
|
|||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
GPIO_Init(SERIAL_GPIO, &GPIO_InitStructure);
|
||||
|
||||
RCC_APB1PeriphClockCmd(SERIAL_RCC_APB1Periph_USART, ENABLE);
|
||||
|
||||
USART_InitStructure.USART_BaudRate = baudrate;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
USART_InitStructure.USART_StopBits = USART_StopBits_1;
|
||||
|
|
|
@ -48,8 +48,6 @@ void telemetryPortInit(uint32_t baudrate)
|
|||
USART_InitTypeDef USART_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
|
||||
RCC_AHB1PeriphClockCmd(TELEMETRY_RCC_AHB1Periph_GPIO, ENABLE);
|
||||
|
||||
GPIO_PinAFConfig(TELEMETRY_GPIO, TELEMETRY_GPIO_PinSource_RX, TELEMETRY_GPIO_AF);
|
||||
GPIO_PinAFConfig(TELEMETRY_GPIO, TELEMETRY_GPIO_PinSource_TX, TELEMETRY_GPIO_AF);
|
||||
|
||||
|
@ -65,8 +63,6 @@ void telemetryPortInit(uint32_t baudrate)
|
|||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
|
||||
GPIO_Init(TELEMETRY_GPIO_DIR, &GPIO_InitStructure);
|
||||
GPIO_ResetBits(TELEMETRY_GPIO_DIR, TELEMETRY_GPIO_PIN_DIR);
|
||||
|
||||
RCC_APB1PeriphClockCmd(TELEMETRY_RCC_APB1Periph_USART, ENABLE);
|
||||
|
||||
USART_InitStructure.USART_BaudRate = baudrate;
|
||||
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue