Skip to content

Commit

Permalink
remove whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
TomSaw committed Jul 30, 2021
1 parent 8818fa9 commit c6c0bd0
Show file tree
Hide file tree
Showing 22 changed files with 633 additions and 337 deletions.
20 changes: 13 additions & 7 deletions src/modm/driver/display/ili9341.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2019, Mike Wolfram
* Copyright (c) 2021, Thomas Sommer
*
* This file is part of the modm project.
*
Expand All @@ -15,7 +16,11 @@
#include <modm/architecture/interface/register.hpp>
#include <modm/platform/gpio/base.hpp>
#include <modm/processing/resumable.hpp>
#include <modm/ui/graphic.hpp>

#include <modm/ui/graphic/display.hpp>
#include <modm/ui/graphic/buffer.hpp>
#include <modm/ui/graphic/buffer_bool.hpp>
// #include <modm/ui/graphic/painter_remote.hpp>

#include "ili9341_interface_parallel.hpp"
#include "ili9341_interface_spi.hpp"
Expand All @@ -28,8 +33,9 @@ namespace modm
/// @ingroup modm_driver_ili9341
template<class Interface, class Reset, typename RB = Resolution<32, 32>>
class Ili9341
: public Interface, public Display<color::Rgb565<true>, Resolution<320, 240>>,
public ShapePainter<Resolution<320, 240>, true>,
: public Interface,
// : public RemotePainter<Resolution<320, 240>, Interface>,
public Display<color::Rgb565<true>, Resolution<320, 240>>,
public FlashPainter<true>
// TODO LocalPainter must be available so we can Paint directly on ili9341
// class Ili9341 : public Interface, public Display<color::Rgb565<true>, 320, 240>, public LocalPainter<320, 240>
Expand All @@ -43,7 +49,8 @@ class Ili9341

public:
template<typename... Args>
Ili9341(Args &&...args) : Interface(std::forward<Args>(args)...),
Ili9341(Args &&...args) :
Interface(std::forward<Args>(args)...),
Display<color::Rgb565<true>, Resolution<320, 240>>(color::html::White)
{ Reset::setOutput(modm::Gpio::High); }

Expand Down Expand Up @@ -119,7 +126,7 @@ class Ili9341
modm::ResumableResult<void> setClipping(Point point);
modm::ResumableResult<void> setClipping(Area area);

// TODO add final
// TODO Add final as soon as RemotePainter is connected
// Hardware accelerated drawing directly on the screen
modm::ResumableResult<void> drawFast(Point point);
modm::ResumableResult<void> drawFast(HLine hline);
Expand All @@ -133,8 +140,7 @@ class Ili9341
uint16_t buff_cmd16[3];
ili9341_register::MemoryAccessCtrl_t madCtrl;

