A simple 4-function calculator with floating point support for the Esposito OS.
- Basic Operations: Addition, subtraction, multiplication, division
- Floating Point: Uses hardware-accelerated float operations via ESP32 FPU
- Touch Interface: Large, touch-friendly buttons optimized for the ESP32 CYD touchscreen
- Keyboard Support: Full keyboard input including BBQ20 keyboard support
- Display: Large, bright green display using scaled text rendering
- Memory Functions: Clear, sign toggle (+/-), and percentage operations
┌─────────────────────────────────────┐
│ Calculator │
│ │
│ [ Large Display Area ] │
│ │
│ ┌───┐┌───┐┌───┐┌───┐ │
│ │ C ││+/-││ % ││ / │ │
│ └───┘└───┘└───┘└───┘ │
│ ┌───┐┌───┐┌───┐┌───┐ │
│ │ 7 ││ 8 ││ 9 ││ * │ │
│ └───┘└───┘└───┘└───┘ │
│ ┌───┐┌───┐┌───┐┌───┐ │
│ │ 4 ││ 5 ││ 6 ││ - │ │
│ └───┘└───┘└───┘└───┘ │
│ ┌───┐┌───┐┌───┐┌───┐ │
│ │ 1 ││ 2 ││ 3 ││ + │ │
│ └───┘└───┘└───┘└───┘ │
│ ┌───┐┌───┐┌───────────┐ │
│ │ 0 ││ . ││ = │ │
│ └───┘└───┘└───────────┘ │
└─────────────────────────────────────┘
- Font Size: 3x scaled text for the display
- Color: Bright green (RGB565: 0x07E0) on black background
- Precision: Single-precision float (32-bit) for hardware FPU acceleration
- Display Format: %.8g format for optimal precision/readability balance
- Button Width: Automatically calculated based on screen size, centered layout
- Touch Coordinates: Properly converts pixel coordinates to character coordinates using font metrics
- Digits 0-9: Number entry
- Operators:
+,-,*,/ - Decimal Point:
. - Equals:
=orEnter/Return - Clear:
C,c, orESC - Sign Toggle: Works through button only
- Percentage: Works through button only
ui- UI library for button widgets
This calculator demonstrates Esposito OS's floating point support:
- Hardware FPU: Uses ESP32 single-precision FPU for fast float operations
- OS Symbol Table: Math functions exported from firmware to apps
- No Double Math: Avoids slow software double-precision emulation
- Direct Display: Uses lovyanGFX scaled text rendering for large numbers
app.c- Main calculator applicationmanifest.cfg- App metadata and configurationdeps- UI library dependencyREADME.md- This file
# Build individual app
bash scripts/build_app.sh -l ui apps/calc/app.c
# Or build all apps
make test- The calculator uses standard order of operations (left-to-right for same precedence)
- Division by zero displays "Error"
- Large numbers are displayed in scientific notation when needed
- The display area is automatically cleared when starting new number entry