Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion common/pimoroni_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ namespace pimoroni {
191, 193, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220,
222, 224, 227, 229, 231, 233, 235, 237, 239, 241, 244, 246, 248, 250, 252, 255};

inline constexpr uint16_t GAMMA_12BIT[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 47, 48, 50,
52, 53, 55, 57, 59, 61, 63, 65, 68, 70, 72, 75, 78, 80, 83, 86,
89, 92, 95, 98, 102, 105, 109, 112, 116, 120, 124, 128, 132, 137, 141, 146,
150, 155, 160, 165, 170, 175, 181, 186, 192, 198, 204, 210, 216, 222, 228, 235,
242, 249, 256, 263, 270, 277, 285, 293, 301, 309, 317, 325, 334, 342, 351, 360,
369, 379, 388, 398, 408, 418, 428, 438, 449, 459, 470, 481, 493, 504, 516, 527,
539, 552, 564, 576, 589, 602, 615, 629, 642, 656, 670, 684, 698, 713, 727, 742,
758, 773, 789, 804, 820, 837, 853, 870, 887, 904, 921, 939, 957, 975, 993, 1011,
1030, 1049, 1068, 1088, 1107, 1127, 1147, 1168, 1189, 1209, 1231, 1252, 1274, 1296, 1318, 1340,
1363, 1386, 1409, 1432, 1456, 1480, 1504, 1529, 1554, 1579, 1604, 1630, 1656, 1682, 1708, 1735,
1762, 1789, 1817, 1845, 1873, 1901, 1930, 1959, 1988, 2018, 2048, 2078, 2109, 2139, 2171, 2202,
2234, 2266, 2298, 2331, 2364, 2397, 2430, 2464, 2498, 2533, 2568, 2603, 2638, 2674, 2710, 2747,
2784, 2821, 2858, 2896, 2934, 2973, 3011, 3050, 3090, 3130, 3170, 3210, 3251, 3292, 3334, 3376,
3418, 3461, 3504, 3547, 3591, 3635, 3679, 3724, 3769, 3814, 3860, 3906, 3953, 4000, 4047, 4095};

/* Moved from pico_unicorn.cpp
v = (uint16_t)(powf((float)(n) / 255.0f, 2.2) * 16383.0f + 0.5f) */
inline constexpr uint16_t GAMMA_14BIT[256] = {
Expand Down Expand Up @@ -147,4 +165,4 @@ namespace pimoroni {
bool_pair() : first(false), second(false) {}
bool_pair(bool first, bool second) : first(first), second(second) {}
};
}
}
2 changes: 1 addition & 1 deletion examples/pico_unicorn/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

using namespace pimoroni;

PicoUnicorn pico_unicorn;
PicoUnicorn<14,1,0, uint16_t, pimoroni::GAMMA_14BIT> pico_unicorn;

int main() {
bool a_pressed = false;
Expand Down
4 changes: 2 additions & 2 deletions examples/pico_unicorn_plasma/demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BSD License

using namespace pimoroni;

PicoUnicorn pico_unicorn;
PicoUnicorn<14,1,0, uint16_t, pimoroni::GAMMA_14BIT> pico_unicorn;

// Sine table to speed up execution
static const int8_t sinetab[256] = {
Expand Down Expand Up @@ -95,7 +95,7 @@ void from_hsv(float h, float s, float v, uint8_t &r, uint8_t &g, uint8_t &b) {

int main() {
stdio_init_all();
pico_unicorn.init();
// pico_unicorn.init();
pico_unicorn.clear();


Expand Down
Loading