// Parallel use in resumable function
// No overlap permitted!
// Parallel use in resumable function: don't overlap!
struct {
// Buffer for color conversion
modm::Buffer<modm::color::Rgb565<true>, RB> bufferRgb565;
Expand Down
2 changes: 1 addition & 1 deletion src/modm/driver/display/ili9341_interface_spi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ template<class SpiMaster, class Cs, class Dc>
class Ili9341InterfaceSpi : public ili9341_register, public modm::SpiDevice< SpiMaster >, protected modm::NestedResumable<4>
{
uint8_t read;
public:
protected:
Ili9341InterfaceSpi()
{
this->attachConfigurationHandler([]() {
Expand Down
14 changes: 13 additions & 1 deletion src/modm/driver/display/ili9341_register.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Copyright (c) 2019, Mike Wolfram
* Copyright (c) 2021, Thomas Sommer
*
* 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/.
*/

#pragma once

#include <modm/math/utils/bit_constants.hpp>
Expand All @@ -24,7 +35,8 @@ struct ili9341_register
ContentAdaptiveBrightnessCtrl = 0x55,
CabcMinimumBrightness = 0x5E,
};
protected:

// protected:
enum class Command : uint8_t
{
Nop = 0x00,
Expand Down
4 changes: 3 additions & 1 deletion src/modm/driver/display/ssd1306.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#include <modm/architecture/interface/i2c_device.hpp>
#include <modm/architecture/utils.hpp>
#include <modm/processing/timer.hpp>
#include <modm/ui/graphic.hpp>

#include <modm/ui/graphic/display.hpp>
#include <modm/ui/graphic/buffer_bool.hpp>

#include "ssd1306_register.hpp"

Expand Down
6 changes: 3 additions & 3 deletions src/modm/ui/graphic/buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#ifndef MODM_BUFFER_HPP
#define MODM_BUFFER_HPP

#include "painter_shape.hpp"
#include "painter_local.hpp"
#include "painter_text.hpp"
#include "../color.hpp"

Expand All @@ -25,7 +25,7 @@ namespace modm
* Colored Graphic buffer
*
* @tparam C Pixelcolor
* @tparam R Pixels Width and Height
* @tparam R Resolution with Pixels horizontal and vertical
*
* @author Thomas Sommer
* @ingroup modm_ui_graphic
Expand All @@ -34,7 +34,7 @@ namespace modm
// May inherit on modm::Matrix<..> or provide a conversion constructor for modm::Matrix<..>
template<typename C, typename R>
requires C::isColor or std::is_same_v<C, bool>
class Buffer : public ShapePainter<R, false>, public TextPainter<R>
class Buffer : public LocalPainter<R>, public TextPainter<R>
{
public:
C color = html::White;
Expand Down
7 changes: 4 additions & 3 deletions src/modm/ui/graphic/buffer_bool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@

#include <algorithm>

#include "painter_shape.hpp"
#include "painter_local.hpp"
#include "painter_text.hpp"
namespace modm
{

/**
* Monochrome Graphic buffer
*
* @tparam R Pixels Width and Height
* @tparam R Resolution with Pixels horizontal and vertical
*
* @author Thomas Sommer
* @ingroup modm_ui_graphic
*/
template<typename R>
class Buffer<bool, R> : public ShapePainter<R, false>, public TextPainter<R>
class Buffer<bool, R> : public LocalPainter<R>, public TextPainter<R>
{
// Buffer stacks up to 8 pixels in one byte
static constexpr size_t HB = (R::H + 7) / 8;
public:
bool color = true;
Expand Down
8 changes: 4 additions & 4 deletions src/modm/ui/graphic/buffer_bool_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ template<typename R>
void
modm::Buffer<bool, R>::drawFast(Point point)
{
// OPTIMIZE evaluate color in ShapePainter ?
// OPTIMIZE Switch color in LocalPainter ?
if (color)
this->buffer[point.y / 8][point.x] |= (1 << point.y % 8);
else
Expand All @@ -246,7 +246,7 @@ modm::Buffer<bool, R>::drawFast(HLine hline)

size_t x = hline.start.x;

// OPTIMIZE evaluate color in ShapePainter ?
// OPTIMIZE Switch color in LocalPainter ?
if(color)
while (x < hline.end_x)
buffer[yb][x++] |= byte;
Expand All @@ -262,7 +262,7 @@ modm::Buffer<bool, R>::drawFast(VLine vline)
size_t yb = vline.start.y / 8;
const size_t yb_max = vline.end_y / 8;

// OPTIMIZE evaluate color in ShapePainter ?
// OPTIMIZE Switch color in LocalPainter ?
if (color)
{
uint8_t byte = 0xFF << vline.start.y % 8; // Mask out top end
Expand Down Expand Up @@ -298,7 +298,7 @@ modm::Buffer<bool, R>::drawFast(Area area)
const size_t yb_max = area.bottomRight.y / 8;
size_t yb = area.topLeft.y / 8;

// OPTIMIZE evaluate color in ShapePainter
// OPTIMIZE Switch color in LocalPainter
if (color)
{
uint8_t byte = 0xFF << area.topLeft.y % 8; // Mask out top end
Expand Down
2 changes: 1 addition & 1 deletion src/modm/ui/graphic/canvas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct Resolution{
/**
* Baseclass for 2D Graphic Objects like Display and Buffer
*
* @tparam R Pixels Width and Height
* @tparam R Resolution with Pixels horizontal and vertical
*
* @author Thomas Sommer
* @ingroup modm_ui_graphic
Expand Down
185 changes: 0 additions & 185 deletions src/modm/ui/graphic/painter.hpp

This file was deleted.

Loading

0 comments on commit c6c0bd0

Please sign in to comment.