chore(stdlib): update xod-dev/st7735-display

This commit is contained in:
Kirill Shumilov
2020-08-26 19:21:15 +03:00
committed by Evgeny Kochetkov
parent 7e48b21428
commit 5c7d4be0ff
7 changed files with 64 additions and 112 deletions

View File

@@ -1,14 +1,9 @@
struct State {};
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeB();
emitValue<output_DEVU0027>(ctx, dev);
node {
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeB();
emitValue<output_DEVU0027>(ctx, dev);
}
}

View File

@@ -1,14 +1,9 @@
struct State {};
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeG();
emitValue<output_DEVU0027>(ctx, dev);
node {
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeG();
emitValue<output_DEVU0027>(ctx, dev);
}
}

View File

@@ -1,14 +1,9 @@
struct State {};
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeRG();
emitValue<output_DEVU0027>(ctx, dev);
node {
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeRG();
emitValue<output_DEVU0027>(ctx, dev);
}
}

View File

@@ -1,14 +1,9 @@
struct State {};
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeRR();
emitValue<output_DEVU0027>(ctx, dev);
node {
void evaluate(Context ctx) {
if (!isSettingUp())
return;
auto dev = getValue<input_DEV>(ctx);
dev->initTypeRR();
emitValue<output_DEVU0027>(ctx, dev);
}
}

View File

@@ -1,23 +1,18 @@
node {
void evaluate(Context ctx) {
auto dev = getValue<input_DEV>(ctx);
struct State {};
if (isSettingUp())
emitValue<output_DEVU0027>(ctx, dev);
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
if (!isInputDirty<input_DO>(ctx))
return;
void evaluate(Context ctx) {
auto dev = getValue<input_DEV>(ctx);
auto gfx = getValue<input_GFX>(ctx);
if (isSettingUp())
emitValue<output_DEVU0027>(ctx, dev);
if (gfx)
gfx->render(dev);
if (!isInputDirty<input_DO>(ctx))
return;
auto gfx = getValue<input_GFX>(ctx);
if (gfx)
gfx->render(dev);
emitValue<output_DONE>(ctx, 1);
emitValue<output_DONE>(ctx, 1);
}
}

View File

@@ -1,21 +1,16 @@
node {
void evaluate(Context ctx) {
auto dev = getValue<input_DEV>(ctx);
struct State {};
if (isSettingUp())
emitValue<output_DEVU0027>(ctx, dev);
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
if (!isInputDirty<input_DO>(ctx))
return;
void evaluate(Context ctx) {
auto dev = getValue<input_DEV>(ctx);
uint8_t rotation = getValue<input_R>(ctx);
dev->setRotation(rotation);
if (isSettingUp())
emitValue<output_DEVU0027>(ctx, dev);
if (!isInputDirty<input_DO>(ctx))
return;
uint8_t rotation = getValue<input_R>(ctx);
dev->setRotation(rotation);
emitValue<output_DONE>(ctx, 1);
emitValue<output_DONE>(ctx, 1);
}
}

View File

@@ -1,36 +1,18 @@
// clang-format off
{{#global}}
#include <XST7735.h>
{{/global}}
// clang-format on
struct State {
uint8_t mem[sizeof(ST7735)];
ST7735* dev;
};
node {
meta {
using Type = ST7735*;
}
using Type = ST7735*;
// clang-format off
{{ GENERATED_CODE }}
// clang-format on
void evaluate(Context ctx) {
static_assert(isValidDigitalPort(constant_input_CS), "must be a valid digital port");
static_assert(isValidDigitalPort(constant_input_DC), "must be a valid digital port");
static_assert(constant_input_RST == 255 || isValidDigitalPort(constant_input_RST), "must be a valid digital port");
if (!isSettingUp())
return;
ST7735 dev = ST7735(constant_input_CS, constant_input_DC, constant_input_RST);
auto state = getState(ctx);
const uint8_t cs = getValue<input_CS>(ctx);
const uint8_t dc = getValue<input_DC>(ctx);
const uint8_t rst = getValue<input_RST>(ctx);
state->dev = new (state->mem) ST7735(cs, dc, rst);
emitValue<output_DEV>(ctx, state->dev);
void evaluate(Context ctx) {
if (!isSettingUp()) return;
emitValue<output_DEV>(ctx, &dev);
}
}