Modified Bob Stone's code for ILI9341 QVGA TFT's without touch capability. Navigation is now done with rotary encoders - two for position, & one setting the maxiterations.

Dependencies:   SPI_TFT_ILI9341 TFT_fonts mbed

Fork of Mandelbrot by Bob Stone

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EncoderMspInitF0.cpp Source File

EncoderMspInitF0.cpp

00001 #include "mbed.h"
00002 /*
00003  * HAL_TIM_Encoder_MspInit()
00004  * Overrides the __weak function stub in stm32f4xx_hal_tim.h
00005  *
00006  * Edit the below for your preferred pin wiring & pullup/down
00007  * I have encoder common at 3V3, using GPIO_PULLDOWN on inputs.
00008  * Encoder A&B outputs connected directly to GPIOs.
00009  *
00010  * All Nucleos support encoders, from 030 up.
00011  * On 030, there's only TIM3 @ AF1 PA6 PA7 (D11 D12)
00012  */
00013 
00014 #ifdef TARGET_STM32F0
00015 void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
00016 {
00017     GPIO_InitTypeDef GPIO_InitStruct;
00018 
00019     if (htim->Instance == TIM3) { //PA6 PA7 = Nucleo D12 D11
00020         __TIM3_CLK_ENABLE();
00021         __GPIOA_CLK_ENABLE();
00022         GPIO_InitStruct.Pin = GPIO_PIN_6 | GPIO_PIN_7;
00023         GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
00024         GPIO_InitStruct.Pull = GPIO_PULLDOWN;
00025         GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
00026         GPIO_InitStruct.Alternate = GPIO_AF1_TIM3;
00027         HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
00028     }
00029 }
00030 #endif