Casio fx-CG series port (#324)

* Initial test - working on Linux

* Try to make it work with liba

* Stop using liba and the filesystem

* IT WORKS

* Key input, full res, fix some of the crashes

* Fix the hang when doing calculations

* Add some more key mappings

* Fix the square root issue

* Icons

* Better key mappings, brightness control, better gamma correction, more effficient framebuffer

* Cleanup stage 1

* Cleanup stage 2

* Make the build system build a g3a

* Make it not exit when you press the menu button

* Add Casio port to README

* Use omega-master instead of omega-dev

* Fix mistake with cherry-picking in the README

* Fix internal storage crash

* Fix compile error on Numworks calculators

* Upsilon branding

* Sharper icon

* Make the CI work

* Add power off and improve menu

* Map Alpha + up/down to the brightness shortcut

* Add missing file

* Fix web CI build

* Revert "Fix web CI build"

This reverts commit f19657d9fc.

* Change "prizm" to "fxcg"

* Add FASTLOAD option for Add-in Push

* Add some charatcers to the catalog on Casio and improve key mappings

* Build with -Os -flto

* Disable LTO for now as it's causing crashes

* Put back the fonts I accidently changed

I'd like to add an option for this though as I prefer the ones from Epsilon
This commit is contained in:
circuit10
2023-05-10 17:28:18 +01:00
committed by GitHub
parent aadcd37f31
commit b44a95a9b3
77 changed files with 1617 additions and 49 deletions

View File

@@ -4,7 +4,9 @@
#include <assert.h>
#include <stdint.h>
#include <stddef.h>
#include <stdint.h>
#include <cmath>
#include <type_traits>
namespace Poincare {
@@ -41,11 +43,19 @@ public:
if (((uint64_t)mantissa >> (size()-k_mantissaNbBits-2)) & 1) {
u.ui += 1;
}
return u.f;
if (sizeof(T) == sizeof(float)) {
return u.f32.f;
} else {
return u.f64.f;
}
}
static int exponent(T f) {
uint_float u;
u.f = f;
if (sizeof(T) == sizeof(float)) {
u.f32.f = f;
} else {
u.f64.f = f;
}
constexpr uint16_t oneOnExponentsBits = maxExponent();
int exp = (u.ui >> k_mantissaNbBits) & oneOnExponentsBits;
exp -= exponentOffset();
@@ -75,10 +85,28 @@ public:
}
private:
#ifdef _BIG_ENDIAN
union uint_float {
uint64_t ui;
T f;
struct {
uint32_t padding;
float f;
} f32;
struct {
double f;
} f64;
};
#else
union uint_float {
uint64_t ui;
struct {
float f;
} f32;
struct {
double f;
} f64;
};
#endif
constexpr static size_t k_signNbBits = 1;
constexpr static size_t k_exponentNbBits = sizeof(T) == sizeof(float) ? 8 : 11;

View File

@@ -5,6 +5,14 @@
#include <assert.h>
#include <poincare/horizontal_layout.h>
#ifdef _FXCG
#include <gint/display.h>
#include <gint/keyboard.h>
#include <stdio.h>
#else
#include <stdio.h>
#endif
namespace Poincare {
class ExpressionLayout;
@@ -13,12 +21,17 @@ class LayoutNode;
class Integer;
struct IntegerDivision;
#ifdef _3DS
#if (defined _3DS) || (defined _FXCG)
typedef unsigned short half_native_uint_t;
static_assert(sizeof(half_native_uint_t) == sizeof(uint16_t));
typedef int native_int_t;
static_assert(sizeof(native_int_t) == sizeof(int32_t));
typedef long long int double_native_int_t;
static_assert(sizeof(double_native_int_t) == sizeof(int64_t));
typedef unsigned int native_uint_t;
static_assert(sizeof(native_uint_t) == sizeof(uint32_t));
typedef unsigned long long int double_native_uint_t;
static_assert(sizeof(double_native_uint_t) == sizeof(uint64_t));
#else
typedef uint16_t half_native_uint_t;
typedef int32_t native_int_t;
@@ -199,7 +212,12 @@ private:
if (i >= numberOfHalfDigits()) {
return 0;
}
return (usesImmediateDigit() ? ((half_native_uint_t *)&m_digit)[i] : ((half_native_uint_t *)digits())[i]);
native_uint_t d = usesImmediateDigit() ? m_digit : digits()[i/2];
if (i % 2 == 0) {
return d & 0xFFFF;
} else {
return d >> 16;
}
}
native_uint_t digit(uint8_t i) const {

View File

@@ -138,7 +138,7 @@ private:
private:
uint16_t m_currentIndex;
uint16_t m_availableIdentifiers[MaxNumberOfNodes];
static_assert(MaxNumberOfNodes < INT16_MAX && sizeof(m_availableIdentifiers[0] == sizeof(uint16_t)), "Tree node identifiers do not have the right data size.");
static_assert(MaxNumberOfNodes < INT16_MAX && sizeof(m_availableIdentifiers[0]) == sizeof(uint16_t), "Tree node identifiers do not have the right data size.");
};
void freePoolFromNode(TreeNode * firstNodeToDiscard);