33 lines
940 B
C
33 lines
940 B
C
#pragma once
|
|
#include <Figments.h>
|
|
#include <ArduinoJson.h>
|
|
|
|
struct JsonCoordinateMapping : CoordinateMapping {
|
|
struct Span {
|
|
int length = 0;
|
|
int x = 0;
|
|
int y = 0;
|
|
bool reverse = false;
|
|
|
|
uint16_t physicalIdx = 0;
|
|
|
|
Span() {}
|
|
Span(int length, int x, int y, bool rev, uint16_t idx) : length(length), x(x), y(y), reverse(rev), physicalIdx(idx) {}
|
|
};
|
|
|
|
uint8_t rotation = 0;
|
|
|
|
Span displayMap[32];
|
|
int strideCount = 0;
|
|
|
|
void load(const JsonArray& strides);
|
|
void loadDefault();
|
|
|
|
VirtualCoordinates physicalToVirtualCoords(const PhysicalCoordinates localCoords) const override;
|
|
PhysicalCoordinates virtualToPhysicalCoords(const VirtualCoordinates virtualCoords) const override;
|
|
int physicalCoordsToIndex(const PhysicalCoordinates localCoords) const override;
|
|
unsigned int physicalPixelCount() const override;
|
|
|
|
VirtualCoordinates rotate(const VirtualCoordinates coords, uint8_t rotation) const;
|
|
};
|