mayhem-firmware/firmware/common/lcd_ili9341.hpp
furrtek 8009a9b543 Merge remote-tracking branch 'upstream/master'
Conflicts:
	firmware/application/Makefile
	firmware/application/analog_audio_app.cpp
	firmware/application/analog_audio_app.hpp
	firmware/application/event.cpp
	firmware/application/irq_ipc.hpp
	firmware/application/portapack.hpp
	firmware/application/receiver_model.cpp
	firmware/application/receiver_model.hpp
	firmware/application/recent_entries.cpp
	firmware/application/string_format.hpp
	firmware/application/ui_debug.cpp
	firmware/application/ui_debug.hpp
	firmware/application/ui_menu.cpp
	firmware/application/ui_navigation.cpp
	firmware/application/ui_navigation.hpp
	firmware/application/ui_receiver.cpp
	firmware/application/ui_receiver.hpp
	firmware/application/ui_sd_card_status_view.cpp
	firmware/application/ui_sd_card_status_view.hpp
	firmware/application/ui_setup.cpp
	firmware/application/ui_setup.hpp
	firmware/application/ui_spectrum.hpp
	firmware/baseband-tx/dsp_fir_taps.cpp
	firmware/baseband-tx/dsp_fir_taps.hpp
	firmware/baseband-tx/irq_ipc_m4.cpp
	firmware/baseband-tx/irq_ipc_m4.hpp
	firmware/baseband-tx/proc_audiotx.cpp
	firmware/baseband/Makefile
	firmware/baseband/audio_output.cpp
	firmware/baseband/audio_output.hpp
	firmware/baseband/block_decimator.hpp
	firmware/baseband/dsp_decimate.cpp
	firmware/baseband/dsp_decimate.hpp
	firmware/baseband/dsp_demodulate.cpp
	firmware/baseband/dsp_demodulate.hpp
	firmware/baseband/dsp_fir_taps.cpp
	firmware/baseband/irq_ipc_m4.cpp
	firmware/baseband/irq_ipc_m4.hpp
	firmware/baseband/proc_am_audio.cpp
	firmware/baseband/proc_am_audio.hpp
	firmware/baseband/proc_nfm_audio.cpp
	firmware/baseband/proc_nfm_audio.hpp
	firmware/baseband/proc_wfm_audio.cpp
	firmware/baseband/proc_wfm_audio.hpp
	firmware/baseband/spectrum_collector.hpp
	firmware/common/dsp_fir_taps.cpp
	firmware/common/dsp_fir_taps.hpp
	firmware/common/event.hpp
	firmware/common/message.hpp
	firmware/common/ui_painter.cpp
	firmware/common/ui_painter.hpp
2016-02-04 11:35:55 +01:00

113 lines
2.9 KiB
C++

/*
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
*
* This file is part of PortaPack.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef __LCD_ILI9341_H__
#define __LCD_ILI9341_H__
#include "ui.hpp"
#include "ui_text.hpp"
#include <cstdint>
#include <array>
namespace lcd {
class ILI9341 {
public:
constexpr ILI9341(
) : scroll_state { 0, 0, 320, 0 }
{
}
ILI9341(const ILI9341&) = delete;
ILI9341(ILI9341&&) = delete;
void operator=(const ILI9341&) = delete;
void init();
void shutdown();
void sleep();
void wake();
void fill_rectangle(ui::Rect r, const ui::Color c);
void draw_line(const ui::Point start, const ui::Point end, const ui::Color color);
void fill_circle(
const ui::Point center,
const ui::Dim radius,
const ui::Color foreground,
const ui::Color background
);
void draw_pixel(const ui::Point p, const ui::Color color);
void drawBMP(const ui::Point p, const uint8_t * bitmap);
void render_line(const ui::Point p, const uint8_t count, const ui::Color* line_buffer);
void render_box(const ui::Point p, const ui::Size s, const ui::Color* line_buffer);
template<size_t N>
void draw_pixels(
const ui::Rect r,
const std::array<ui::Color, N>& colors
) {
draw_pixels(r, colors.data(), colors.size());
}
void draw_bitmap(
const ui::Point p,
const ui::Size size,
const uint8_t* const data,
const ui::Color foreground,
const ui::Color background
);
void draw_glyph(
const ui::Point p,
const ui::Glyph& glyph,
const ui::Color foreground,
const ui::Color background
);
void scroll_set_area(const ui::Coord top_y, const ui::Coord bottom_y);
ui::Coord scroll_set_position(const ui::Coord position);
ui::Coord scroll(const int32_t delta);
ui::Coord scroll_area_y(const ui::Coord y) const;
void scroll_disable();
constexpr ui::Dim width() const { return 240; }
constexpr ui::Dim height() const { return 320; }
constexpr ui::Rect screen_rect() const { return { 0, 0, width(), height() }; }
private:
struct scroll_t {
uint16_t top_area;
uint16_t bottom_area;
uint16_t height;
uint16_t current_position;
};
scroll_t scroll_state;
void draw_pixels(const ui::Rect r, const ui::Color* const colors, const size_t count);
};
} /* namespace lcd */
#endif/*__LCD_ILI9341_H__*/