diff --git a/examples/stm32f103c8t6_blue_pill/graphics/main.cpp b/examples/stm32f103c8t6_blue_pill/graphics/main.cpp new file mode 100644 index 0000000000..ca41bec590 --- /dev/null +++ b/examples/stm32f103c8t6_blue_pill/graphics/main.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016, Sascha Schade + * Copyright (c) 2017, Niklas Hauser + * + * This file is part of the modm project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +// ---------------------------------------------------------------------------- + +#include +#include +using namespace Board; + +namespace display +{ + using Spi = SpiMaster1; + using Cs = modm::platform::GpioA4; + using Sck = modm::platform::GpioA5; + using Miso = modm::platform::GpioA6; + using Mosi = modm::platform::GpioA7; + using DataCommands = modm::platform::GpioB0; + using Reset = modm::platform::GpioB1; + using Backlight = modm::platform::GpioB10; +} + +modm::Ili9341Spi< + display::Spi, + display::Cs, + display::DataCommands, + display::Reset, + display::Backlight +> tft; + +/* + * Blinks the green user LED with 1 Hz. + * It is on for 90% of the time and off for 10% of the time. + */ + +int +main() +{ + using namespace modm::literals; + Board::initialize(); + display::Spi::connect< + display::Sck::Sck, display::Miso::Miso, display::Mosi::Mosi>(); + display::Spi::initialize(); + tft.initialize(); + LedGreen::set(); + tft.setColor(modm::glcd::Color::black()); + int16_t w = tft.getWidth(); + int16_t h = tft.getHeight(); + tft.drawLine({0,0}, {w, h}); + tft.drawLine({w,0}, {0, h}); + + while (true) + { + LedGreen::set(); + modm::delay(900ms); + + LedGreen::reset(); + modm::delay(100ms); + } + + return 0; +} diff --git a/examples/stm32f103c8t6_blue_pill/graphics/openocd.cfg b/examples/stm32f103c8t6_blue_pill/graphics/openocd.cfg new file mode 100644 index 0000000000..b157e7e432 --- /dev/null +++ b/examples/stm32f103c8t6_blue_pill/graphics/openocd.cfg @@ -0,0 +1,2 @@ +# Replace this with your custom programmer +source [find interface/stlink-v2.cfg] diff --git a/examples/stm32f103c8t6_blue_pill/graphics/project.xml b/examples/stm32f103c8t6_blue_pill/graphics/project.xml new file mode 100644 index 0000000000..268b078be2 --- /dev/null +++ b/examples/stm32f103c8t6_blue_pill/graphics/project.xml @@ -0,0 +1,12 @@ + + modm:blue-pill + + + + + + modm:build:scons + modm:driver:ili9341 + modm:platform:spi:1 + + diff --git a/src/modm/driver/display/ili9341.hpp b/src/modm/driver/display/ili9341.hpp index 0e2aea956b..bbf47fa5e2 100644 --- a/src/modm/driver/display/ili9341.hpp +++ b/src/modm/driver/display/ili9341.hpp @@ -162,7 +162,7 @@ class Ili9341 : public Interface, public modm::GraphicDisplay using Rotation = ili9341::Rotation; using DisplayMode = ili9341::DisplayMode; - template, std::enable_if_t = 0> + template, std::enable_if_t = 0> Ili9341(): Interface() { Reset::setOutput(modm::Gpio::High);