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

Should have mentioned in the above: Encoder code is specific to the STM32F4, tested on Nucleo F401, should work on the Nucleo F411..

/media/uploads/gregeric/img_20150121_093103_744-1-.jpg /media/uploads/gregeric/img_20150121_093055_682-1-.jpg

Committer:
gregeric
Date:
Thu Jan 22 10:01:49 2015 +0000
Revision:
3:267e7130007d
Parent:
2:b1169b84a563
Increase debounce time, shown necessary after round of testing.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gregeric 2:b1169b84a563 1 #include "mbed.h"
gregeric 2:b1169b84a563 2 /*
gregeric 2:b1169b84a563 3 * HAL_TIM_Encoder_MspInit()
gregeric 2:b1169b84a563 4 * Overrides the __weak function stub in stm32f4xx_hal_tim.h
gregeric 2:b1169b84a563 5 *
gregeric 2:b1169b84a563 6 * Edit the below for your preferred pin wiring & pullup/down
gregeric 2:b1169b84a563 7 * I have encoder common at 3V3, using GPIO_PULLDOWN on inputs.
gregeric 2:b1169b84a563 8 * Encoder A&B outputs connected directly to GPIOs.
gregeric 2:b1169b84a563 9 *
gregeric 2:b1169b84a563 10 * All Nucleos support encoders, from 030 up.
gregeric 2:b1169b84a563 11 * On 030, there's only TIM3 @ AF1 PA6 PA7 (D11 D12)
gregeric 2:b1169b84a563 12 */
gregeric 2:b1169b84a563 13
gregeric 2:b1169b84a563 14 #ifdef TARGET_STM32F0
gregeric 2:b1169b84a563 15 void HAL_TIM_Encoder_MspInit(TIM_HandleTypeDef *htim)
gregeric 2:b1169b84a563 16 {
gregeric 2:b1169b84a563 17 GPIO_InitTypeDef GPIO_InitStruct;
gregeric 2:b1169b84a563 18
gregeric 2:b1169b84a563 19 if (htim->Instance == TIM3) { //PA6 PA7 = Nucleo D12 D11
gregeric 2:b1169b84a563 20 __TIM3_CLK_ENABLE();
gregeric 2:b1169b84a563 21 __GPIOA_CLK_ENABLE();
gregeric 2:b1169b84a563 22 GPIO_InitStruct.Pin = GPIO_PIN_6 | GPIO_PIN_7;
gregeric 2:b1169b84a563 23 GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
gregeric 2:b1169b84a563 24 GPIO_InitStruct.Pull = GPIO_PULLDOWN;
gregeric 2:b1169b84a563 25 GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
gregeric 2:b1169b84a563 26 GPIO_InitStruct.Alternate = GPIO_AF1_TIM3;
gregeric 2:b1169b84a563 27 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
gregeric 2:b1169b84a563 28 }
gregeric 2:b1169b84a563 29 }
gregeric 2:b1169b84a563 30 #endif