Full color support, rework the directory structure
This commit is contained in:
59
BlinkTask.h
59
BlinkTask.h
@@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 Max Regan
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "macros.h"
|
|
||||||
|
|
||||||
#include "ReturnCode.h"
|
|
||||||
#include "Time.h"
|
|
||||||
#include "SystemTime.h"
|
|
||||||
|
|
||||||
class BlinkTask : public Common::Schedule::Task {
|
|
||||||
public:
|
|
||||||
|
|
||||||
BlinkTask(Common::time_t blink_period)
|
|
||||||
: m_period(blink_period)
|
|
||||||
{}
|
|
||||||
|
|
||||||
Common::ReturnCode init() {
|
|
||||||
/** Enable Port A,B clock */
|
|
||||||
SET(RCC->IOPENR, RCC_IOPENR_IOPBEN);
|
|
||||||
/** Enable pin P3 for output */
|
|
||||||
SET_TO(GPIOB->MODER,
|
|
||||||
GPIO_MODER_MODE3,
|
|
||||||
GPIO_MODER_MODE3_0);
|
|
||||||
|
|
||||||
CLR(GPIOB->OTYPER, GPIO_OTYPER_OT_3);
|
|
||||||
CLR(GPIOB->PUPDR, GPIO_PUPDR_PUPD3);
|
|
||||||
|
|
||||||
return Common::ReturnCode::OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
Common::Schedule::NextTime execute() override {
|
|
||||||
FLIP(GPIOB->ODR, GPIO_ODR_OD3);
|
|
||||||
|
|
||||||
return Common::Schedule::NextTime::in(m_period / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Common::time_t m_period;
|
|
||||||
};
|
|
||||||
@@ -1,341 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 Max Regan
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "DisplayDriver.h"
|
|
||||||
#include "macros.h"
|
|
||||||
#include "font.h"
|
|
||||||
|
|
||||||
namespace BSP {
|
|
||||||
|
|
||||||
using Common::Schedule::NextTime;
|
|
||||||
using Common::ReturnCode;
|
|
||||||
|
|
||||||
DisplayDriver::DisplayDriver(Common::Schedule::TaskScheduler &scheduler, SpiDriver &spi)
|
|
||||||
: m_scheduler(scheduler)
|
|
||||||
, m_spi(spi)
|
|
||||||
, m_is_dirty(true)
|
|
||||||
, m_dirty_line_min(0)
|
|
||||||
, m_dirty_line_max(0)
|
|
||||||
{
|
|
||||||
buffer_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnCode DisplayDriver::init()
|
|
||||||
{
|
|
||||||
return Common::ReturnCode::OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NextTime DisplayDriver::execute()
|
|
||||||
{
|
|
||||||
return NextTime::never();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::buffer_init()
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(m_buffer.lines); i++) {
|
|
||||||
struct display_line &line = m_buffer.lines[i];
|
|
||||||
line.mode = 1; // Update display
|
|
||||||
line.line = i + 1; // Line numbers start at 1
|
|
||||||
for (size_t j = 0; j < ARRAY_SIZE(line.data); j++) {
|
|
||||||
line.data[j] = 0xFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_buffer.dummy = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::set_dirty(unsigned int y)
|
|
||||||
{
|
|
||||||
if (!m_is_dirty) {
|
|
||||||
m_is_dirty = true;
|
|
||||||
m_dirty_line_min = y;
|
|
||||||
m_dirty_line_max = y;
|
|
||||||
} else {
|
|
||||||
m_dirty_line_min = MIN(y, m_dirty_line_min);
|
|
||||||
m_dirty_line_max = MAX(y, m_dirty_line_max);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::set_bit(uint32_t x, uint32_t y, uint8_t val)
|
|
||||||
{
|
|
||||||
if (x >= DISPLAY_WIDTH || y >= DISPLAY_HEIGHT) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct display_line &line = m_buffer.lines[y];
|
|
||||||
uint8_t *byte = &line.data[x >> 3];
|
|
||||||
if (val) {
|
|
||||||
CLR_POS(*byte, x & 7);
|
|
||||||
} else {
|
|
||||||
SET_POS(*byte, x & 7);
|
|
||||||
}
|
|
||||||
|
|
||||||
set_dirty(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t DisplayDriver::get_bit(uint32_t x, uint32_t y)
|
|
||||||
{
|
|
||||||
struct display_line &line = m_buffer.lines[y];
|
|
||||||
return (line.data[x >> 3] >> (x & 7)) & 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::set_byte(uint32_t x, uint32_t y, uint8_t val)
|
|
||||||
{
|
|
||||||
// if (x >= DISPLAY_WIDTH || y >= DISPLAY_HEIGHT) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (x & 7) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
struct display_line &line = m_buffer.lines[y];
|
|
||||||
line.data[x >> 3] = val;
|
|
||||||
set_dirty(y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: write my own implementation
|
|
||||||
#define R2(n) n, n + 2*64, n + 1*64, n + 3*64
|
|
||||||
#define R4(n) R2(n), R2(n + 2*16), R2(n + 1*16), R2(n + 3*16)
|
|
||||||
#define R6(n) R4(n), R4(n + 2*4 ), R4(n + 1*4 ), R4(n + 3*4 )
|
|
||||||
|
|
||||||
static constexpr unsigned char BitReverseTable256[256] =
|
|
||||||
{
|
|
||||||
R6(0), R6(2), R6(1), R6(3)
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned char ReverseBitsLookupTable(unsigned char v)
|
|
||||||
{
|
|
||||||
return BitReverseTable256[v];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This variant is ~4x faster than the unaligned version, but
|
|
||||||
* (obviously) requires that everything is aligned correctly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DisplayDriver::clear_glyph_aligned(uint32_t x_off, uint32_t y_off, const struct font *f, const struct glyph *g)
|
|
||||||
{
|
|
||||||
for (uint32_t y = y_off; y < y_off + f->height + g->top && y < DISPLAY_HEIGHT; y++) {
|
|
||||||
uint8_t *start = (uint8_t *) &m_buffer.lines[y].data[(x_off) >> 3];
|
|
||||||
uint8_t *end = (uint8_t *) &m_buffer.lines[y].data[(x_off + f->width) >> 3];
|
|
||||||
memset(start, 0xFF, end - start);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void DisplayDriver::bit_copy(uint8_t *src, unsigned int src_bit_offset,
|
|
||||||
// uint8_t *dst, unsigned int dst_bit_offset,
|
|
||||||
// unsigned int bit_len)
|
|
||||||
// {
|
|
||||||
// uint8_t buffer;
|
|
||||||
|
|
||||||
// if (src_bit_offset == && dst_bit_offset == 0) {
|
|
||||||
// /* The "happy" case, where both src and dst are byte-aligned */
|
|
||||||
// unsigned int byte_count = bit_len / 8;
|
|
||||||
// memcpy(dst, src, byte_count);
|
|
||||||
// if (bit_len & 7) {
|
|
||||||
// uint8_t mask = (1 << bit_len & 7) - 1;
|
|
||||||
// dst[byte_count] &= ~mask;
|
|
||||||
// dst[byte_count] |= mask & src[byte_count];
|
|
||||||
// }
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (bit_len >= 8) {
|
|
||||||
|
|
||||||
// // Start the initial byte
|
|
||||||
// buffer = *(src++) >> src_bit_offset;
|
|
||||||
// buffer |= *(src) << (8 - src_bit_offset);
|
|
||||||
|
|
||||||
|
|
||||||
// // The main copy loop
|
|
||||||
|
|
||||||
|
|
||||||
// // Set the last byte/bits
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (bits_copied = 0; bits_copied + 8 < bit_len; bits_copied += 8) {
|
|
||||||
// *dst
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
void DisplayDriver::clear_glyph_unaligned(uint32_t x_off, uint32_t y_off, const struct font *font, const struct glyph *g)
|
|
||||||
{
|
|
||||||
int16_t x = 0;
|
|
||||||
if (x & 7) {
|
|
||||||
while ((x & 7) && x < font->width) {
|
|
||||||
// TODO: use a switch on (x & 7) instead?
|
|
||||||
for (int16_t y = 0; y < font->height && y < (int16_t) DISPLAY_HEIGHT; y++) {
|
|
||||||
set_bit(x_off + x, y_off + y + font->height - g->top, 0);
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
while (font->width - x > 0) {
|
|
||||||
for (int16_t y = 0; y < font->height && y < (int16_t) DISPLAY_HEIGHT; y++) {
|
|
||||||
set_bit(x_off + x, y_off + y + font->height - g->top, 0);
|
|
||||||
}
|
|
||||||
x++;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DisplayDriver::write_glyph_unaligned(uint32_t x_off, uint32_t y_off, const struct font *f, const struct glyph *g)
|
|
||||||
{
|
|
||||||
|
|
||||||
int byte_cols = g->width_bytes;
|
|
||||||
|
|
||||||
for (size_t x = 0; x < g->width && x + x_off + g->left < DISPLAY_WIDTH; x++) {
|
|
||||||
for (size_t y = 0; y < g->height && y_off + y + f->height - g->top < DISPLAY_HEIGHT; y++) {
|
|
||||||
int byte_x = x / 8;
|
|
||||||
int byte_y = y;
|
|
||||||
uint8_t bit = (g->bitmap[byte_y * byte_cols + byte_x] >> (7 - (x & 7))) & 1;
|
|
||||||
set_bit(g->left + x_off + x,
|
|
||||||
y_off + y + f->height - g->top,
|
|
||||||
bit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::draw_hline(uint32_t x, uint32_t y, uint32_t width)
|
|
||||||
{
|
|
||||||
for (uint32_t i = 0; i < width; i += 8) {
|
|
||||||
set_byte(x + i, y, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void DisplayDriver::write_glyph_unaligned2(int *x_off, int y_off, const struct font *font, const struct glyph *g)
|
|
||||||
// {
|
|
||||||
// int byte_cols = g->cols / 8;
|
|
||||||
// if (g->cols & 7) {
|
|
||||||
// byte_cols++;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (size_t x = 0; x < g->cols; x++) {
|
|
||||||
// for (size_t y = 0; y < g->rows && y < DISPLAY_HEIGHT; y++) {
|
|
||||||
// int byte_x = x / 8;
|
|
||||||
// int byte_y = y;
|
|
||||||
// uint8_t bit = (g->bitmap[byte_y * byte_cols + byte_x] >> (7 - (x & 7))) & 1;
|
|
||||||
// set_bit(g->left + *x_off + x, y_off + y + font->size - g->top, bit);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This variant is ~4x faster than the unaligned version, but
|
|
||||||
* requires that everything is aligned correctly.
|
|
||||||
*/
|
|
||||||
void DisplayDriver::write_glyph_aligned(uint32_t x_off, uint32_t y_off,
|
|
||||||
const struct font *, const struct glyph *g)
|
|
||||||
{
|
|
||||||
int byte_cols = g->width_bytes;
|
|
||||||
|
|
||||||
|
|
||||||
for (size_t x = 0; x < g->width; x += 8) {
|
|
||||||
for (size_t y = 0, byte_y = 0; y < g->height && y < DISPLAY_HEIGHT; y++, byte_y += byte_cols) {
|
|
||||||
int byte_x = x / 8;
|
|
||||||
uint8_t byte = g->bitmap[byte_y + byte_x];
|
|
||||||
set_byte(g->left + x_off + x,
|
|
||||||
y_off + y + g->height - g->top,
|
|
||||||
~ReverseBitsLookupTable(byte));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::char_at(uint32_t *x_off, uint32_t y_off, char c, const struct font *font)
|
|
||||||
{
|
|
||||||
const struct glyph *g = glyph_for_char(font, c);
|
|
||||||
if (g == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*x_off + font->width >= DISPLAY_WIDTH) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(*x_off & 7) && !(font->width & 7)) {
|
|
||||||
clear_glyph_aligned(*x_off, y_off, font, g);
|
|
||||||
} else {
|
|
||||||
clear_glyph_unaligned(*x_off, y_off, font, g);
|
|
||||||
}
|
|
||||||
|
|
||||||
write_glyph_unaligned(*x_off, y_off, font, g);
|
|
||||||
|
|
||||||
m_dirty_line_min = MIN(m_dirty_line_min, y_off);
|
|
||||||
m_dirty_line_max = MAX(m_dirty_line_max, y_off + g->height);
|
|
||||||
m_is_dirty = true;
|
|
||||||
*x_off += font->width;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::string_at(uint32_t *x_off, uint32_t y_off, const char *string, const struct font *font)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while (string[i]) {
|
|
||||||
char_at(x_off, y_off, string[i], font);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void DisplayDriver::refresh()
|
|
||||||
{
|
|
||||||
if (!m_is_dirty) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t *start = (uint8_t *) &m_buffer.lines[m_dirty_line_min];
|
|
||||||
// Data size
|
|
||||||
size_t size = sizeof(m_buffer.lines[0]) * (m_dirty_line_max - m_dirty_line_min + 1);
|
|
||||||
// Trailer dummy data
|
|
||||||
size += 2;
|
|
||||||
|
|
||||||
m_spi.tx_blocking(start, size);
|
|
||||||
m_is_dirty = false;
|
|
||||||
m_dirty_line_min = DISPLAY_HEIGHT - 1;
|
|
||||||
m_dirty_line_max = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DisplayDriver::clear()
|
|
||||||
{
|
|
||||||
buffer_init();
|
|
||||||
m_is_dirty = true;
|
|
||||||
m_dirty_line_min = 0;
|
|
||||||
m_dirty_line_max = DISPLAY_HEIGHT - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: put me somewhere fonty
|
|
||||||
const struct glyph *DisplayDriver::glyph_for_char(const struct font *font, char c)
|
|
||||||
{
|
|
||||||
return font->glyphs[(size_t) c];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 Max Regan
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
* THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Task.h"
|
|
||||||
|
|
||||||
class Screen : Common::Task::Schedule {
|
|
||||||
public:
|
|
||||||
virtual void init() = 0;
|
|
||||||
virtual void cleanup() = 0;
|
|
||||||
};
|
|
||||||
BIN
cad/board.FCStd
Normal file
BIN
cad/board.FCStd
Normal file
Binary file not shown.
93175
cad/board.step
Normal file
93175
cad/board.step
Normal file
File diff suppressed because it is too large
Load Diff
BIN
cad/case.FCStd
Normal file
BIN
cad/case.FCStd
Normal file
Binary file not shown.
BIN
cad/case2.FCStd
Normal file
BIN
cad/case2.FCStd
Normal file
Binary file not shown.
BIN
cad/case2.FCStd1
Normal file
BIN
cad/case2.FCStd1
Normal file
Binary file not shown.
@@ -19,9 +19,10 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ButtonManager.h"
|
#include "Application/ButtonManager.h"
|
||||||
#include "SystemTime.h"
|
#include "Bsp/SystemTime.h"
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "stm32l0xx.h"
|
#include "stm32l0xx.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "TaskScheduler.h"
|
#include "Bsp/TaskScheduler.h"
|
||||||
#include "Task.h"
|
#include "Bsp/Task.h"
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
|
|
||||||
@@ -23,13 +23,13 @@
|
|||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "macros.h"
|
#include "Bsp/Drivers/DisplayDriver.h"
|
||||||
|
#include "Bsp/ReturnCode.h"
|
||||||
|
#include "Bsp/Task.h"
|
||||||
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "DisplayDriver.h"
|
#include "Application/ButtonManager.h"
|
||||||
#include "ButtonManager.h"
|
#include "Application/Screens/Screen.h"
|
||||||
#include "ReturnCode.h"
|
|
||||||
#include "Screen.h"
|
|
||||||
#include "Task.h"
|
|
||||||
|
|
||||||
class ScreenManager : public Common::Schedule::Task {
|
class ScreenManager : public Common::Schedule::Task {
|
||||||
public:
|
public:
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "SystemFonts.h"
|
#include "Application/SystemFonts.h"
|
||||||
#include "ScreenManager.h"
|
#include "Application/ScreenManager.h"
|
||||||
#include "Screen.h"
|
#include "Application/Screens/Screen.h"
|
||||||
|
|
||||||
class DebugScreen : public Screen {
|
class DebugScreen : public Screen {
|
||||||
public:
|
public:
|
||||||
@@ -19,22 +19,22 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "DisplayTimeScreen.h"
|
#include "Application/Screens/DisplayTimeScreen.h"
|
||||||
#include "RtcDriver.h"
|
#include "Application/SystemFonts.h"
|
||||||
#include "SystemTime.h"
|
#include "Bsp/Drivers/RtcDriver.h"
|
||||||
#include "SystemFonts.h"
|
#include "Bsp/SystemTime.h"
|
||||||
#include "LowPower.h"
|
#include "Bsp/Drivers/LowPower.h"
|
||||||
|
|
||||||
using Common::ReturnCode;
|
using Common::ReturnCode;
|
||||||
using Common::Time;
|
using Common::Time;
|
||||||
using Common::Schedule::NextTime;
|
using Common::Schedule::NextTime;
|
||||||
|
using Color = BSP::DisplayDriver::Color;
|
||||||
|
|
||||||
DisplayTimeScreen::DisplayTimeScreen(BSP::DisplayDriver &driver,
|
DisplayTimeScreen::DisplayTimeScreen(BSP::DisplayDriver &driver,
|
||||||
ScreenManager &manager,
|
ScreenManager &manager,
|
||||||
Screen &menu_screen)
|
Screen &menu_screen)
|
||||||
: m_driver(driver)
|
: m_driver(driver)
|
||||||
, m_last_time()
|
, m_last_time()
|
||||||
, m_refresh(true)
|
|
||||||
, m_manager(manager)
|
, m_manager(manager)
|
||||||
, m_menu_screen(menu_screen)
|
, m_menu_screen(menu_screen)
|
||||||
, m_display_seconds(true)
|
, m_display_seconds(true)
|
||||||
@@ -63,7 +63,7 @@ void DisplayTimeScreen::display_number(uint32_t *x, uint32_t y, uint32_t tens, u
|
|||||||
time_str[1] = get_char_for_digit(ones);
|
time_str[1] = get_char_for_digit(ones);
|
||||||
time_str[2] = '\0';
|
time_str[2] = '\0';
|
||||||
|
|
||||||
m_driver.string_at(x, y, time_str, &f);
|
m_driver.string_at(x, y, time_str, &f, Color::WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayTimeScreen::display_time()
|
void DisplayTimeScreen::display_time()
|
||||||
@@ -76,31 +76,22 @@ void DisplayTimeScreen::display_time()
|
|||||||
|
|
||||||
uint32_t x = 0;
|
uint32_t x = 0;
|
||||||
|
|
||||||
if (m_refresh || m_last_time.get_hours_24() != time.get_hours_24()) {
|
m_driver.clear(Color::BLACK);
|
||||||
x = x_space;
|
|
||||||
display_number(&x, y_space,
|
|
||||||
time.get_hours_12_tens(), time.get_hours_12_ones(), font);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_refresh || m_last_time.get_minutes() != time.get_minutes()) {
|
x = x_space;
|
||||||
x = x_space;
|
display_number(&x, y_space,
|
||||||
display_number(&x, y_space * 2 + font.height,
|
time.get_hours_12_tens(), time.get_hours_12_ones(), font);
|
||||||
time.get_minutes_tens(), time.get_minutes_ones(), font);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_refresh || m_display_seconds) {
|
x = x_space;
|
||||||
// display_number(&x, y,
|
display_number(&x, y_space * 2 + font.height,
|
||||||
// time.get_seconds_tens(), time.get_seconds_ones(), font_default);
|
time.get_minutes_tens(), time.get_minutes_ones(), font);
|
||||||
}
|
|
||||||
|
|
||||||
m_last_time = time;
|
m_last_time = time;
|
||||||
m_refresh = false;
|
|
||||||
m_driver.refresh();
|
m_driver.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
NextTime DisplayTimeScreen::execute()
|
NextTime DisplayTimeScreen::execute()
|
||||||
{
|
{
|
||||||
// m_refresh = true;
|
|
||||||
display_time();
|
display_time();
|
||||||
|
|
||||||
Common::time_t now;
|
Common::time_t now;
|
||||||
@@ -117,14 +108,11 @@ NextTime DisplayTimeScreen::execute()
|
|||||||
|
|
||||||
|
|
||||||
void DisplayTimeScreen::enable() {
|
void DisplayTimeScreen::enable() {
|
||||||
m_refresh = true;
|
|
||||||
m_driver.clear();
|
|
||||||
m_last_time = {};
|
m_last_time = {};
|
||||||
display_time();
|
display_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayTimeScreen::disable() {
|
void DisplayTimeScreen::disable() {
|
||||||
m_driver.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayTimeScreen::notify_up_button() {
|
void DisplayTimeScreen::notify_up_button() {
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "ScreenManager.h"
|
#include "Application/ScreenManager.h"
|
||||||
#include "Screen.h"
|
#include "Application/Screens/Screen.h"
|
||||||
|
|
||||||
class DisplayTimeScreen : public Screen {
|
class DisplayTimeScreen : public Screen {
|
||||||
public:
|
public:
|
||||||
@@ -50,7 +50,6 @@ private:
|
|||||||
|
|
||||||
BSP::DisplayDriver &m_driver;
|
BSP::DisplayDriver &m_driver;
|
||||||
Common::WallClockTime m_last_time;
|
Common::WallClockTime m_last_time;
|
||||||
bool m_refresh;
|
|
||||||
|
|
||||||
ScreenManager &m_manager;
|
ScreenManager &m_manager;
|
||||||
Screen &m_menu_screen;
|
Screen &m_menu_screen;
|
||||||
@@ -21,13 +21,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "macros.h"
|
|
||||||
|
|
||||||
#include <initializer_list>
|
#include <initializer_list>
|
||||||
|
|
||||||
#include "SystemFonts.h"
|
#include "Bsp/macros.h"
|
||||||
#include "ScreenManager.h"
|
|
||||||
#include "Screen.h"
|
#include "Application/SystemFonts.h"
|
||||||
|
#include "Application/ScreenManager.h"
|
||||||
|
#include "Application/Screens/Screen.h"
|
||||||
|
|
||||||
struct MenuScreenItem {
|
struct MenuScreenItem {
|
||||||
|
|
||||||
@@ -40,7 +41,6 @@ struct MenuScreenItem {
|
|||||||
|
|
||||||
MenuScreenItem()
|
MenuScreenItem()
|
||||||
: m_text(nullptr)
|
: m_text(nullptr)
|
||||||
, m_screen(nullptr)
|
|
||||||
, m_type(Type::NONE)
|
, m_type(Type::NONE)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -52,20 +52,20 @@ struct MenuScreenItem {
|
|||||||
|
|
||||||
MenuScreenItem(const char *item, void (*function)())
|
MenuScreenItem(const char *item, void (*function)())
|
||||||
: m_text(item)
|
: m_text(item)
|
||||||
, m_screen(nullptr)
|
|
||||||
, m_function(function)
|
, m_function(function)
|
||||||
, m_type(Type::FUNCTION)
|
, m_type(Type::FUNCTION)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
MenuScreenItem(const char *item)
|
MenuScreenItem(const char *item)
|
||||||
: m_text(item)
|
: m_text(item)
|
||||||
, m_screen(nullptr)
|
|
||||||
, m_type(Type::BACK)
|
, m_type(Type::BACK)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const char *m_text;
|
const char *m_text;
|
||||||
Screen *m_screen;
|
union {
|
||||||
void (* m_function)();
|
Screen *m_screen;
|
||||||
|
void (* m_function)();
|
||||||
|
};
|
||||||
Type m_type;
|
Type m_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -134,11 +134,11 @@ public:
|
|||||||
|
|
||||||
void enable() override {
|
void enable() override {
|
||||||
m_selected = 0;
|
m_selected = 0;
|
||||||
|
m_driver.clear();
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void disable() override {
|
void disable() override {
|
||||||
m_driver.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify_up_button() override {
|
void notify_up_button() override {
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
#include "Task.h"
|
#include "Bsp/Task.h"
|
||||||
|
|
||||||
class Screen : public Common::Schedule::Task {
|
class Screen : public Common::Schedule::Task {
|
||||||
public:
|
public:
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 Max Regan
|
* Copyright (C) 2019 Max Regan
|
||||||
*
|
*
|
||||||
Cr * Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
@@ -21,10 +21,10 @@ Cr * Permission is hereby granted, free of charge, to any person obtaining a cop
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "SetDateScreen.h"
|
#include "Application/Screens/SetDateScreen.h"
|
||||||
#include "SystemTime.h"
|
#include "Application/SystemFonts.h"
|
||||||
#include "SystemFonts.h"
|
#include "Bsp/SystemTime.h"
|
||||||
#include "RtcDriver.h"
|
#include "Bsp/Drivers/RtcDriver.h"
|
||||||
|
|
||||||
using Common::ReturnCode;
|
using Common::ReturnCode;
|
||||||
using Common::Time;
|
using Common::Time;
|
||||||
@@ -127,10 +127,8 @@ void SetDateScreen::render_time()
|
|||||||
|
|
||||||
void SetDateScreen::draw_line(uint32_t x, uint32_t y, uint32_t width)
|
void SetDateScreen::draw_line(uint32_t x, uint32_t y, uint32_t width)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < width; i += 8) {
|
m_display.draw_hline(x, y, width);
|
||||||
m_display.set_byte(x + i, y, 0);
|
m_display.draw_hline(x, y + 1, width);
|
||||||
m_display.set_byte(x + i, y + 1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDateScreen::render_selection()
|
void SetDateScreen::render_selection()
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "ScreenManager.h"
|
#include "Application/ScreenManager.h"
|
||||||
#include "DisplayDriver.h"
|
#include "Bsp/Drivers/DisplayDriver.h"
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
#include "Task.h"
|
#include "Bsp/Task.h"
|
||||||
#include "Time.h"
|
#include "Bsp/Time.h"
|
||||||
#include "font.h"
|
#include "Bsp/font.h"
|
||||||
|
|
||||||
class SetDateScreen : public Screen {
|
class SetDateScreen : public Screen {
|
||||||
public:
|
public:
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#include "SetTimeScreen.h"
|
#include "Application/Screens/SetTimeScreen.h"
|
||||||
#include "SystemTime.h"
|
#include "Application/SystemFonts.h"
|
||||||
#include "SystemFonts.h"
|
#include "Bsp/SystemTime.h"
|
||||||
#include "RtcDriver.h"
|
#include "Bsp/Drivers/RtcDriver.h"
|
||||||
|
|
||||||
using Common::ReturnCode;
|
using Common::ReturnCode;
|
||||||
using Common::Time;
|
using Common::Time;
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "ScreenManager.h"
|
#include "Application/ScreenManager.h"
|
||||||
#include "DisplayDriver.h"
|
#include "Bsp/Drivers/DisplayDriver.h"
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
#include "Task.h"
|
#include "Bsp/Task.h"
|
||||||
#include "Time.h"
|
#include "Bsp/Time.h"
|
||||||
#include "font.h"
|
#include "Bsp/font.h"
|
||||||
|
|
||||||
class SetTimeScreen : public Screen {
|
class SetTimeScreen : public Screen {
|
||||||
public:
|
public:
|
||||||
@@ -19,24 +19,26 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LowPowerTaskScheduler.h"
|
#include "Bsp/LowPowerTaskScheduler.h"
|
||||||
#include "RtcDriver.h"
|
#include "Bsp/Drivers/RtcDriver.h"
|
||||||
#include "DisplayDriver.h"
|
#include "Bsp/Drivers/DisplayDriver.h"
|
||||||
#include "SpiDriver.h"
|
#include "Bsp/Drivers/SpiDriver.h"
|
||||||
#include "LptimPwm.h"
|
#include "Bsp/Drivers/LptimPwm.h"
|
||||||
#include "ButtonManager.h"
|
|
||||||
|
|
||||||
#include "ScreenManager.h"
|
#include "Application/ButtonManager.h"
|
||||||
#include "DisplayTimeScreen.h"
|
|
||||||
#include "DebugScreen.h"
|
|
||||||
#include "MenuScreen.h"
|
|
||||||
#include "SetTimeScreen.h"
|
|
||||||
#include "SetDateScreen.h"
|
|
||||||
|
|
||||||
|
#include "Application/ScreenManager.h"
|
||||||
|
#include "Application/Screens/DisplayTimeScreen.h"
|
||||||
|
#include "Application/Screens/DebugScreen.h"
|
||||||
|
#include "Application/Screens/MenuScreen.h"
|
||||||
|
#include "Application/Screens/SetTimeScreen.h"
|
||||||
|
#include "Application/Screens/SetDateScreen.h"
|
||||||
|
|
||||||
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
|
// TODO: Don't include this here.
|
||||||
#include "stm32l0xx.h"
|
#include "stm32l0xx.h"
|
||||||
|
|
||||||
#include "macros.h"
|
|
||||||
|
|
||||||
using Common::Time;
|
using Common::Time;
|
||||||
|
|
||||||
static Common::Schedule::LowPowerTaskScheduler<5> g_sched;
|
static Common::Schedule::LowPowerTaskScheduler<5> g_sched;
|
||||||
189
firmware/Bsp/Drivers/DisplayDriver.cpp
Normal file
189
firmware/Bsp/Drivers/DisplayDriver.cpp
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 Max Regan
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
#include "Bsp/Drivers/DisplayDriver.h"
|
||||||
|
#include "Bsp/macros.h"
|
||||||
|
#include "Bsp/font.h"
|
||||||
|
|
||||||
|
namespace BSP {
|
||||||
|
|
||||||
|
using Common::Schedule::NextTime;
|
||||||
|
using Common::ReturnCode;
|
||||||
|
|
||||||
|
DisplayDriver::DisplayDriver(Common::Schedule::TaskScheduler &scheduler, SpiDriver &spi)
|
||||||
|
: m_scheduler(scheduler)
|
||||||
|
, m_spi(spi)
|
||||||
|
, m_is_dirty(true)
|
||||||
|
, m_dirty_line_min(0)
|
||||||
|
, m_dirty_line_max(0)
|
||||||
|
{
|
||||||
|
buffer_init(DEFAULT_COLOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnCode DisplayDriver::init()
|
||||||
|
{
|
||||||
|
return Common::ReturnCode::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NextTime DisplayDriver::execute()
|
||||||
|
{
|
||||||
|
return NextTime::never();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: write my own implementation
|
||||||
|
#define R2(n) n, n + 2*64, n + 1*64, n + 3*64
|
||||||
|
#define R4(n) R2(n), R2(n + 2*16), R2(n + 1*16), R2(n + 3*16)
|
||||||
|
#define R6(n) R4(n), R4(n + 2*4 ), R4(n + 1*4 ), R4(n + 3*4 )
|
||||||
|
|
||||||
|
static constexpr unsigned char BitReverseTable256[256] =
|
||||||
|
{
|
||||||
|
R6(0), R6(2), R6(1), R6(3)
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned char ReverseBitsLookupTable(unsigned char v)
|
||||||
|
{
|
||||||
|
return BitReverseTable256[v];
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::buffer_init(Color color)
|
||||||
|
{
|
||||||
|
uint8_t dataval = 0xFF;
|
||||||
|
if (color == Color::BLACK) {
|
||||||
|
dataval = 0x00;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Support initializing to other colors
|
||||||
|
|
||||||
|
for (size_t i = 0; i < ARRAY_SIZE(m_buffer.lines); i++) {
|
||||||
|
struct display_line &line = m_buffer.lines[i];
|
||||||
|
line.mode = 1; // Update display
|
||||||
|
line.line = i + 1; // Line numbers start at 1
|
||||||
|
for (size_t j = 0; j < ARRAY_SIZE(line.data); j++) {
|
||||||
|
line.data[j] = dataval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_buffer.dummy = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::set_dirty(unsigned int y)
|
||||||
|
{
|
||||||
|
if (!m_is_dirty) {
|
||||||
|
m_is_dirty = true;
|
||||||
|
m_dirty_line_min = y;
|
||||||
|
m_dirty_line_max = y;
|
||||||
|
} else {
|
||||||
|
m_dirty_line_min = MIN(y, m_dirty_line_min);
|
||||||
|
m_dirty_line_max = MAX(y, m_dirty_line_max);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: write my own implementation
|
||||||
|
#define R2(n) n, n + 2*64, n + 1*64, n + 3*64
|
||||||
|
#define R4(n) R2(n), R2(n + 2*16), R2(n + 1*16), R2(n + 3*16)
|
||||||
|
#define R6(n) R4(n), R4(n + 2*4 ), R4(n + 1*4 ), R4(n + 3*4 )
|
||||||
|
|
||||||
|
void DisplayDriver::draw_hline(uint32_t x, uint32_t y, uint32_t width, Color color)
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < width; i++) {
|
||||||
|
set_pixel(x + i, y, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::write_glyph(uint32_t x_off, uint32_t y_off,
|
||||||
|
const struct font *f, const struct glyph *g,
|
||||||
|
Color color)
|
||||||
|
{
|
||||||
|
for (size_t x = 0; x < g->width; x++) {
|
||||||
|
for (size_t y = 0; y < g->height; y++) {
|
||||||
|
uint32_t byte_x = x / 8;
|
||||||
|
uint32_t bit_x = 7 - (x % 8);
|
||||||
|
uint8_t bit = (g->bitmap[byte_x + g->width_bytes * y] >> bit_x) & 1;
|
||||||
|
if (bit) {
|
||||||
|
set_pixel(g->left + x_off + x, y_off + y + f->height - g->top, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::char_at(uint32_t *x_off, uint32_t y_off, char c, const struct font *font, Color color)
|
||||||
|
{
|
||||||
|
const struct glyph *g = glyph_for_char(font, c);
|
||||||
|
if (g == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*x_off + font->width >= DISPLAY_WIDTH) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
write_glyph(*x_off, y_off, font, g, color);
|
||||||
|
|
||||||
|
m_dirty_line_min = MIN(m_dirty_line_min, y_off);
|
||||||
|
m_dirty_line_max = MAX(m_dirty_line_max, y_off + g->height);
|
||||||
|
m_is_dirty = true;
|
||||||
|
*x_off += font->width;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::string_at(uint32_t *x_off, uint32_t y_off, const char *string, const struct font *font, Color color)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (string[i]) {
|
||||||
|
char_at(x_off, y_off, string[i], font, color);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::refresh()
|
||||||
|
{
|
||||||
|
if (!m_is_dirty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *start = (uint8_t *) &m_buffer.lines[m_dirty_line_min];
|
||||||
|
// Data size
|
||||||
|
size_t size = sizeof(m_buffer.lines[0]) * (m_dirty_line_max - m_dirty_line_min + 1);
|
||||||
|
// Trailer dummy data
|
||||||
|
size += 2;
|
||||||
|
|
||||||
|
m_spi.tx_blocking(start, size);
|
||||||
|
m_is_dirty = false;
|
||||||
|
m_dirty_line_min = DISPLAY_HEIGHT - 1;
|
||||||
|
m_dirty_line_max = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDriver::clear(Color color)
|
||||||
|
{
|
||||||
|
buffer_init(color);
|
||||||
|
m_is_dirty = true;
|
||||||
|
m_dirty_line_min = 0;
|
||||||
|
m_dirty_line_max = DISPLAY_HEIGHT - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: put me somewhere fonty
|
||||||
|
const struct glyph *DisplayDriver::glyph_for_char(const struct font *font, char c)
|
||||||
|
{
|
||||||
|
return font->glyphs[(size_t) c];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Task.h"
|
#include "Bsp/Task.h"
|
||||||
#include "SpiDriver.h"
|
#include "Bsp/Drivers/SpiDriver.h"
|
||||||
#include "font.h"
|
#include "Bsp/font.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
|
|
||||||
@@ -37,18 +37,33 @@ public:
|
|||||||
Common::ReturnCode init();
|
Common::ReturnCode init();
|
||||||
Common::Schedule::NextTime execute() override;
|
Common::Schedule::NextTime execute() override;
|
||||||
|
|
||||||
|
static constexpr uint32_t BITS_PER_PIXEL = 3;
|
||||||
|
|
||||||
|
enum class Color : uint8_t {
|
||||||
|
BLACK = 0,
|
||||||
|
BLUE = 4,
|
||||||
|
GREEN = 2,
|
||||||
|
CYAN = 6,
|
||||||
|
RED = 1,
|
||||||
|
MAGENTA = 5,
|
||||||
|
YELLOW = 3,
|
||||||
|
WHITE = 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr Color DEFAULT_COLOR = Color::BLACK;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DisplayDriver
|
* DisplayDriver
|
||||||
*/
|
*/
|
||||||
void set_bit(uint32_t x, uint32_t y, uint8_t val);
|
void inline set_pixel(uint32_t x, uint32_t y, Color color=DEFAULT_COLOR);
|
||||||
uint8_t get_bit(uint32_t x, uint32_t y);
|
|
||||||
void set_byte(uint32_t x, uint32_t y, uint8_t val);
|
void char_at(uint32_t *x_off, uint32_t y_off, char c, const struct font *font, Color color=DEFAULT_COLOR);
|
||||||
void char_at(uint32_t *x_off, uint32_t y_off, char c, const struct font *font);
|
|
||||||
void string_at(uint32_t *x_off, uint32_t y_off,
|
void string_at(uint32_t *x_off, uint32_t y_off,
|
||||||
const char *string, const struct font *font);
|
const char *string, const struct font *font,
|
||||||
void draw_hline(uint32_t x, uint32_t y, uint32_t width);
|
Color color=DEFAULT_COLOR);
|
||||||
|
void draw_hline(uint32_t x, uint32_t y, uint32_t width, Color color=DEFAULT_COLOR);
|
||||||
void refresh();
|
void refresh();
|
||||||
void clear();
|
void clear(Color color=Color::WHITE);
|
||||||
|
|
||||||
inline uint32_t get_width() {
|
inline uint32_t get_width() {
|
||||||
return DISPLAY_WIDTH;
|
return DISPLAY_WIDTH;
|
||||||
@@ -59,21 +74,15 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void buffer_init();
|
void buffer_init(Color color);
|
||||||
void set_dirty(unsigned int y);
|
void set_dirty(unsigned int y);
|
||||||
const struct glyph *glyph_for_char(const struct font *font, char c);
|
const struct glyph *glyph_for_char(const struct font *font, char c);
|
||||||
void clear_glyph_aligned(uint32_t x_off, uint32_t y_off,
|
void write_glyph(uint32_t x_off, uint32_t y_off,
|
||||||
const struct font * font, const struct glyph *g);
|
const struct font *font, const struct glyph *g,
|
||||||
void clear_glyph_unaligned(uint32_t x_off, uint32_t y_off,
|
Color color);
|
||||||
const struct font * font, const struct glyph *g);
|
|
||||||
void write_glyph_aligned(uint32_t x_off, uint32_t y_off,
|
|
||||||
const struct font * font, const struct glyph *g);
|
|
||||||
void write_glyph_unaligned(uint32_t x_off, uint32_t y_off,
|
|
||||||
const struct font * font, const struct glyph *g);
|
|
||||||
|
|
||||||
static constexpr uint32_t DISPLAY_WIDTH = 128;
|
static constexpr uint32_t DISPLAY_WIDTH = 128;
|
||||||
static constexpr uint32_t DISPLAY_HEIGHT = 128;
|
static constexpr uint32_t DISPLAY_HEIGHT = 128;
|
||||||
static constexpr uint32_t BITS_PER_PIXEL = 3;
|
|
||||||
|
|
||||||
struct display_line
|
struct display_line
|
||||||
{
|
{
|
||||||
@@ -100,4 +109,27 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void inline DisplayDriver::set_pixel(uint32_t x, uint32_t y, Color color)
|
||||||
|
{
|
||||||
|
struct display_line &line = m_buffer.lines[y];
|
||||||
|
uint32_t x_pos = x * BITS_PER_PIXEL;
|
||||||
|
uint32_t x_byte = x_pos / 8;
|
||||||
|
uint32_t x_bit = x_pos % 8;
|
||||||
|
uint8_t c = (uint8_t) color;
|
||||||
|
constexpr uint8_t mask = (1 << BITS_PER_PIXEL) - 1;
|
||||||
|
|
||||||
|
if (x_bit + BITS_PER_PIXEL > 8) {
|
||||||
|
line.data[x_byte] &= ~(mask << x_bit);
|
||||||
|
line.data[x_byte] |= c << x_bit;
|
||||||
|
|
||||||
|
x_byte++;
|
||||||
|
line.data[x_byte] &= ~(mask >> (8 - x_bit));
|
||||||
|
line.data[x_byte] |= c >> (8 - x_bit);
|
||||||
|
} else {
|
||||||
|
line.data[x_byte] &= ~(mask << x_bit);
|
||||||
|
line.data[x_byte] |= c << x_bit;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_dirty(y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SystemTime.h"
|
#include "Bsp/SystemTime.h"
|
||||||
#include "LowPower.h"
|
#include "Bsp/Drivers/LowPower.h"
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
#include "stm32l0xx.h"
|
#include "stm32l0xx.h"
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
|
|
||||||
extern uint32_t wakeups;
|
extern uint32_t wakeups;
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LptimPwm.h"
|
#include "Bsp/Drivers/LptimPwm.h"
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
#include "stm32l0xx.h"
|
#include "stm32l0xx.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
@@ -19,10 +19,11 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "RtcDriver.h"
|
|
||||||
#include "macros.h"
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
|
#include "Bsp/Drivers/RtcDriver.h"
|
||||||
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
|
|
||||||
using Common::ReturnCode;
|
using Common::ReturnCode;
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "SystemTime.h"
|
#include "Bsp/SystemTime.h"
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
#include "Time.h"
|
#include "Bsp/Time.h"
|
||||||
|
|
||||||
#include "stm32l0xx.h"
|
#include "stm32l0xx.h"
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "SpiDriver.h"
|
#include "Bsp/Drivers/SpiDriver.h"
|
||||||
#include "macros.h"
|
#include "Bsp/macros.h"
|
||||||
|
|
||||||
namespace BSP {
|
namespace BSP {
|
||||||
|
|
||||||
@@ -100,7 +100,7 @@ RC SpiDriver::tx_blocking(const uint8_t *data, size_t len)
|
|||||||
m_spi->DR = data[i];
|
m_spi->DR = data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
//FLIP(GPIOB->ODR, GPIO_ODR_OD3);
|
//FLIP(GPIOB->ODR, GPIO_ODR_OD3);
|
||||||
|
|
||||||
while (!(m_spi->SR & SPI_SR_TXE)) {}
|
while (!(m_spi->SR & SPI_SR_TXE)) {}
|
||||||
|
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ReturnCode.h"
|
#include "Bsp/ReturnCode.h"
|
||||||
#include "TaskScheduler.h"
|
#include "Bsp/TaskScheduler.h"
|
||||||
|
|
||||||
// TODO: Find a better include for this
|
// TODO: Find a better include for this
|
||||||
#include "stm32l0xx.h"
|
#include "stm32l0xx.h"
|
||||||
@@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
#include "TaskScheduler.h"
|
#include "TaskScheduler.h"
|
||||||
#include "SystemTime.h"
|
#include "SystemTime.h"
|
||||||
#include "LowPower.h"
|
#include "Drivers/LowPower.h"
|
||||||
#include "RtcDriver.h"
|
#include "Drivers/RtcDriver.h"
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
namespace Schedule {
|
namespace Schedule {
|
||||||
@@ -40,7 +40,7 @@ DEVICE_TYPE ?= stm32l031k6
|
|||||||
DEVICE_FAMILY = stm32l031xx
|
DEVICE_FAMILY = stm32l031xx
|
||||||
DEVICE_LINE = stm32l0xx
|
DEVICE_LINE = stm32l0xx
|
||||||
|
|
||||||
STACK_SIZE ?= 512
|
STACK_SIZE ?= 768
|
||||||
HEAP_SIZE ?= 0
|
HEAP_SIZE ?= 0
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -60,7 +60,7 @@ FONT_H_FILES := $(patsubst %,$(FONT_GEN_DIR)/%.h,$(FONTS))
|
|||||||
C_SOURCES := $(call find_important, $(SOURCEDIR), '*.c') $(FONT_C_FILES)
|
C_SOURCES := $(call find_important, $(SOURCEDIR), '*.c') $(FONT_C_FILES)
|
||||||
CXX_SOURCES := $(call find_important, $(SOURCEDIR), '*.cpp')
|
CXX_SOURCES := $(call find_important, $(SOURCEDIR), '*.cpp')
|
||||||
S_SOURCES := $(call find_important, $(SOURCEDIR), '*.s')
|
S_SOURCES := $(call find_important, $(SOURCEDIR), '*.s')
|
||||||
SPP_SOURCES := $(DEVICE_TYPE).S
|
SPP_SOURCES := Bsp/Mcu/$(DEVICE_TYPE).S
|
||||||
SOURCES = $(C_SOURCES) $(S_SOURCES) $(SPP_SOURCES) $(CPP_SOURCES)
|
SOURCES = $(C_SOURCES) $(S_SOURCES) $(SPP_SOURCES) $(CPP_SOURCES)
|
||||||
|
|
||||||
C_OBJS := $(patsubst %.c,%.o,$(C_SOURCES))
|
C_OBJS := $(patsubst %.c,%.o,$(C_SOURCES))
|
||||||
@@ -69,7 +69,7 @@ S_OBJS := $(patsubst %.s,%.o,$(S_SOURCES))
|
|||||||
SPP_OBJS := $(patsubst %.S,%.o,$(SPP_SOURCES))
|
SPP_OBJS := $(patsubst %.S,%.o,$(SPP_SOURCES))
|
||||||
OBJS = $(C_OBJS) $(S_OBJS) $(SPP_OBJS) $(CXX_OBJS)
|
OBJS = $(C_OBJS) $(S_OBJS) $(SPP_OBJS) $(CXX_OBJS)
|
||||||
|
|
||||||
LINKER_SCRIPT ?= $(DEVICE_TYPE).ld
|
LINKER_SCRIPT ?= Bsp/Mcu/$(DEVICE_TYPE).ld
|
||||||
|
|
||||||
OUTPUT_NAME ?= watch
|
OUTPUT_NAME ?= watch
|
||||||
OUTPUT_BIN ?= $(OUTPUT_NAME).bin
|
OUTPUT_BIN ?= $(OUTPUT_NAME).bin
|
||||||
@@ -97,8 +97,8 @@ CFLAGS += -fstack-usage -Wstack-usage=128
|
|||||||
# Defines
|
# Defines
|
||||||
CFLAGS += -D$(DEVICE_DEFINE)
|
CFLAGS += -D$(DEVICE_DEFINE)
|
||||||
# Includes
|
# Includes
|
||||||
CFLAGS += -I./lib/stm32/$(DEVICE_LINE)/Include
|
CFLAGS += -I./ThirdParty/stm32/$(DEVICE_LINE)/Include
|
||||||
CFLAGS += -I./lib/CMSIS/Core/Include
|
CFLAGS += -I./ThirdParty/CMSIS/Core/Include
|
||||||
CFLAGS += -I./build/gen/
|
CFLAGS += -I./build/gen/
|
||||||
CFLAGS += -I.
|
CFLAGS += -I.
|
||||||
|
|
||||||
@@ -126,7 +126,6 @@ build: $(OUTPUT_BIN)
|
|||||||
# Build Logic
|
# Build Logic
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
%.o: %.c $(FONT_H_FILES)
|
%.o: %.c $(FONT_H_FILES)
|
||||||
@echo "CC $@"
|
@echo "CC $@"
|
||||||
@$(CC) $(CFLAGS) -c $< -o $@
|
@$(CC) $(CFLAGS) -c $< -o $@
|
||||||
@@ -139,18 +138,18 @@ build: $(OUTPUT_BIN)
|
|||||||
@echo "CXX $@"
|
@echo "CXX $@"
|
||||||
@$(CXX) $(CXX_FLAGS) $(CFLAGS) -c $< -o $@
|
@$(CXX) $(CXX_FLAGS) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
SMALL_FONT=lib/fonts/roboto_mono/RobotoMono-Medium.ttf
|
SMALL_FONT=ThirdParty/fonts/roboto_mono/RobotoMono-Medium.ttf
|
||||||
$(FONT_GEN_DIR)/small.h $(FONT_GEN_DIR)/small.c: gen/fixedfont-to-c.py gen/font.py
|
$(FONT_GEN_DIR)/small.h $(FONT_GEN_DIR)/small.c: Gen/fixedfont-to-c.py Gen/font.py
|
||||||
@echo "GEN $@"
|
@echo "GEN $@"
|
||||||
@mkdir -p $(FONT_GEN_DIR)
|
@mkdir -p $(FONT_GEN_DIR)
|
||||||
@gen/fixedfont-to-c.py $(patsubst .%,%,$(suffix $@)) $(SMALL_FONT) "$@" -s 18 --header-dir "" --name font_small
|
@Gen/fixedfont-to-c.py $(patsubst .%,%,$(suffix $@)) $(SMALL_FONT) "$@" -s 18 --header-dir "Bsp/" --name font_small
|
||||||
@$(call gen_font,$(FONT),29,small)
|
@$(call gen_font,$(FONT),29,small)
|
||||||
|
|
||||||
LARGE_FONT=lib/fonts/roboto_mono/RobotoMono-Bold.ttf
|
LARGE_FONT=ThirdParty/fonts/roboto_mono/RobotoMono-Bold.ttf
|
||||||
$(FONT_GEN_DIR)/large_digits.h $(FONT_GEN_DIR)/large_digits.c: gen/fixedfont-to-c.py gen/font.py
|
$(FONT_GEN_DIR)/large_digits.h $(FONT_GEN_DIR)/large_digits.c: Gen/fixedfont-to-c.py Gen/font.py
|
||||||
@echo "GEN $@"
|
@echo "GEN $@"
|
||||||
@mkdir -p $(FONT_GEN_DIR)
|
@mkdir -p $(FONT_GEN_DIR)
|
||||||
@gen/fixedfont-to-c.py $(patsubst .%,%,$(suffix $@)) $(LARGE_FONT) "$@" -s 70 --header-dir "" --name font_large_digits -c "01234567890:"
|
@Gen/fixedfont-to-c.py $(patsubst .%,%,$(suffix $@)) $(LARGE_FONT) "$@" -s 70 --header-dir "Bsp/" --name font_large_digits -c "01234567890:"
|
||||||
|
|
||||||
$(OUTPUT_BIN): $(OUTPUT_ELF)
|
$(OUTPUT_BIN): $(OUTPUT_ELF)
|
||||||
@echo "OBJCOPY $@"
|
@echo "OBJCOPY $@"
|
||||||
@@ -160,7 +159,6 @@ $(OUTPUT_MAP) $(OUTPUT_ELF): $(LINKER_SCRIPT) $(OBJS)
|
|||||||
@echo "LD $@"
|
@echo "LD $@"
|
||||||
@$(LD) -T $(LINKER_SCRIPT) $(LDFLAGS) -o $(OUTPUT_ELF) $(OBJS) -Wl,-Map=$(OUTPUT_MAP)
|
@$(LD) -T $(LINKER_SCRIPT) $(LDFLAGS) -o $(OUTPUT_ELF) $(OBJS) -Wl,-Map=$(OUTPUT_MAP)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Utilities
|
# Utilities
|
||||||
#
|
#
|
||||||
@@ -176,3 +174,4 @@ flash: $(OUTPUT_BIN)
|
|||||||
clean:
|
clean:
|
||||||
@echo "RM $(OBJS)"
|
@echo "RM $(OBJS)"
|
||||||
@rm -f $(OBJS) $(OUTPUT_BIN) $(OUTPUT_ELF) $(FONT_C_FILES) $(OUTPUT_MAP) ./*.su
|
@rm -f $(OBJS) $(OUTPUT_BIN) $(OUTPUT_ELF) $(FONT_C_FILES) $(OUTPUT_MAP) ./*.su
|
||||||
|
@rm -rf build/
|
||||||
202
firmware/ThirdParty/fonts/roboto_mono/LICENSE.txt
vendored
Normal file
202
firmware/ThirdParty/fonts/roboto_mono/LICENSE.txt
vendored
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Bold.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Bold.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-BoldItalic.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-BoldItalic.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Italic.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Italic.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Light.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Light.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-LightItalic.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-LightItalic.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Medium.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Medium.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-MediumItalic.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-MediumItalic.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Regular.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Regular.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Thin.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-Thin.ttf
vendored
Normal file
Binary file not shown.
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-ThinItalic.ttf
vendored
Normal file
BIN
firmware/ThirdParty/fonts/roboto_mono/RobotoMono-ThinItalic.ttf
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user