Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • add_menu_vibration
  • blinkisync-as-preload
  • ch3/api-speed-eval2
  • ch3/dual-core
  • ch3/genapi-refactor
  • ch3/leds-api
  • ch3/splashscreen
  • dualcore
  • dx/flatten-config-module
  • dx/meh-bdf-to-stm
  • freertos-btle
  • genofire/ble-follow-py
  • koalo/bhi160-works-but-dirty
  • koalo/factory-reset
  • koalo/wip/i2c-for-python
  • master
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • plaetzchen/ios-workaround
  • rahix/bhi
  • rahix/bluetooth-app-favorite
  • rahix/bma
  • rahix/user-space-ctx
  • renze/hatchery_apps
  • renze/safe_mode
  • schleicher-test
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/ancs
  • schneider/ble-buffers
  • schneider/ble-central
  • schneider/ble-ecg-stream-visu
  • schneider/ble-fixes-2020-3
  • schneider/ble-mini-demo
  • schneider/ble-stability
  • schneider/ble-stability-new-phy
  • schneider/bonding
  • schneider/bonding-fail-if-full
  • schneider/bootloader-update-9a0d158
  • schneider/deepsleep
  • schneider/deepsleep2
  • schneider/deepsleep4
  • schneider/default-main
  • schneider/freertos-list-debug
  • schneider/fundamental-test
  • schneider/iaq-python
  • schneider/ir
  • schneider/max30001
  • schneider/max30001-epicaridum
  • schneider/max30001-pycardium
  • schneider/maxim-sdk-update
  • schneider/mp-exception-print
  • schneider/mp-for-old-bl
  • schneider/png
  • schneider/schleicher-test
  • schneider/sdk-0.2.1-11
  • schneider/sdk-0.2.1-7
  • schneider/sleep-display
  • schneider/spo2-playground
  • schneider/stream-locks
  • schneider/v1.17-changelog
  • bootloader-v1
  • release-1
  • v0.0
  • v1.0
  • v1.1
  • v1.10
  • v1.11
  • v1.12
  • v1.13
  • v1.14
  • v1.15
  • v1.16
  • v1.17
  • v1.18
  • v1.2
  • v1.3
  • v1.4
  • v1.5
  • v1.6
  • v1.7
  • v1.8
  • v1.9
82 results

Target

Select target project
  • card10/firmware
  • annejan/firmware
  • astro/firmware
  • fpletz/firmware
  • gerd/firmware
  • fleur/firmware
  • swym/firmware
  • l/firmware
  • uberardy/firmware
  • wink/firmware
  • madonius/firmware
  • mot/firmware
  • filid/firmware
  • q3k/firmware
  • hauke/firmware
  • Woazboat/firmware
  • pink/firmware
  • mossmann/firmware
  • omniskop/firmware
  • zenox/firmware
  • trilader/firmware
  • Danukeru/firmware
  • shoragan/firmware
  • zlatko/firmware
  • sistason/firmware
  • datenwolf/firmware
  • bene/firmware
  • amedee/firmware
  • martinling/firmware
  • griffon/firmware
  • chris007/firmware
  • adisbladis/firmware
  • dbrgn/firmware
  • jelly/firmware
  • rnestler/firmware
  • mh/firmware
  • ln/firmware
  • penguineer/firmware
  • monkeydom/firmware
  • jens/firmware
  • jnaulty/firmware
  • jeffmakes/firmware
  • marekventur/firmware
  • pete/firmware
  • h2obrain/firmware
  • DooMMasteR/firmware
  • jackie/firmware
  • prof_r/firmware
  • Draradech/firmware
  • Kartoffel/firmware
  • hinerk/firmware
  • abbradar/firmware
  • JustTB/firmware
  • LuKaRo/firmware
  • iggy/firmware
  • ente/firmware
  • flgr/firmware
  • Lorphos/firmware
  • matejo/firmware
  • ceddral7/firmware
  • danb/firmware
  • joshi/firmware
  • melle/firmware
  • fitch/firmware
  • deurknop/firmware
  • sargon/firmware
  • markus/firmware
  • kloenk/firmware
  • lucaswerkmeister/firmware
  • derf/firmware
  • meh/firmware
  • dx/card10-firmware
  • torben/firmware
  • yuvadm/firmware
  • AndyBS/firmware
  • klausdieter1/firmware
  • katzenparadoxon/firmware
  • xiretza/firmware
  • ole/firmware
  • techy/firmware
  • thor77/firmware
  • TilCreator/firmware
  • fuchsi/firmware
  • dos/firmware
  • yrlf/firmware
  • PetePriority/firmware
  • SuperVirus/firmware
  • sur5r/firmware
  • tazz/firmware
  • Alienmaster/firmware
  • flo_h/firmware
  • baldo/firmware
  • mmu_man/firmware
  • Foaly/firmware
  • sodoku/firmware
  • Guinness/firmware
  • ssp/firmware
  • led02/firmware
  • Stormwind/firmware
  • arist/firmware
  • coon/firmware
  • mdik/firmware
  • pippin/firmware
  • royrobotiks/firmware
  • zigot83/firmware
  • mo_k/firmware
106 results
Select Git revision
Loading items
Show changes
Showing
with 92380 additions and 43 deletions
epicardium/version-splash.png

15 KiB

...@@ -28,8 +28,7 @@ int main(void) ...@@ -28,8 +28,7 @@ int main(void)
0, 0,
160, 160,
80, 80,
GFX_RAW, GFX_RGB565,
sizeof(Heart),
(const void *)(Heart) (const void *)(Heart)
); );
gfx_update(&display_screen); gfx_update(&display_screen);
......
...@@ -401,11 +401,11 @@ int main(void) ...@@ -401,11 +401,11 @@ int main(void)
uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status; uint32_t ecgFIFO, readECGSamples, idx, ETAG[32], status;
int16_t ecgSample[32]; int16_t ecgSample[32];
const int EINT_STATUS_MASK = 1 << 23; const uint32_t EINT_STATUS_MASK = 1 << 23;
const int FIFO_OVF_MASK = 0x7; const uint32_t FIFO_OVF_MASK = 0x7;
const int FIFO_VALID_SAMPLE_MASK = 0x0; const uint32_t FIFO_VALID_SAMPLE_MASK = 0x0;
const int FIFO_FAST_SAMPLE_MASK = 0x1; const uint32_t FIFO_FAST_SAMPLE_MASK = 0x1;
const int ETAG_BITS_MASK = 0x7; const uint32_t ETAG_BITS_MASK = 0x7;
while (1) { while (1) {
#if 1 #if 1
......
...@@ -36,8 +36,7 @@ int main(void) ...@@ -36,8 +36,7 @@ int main(void)
0, 0,
160, 160,
80, 80,
GFX_RAW, GFX_RGB565,
sizeof(Heart),
(const void *)(Heart) (const void *)(Heart)
); );
gfx_update(&display_screen); gfx_update(&display_screen);
......
...@@ -43,8 +43,7 @@ int main(void) ...@@ -43,8 +43,7 @@ int main(void)
0, 0,
40, 40,
40, 40,
GFX_RAW, GFX_RGB565,
40 * 40 * 2,
(const void *)(gImage_40X40) (const void *)(gImage_40X40)
); );
gfx_copy_region( gfx_copy_region(
...@@ -53,8 +52,7 @@ int main(void) ...@@ -53,8 +52,7 @@ int main(void)
0, 0,
160, 160,
80, 80,
GFX_RAW, GFX_RGB565,
160 * 80 * 2,
(const void *)(gImage_160X80) (const void *)(gImage_160X80)
); );
gfx_update(&display_screen); gfx_update(&display_screen);
......
...@@ -24,6 +24,9 @@ void fade() ...@@ -24,6 +24,9 @@ void fade()
/* /*
* main() is called when l0dable is loaded and executed. * main() is called when l0dable is loaded and executed.
*
* When main() returns, card10 goes back to the menu. A non-zero return value
* can be used to signal some kind of failure during l0dable execution.
*/ */
int main(void) int main(void)
{ {
......
...@@ -157,12 +157,9 @@ Reset_Handler: ...@@ -157,12 +157,9 @@ Reset_Handler:
ldr r0, =main ldr r0, =main
blx r0 blx r0
/* /* C code done, return to menu. Return code is what main() returned. */
* C code done, spin forever. ldr r4, =epic_exit
* TODO(q3k): let epicardium know we're done. blx r4
*/
.spin:
bl .spin
/* /*
* Used by __libc_init_array. * Used by __libc_init_array.
...@@ -184,22 +181,12 @@ DefaultHandler: ...@@ -184,22 +181,12 @@ DefaultHandler:
b . b .
.macro def_irq_handler handler_name .macro def_irq_handler handler_name
.weak \handler_name .weakref \handler_name, DefaultHandler
\handler_name : b .
.endm .endm
/* /*
* Declare all default ISRs. * Declare all default ISRs.
*/ */
def_irq_handler NMI_Handler
def_irq_handler HardFault_Handler
def_irq_handler MemManage_Handler
def_irq_handler BusFault_Handler
def_irq_handler UsageFault_Handler
def_irq_handler SVC_Handler
def_irq_handler DebugMon_Handler
def_irq_handler PendSV_Handler
def_irq_handler PF_IRQHandler def_irq_handler PF_IRQHandler
def_irq_handler WDT0_IRQHandler def_irq_handler WDT0_IRQHandler
def_irq_handler RTC_IRQHandler def_irq_handler RTC_IRQHandler
......
...@@ -128,3 +128,25 @@ uint32_t _sbrk(int incr) ...@@ -128,3 +128,25 @@ uint32_t _sbrk(int incr)
brk += incr; brk += incr;
return (uint32_t)prev_brk; return (uint32_t)prev_brk;
} }
void HardFault_Handler(void)
{
/*
* We pray that we're not currently in an API call and attempt
* returning. This is okay because a HardFault during an API call is
* extremely unlikely.
*
* In the future, we could improve this by "finishing" an ongoing API
* call before firing epic_exit().
*/
epic_exit(255);
}
/* Alias all other exception handlers to the HardFault_Handler. */
void NMI_Handler(void) __attribute__((alias("HardFault_Handler")));
void MemManage_Handler(void) __attribute__((alias("HardFault_Handler")));
void BusFault_Handler(void) __attribute__((alias("HardFault_Handler")));
void UsageFault_Handler(void) __attribute__((alias("HardFault_Handler")));
void SVC_Handler(void) __attribute__((alias("HardFault_Handler")));
void DebugMon_Handler(void) __attribute__((alias("HardFault_Handler")));
void PendSV_Handler(void) __attribute__((alias("HardFault_Handler")));
...@@ -60,16 +60,11 @@ void card10_init(void) ...@@ -60,16 +60,11 @@ void card10_init(void)
TMR_Delay(MXC_TMR0, MSEC(1000), 0); TMR_Delay(MXC_TMR0, MSEC(1000), 0);
// Enable 32 kHz output // Enable 32 kHz output
while (RTC_SquareWave( while (RTC_SquareWave(MXC_RTC, SQUARE_WAVE_ENABLED, F_32KHZ, NULL) ==
MXC_RTC, E_BUSY)
SQUARE_WAVE_ENABLED,
F_32KHZ,
NOISE_IMMUNE_MODE,
NULL) == E_BUSY
)
; ;
/* If we don't have a valid time yet, set it to 2019-01-01 */ /* If we don't have a valid time yet, set it to 2019-01-01 */
if (RTC_GetSecond() < 1546300800UL) { if (RTC_GetSecond() < 1546300800L) {
while (RTC_Init(MXC_RTC, 1546300800UL, 0, NULL) == E_BUSY) while (RTC_Init(MXC_RTC, 1546300800UL, 0, NULL) == E_BUSY)
; ;
} }
...@@ -84,6 +79,7 @@ void card10_init(void) ...@@ -84,6 +79,7 @@ void card10_init(void)
spi17y_master_cfg.ss0 = Enable; spi17y_master_cfg.ss0 = Enable;
spi17y_master_cfg.ss1 = Disable; spi17y_master_cfg.ss1 = Disable;
spi17y_master_cfg.ss2 = Disable; spi17y_master_cfg.ss2 = Disable;
spi17y_master_cfg.num_io = 2;
if (SPI_Init(SPI0, 0, SPI_SPEED, spi17y_master_cfg) != 0) { if (SPI_Init(SPI0, 0, SPI_SPEED, spi17y_master_cfg) != 0) {
printf("Error configuring SPI\n"); printf("Error configuring SPI\n");
while (1) while (1)
......
...@@ -100,7 +100,7 @@ int portexpander_init(void) ...@@ -100,7 +100,7 @@ int portexpander_init(void)
// Enable pull-ups for buttons // Enable pull-ups for buttons
// Enable outputs for the transistors, the LED and the LCD reset // Enable outputs for the transistors, the LED and the LCD reset
for (int i = 0; i < sizeof(pe_pin_config) / sizeof(pe_pin_config[0]); for (size_t i = 0; i < sizeof(pe_pin_config) / sizeof(pe_pin_config[0]);
i++) { i++) {
ret = portexpander_config(&pe_pin_config[i]); ret = portexpander_config(&pe_pin_config[i]);
MXC_ASSERT(ret == E_NO_ERROR); MXC_ASSERT(ret == E_NO_ERROR);
......
Subproject commit 1c9e3886f69f9ca83c1af49968d8e4389035ff44
includes = include_directories(
'./',
)
sources = files(
'./tiny-AES-c/aes.c',
'./SHA256/mark2/sha256.c',
)
lib = static_library(
'crypto',
sources,
include_directories: includes,
c_args: '-w',
)
libcrypto = declare_dependency(
include_directories: includes,
link_with: lib,
)
Subproject commit 3f69a5899e58e2e398e8c32ce7b3a954dd593ed4
#include <stdlib.h>
#include <libgen.h>
#define CTX_MAX_DRAWLIST_SIZE 4096000
#define CTX_BACKEND_TEXT 0 // we keep then non-backend code paths
// for code handling aroud, this should
// be run-time to permit doing text_to_path
#define CTX_RASTERIZER 0
#define CTX_BITPACK_PACKER 1 // pack vectors
#define CTX_BITPACK 1
#define STB_TRUETYPE_IMPLEMENTATION
#include "stb_truetype.h"
#include <sys/time.h>
#define CTX_EXTRAS 1
#define CTX_FONTS_FROM_FILE 1
#define CTX_AVX2 0
#define CTX_IMPLEMENTATION
#define CTX_PARSER 1
#include "ctx-nofont.h"
static int usage(){
fprintf (stderr, "tool to generate native ctx embedded font format\n");
fprintf (stderr, "\n");
fprintf (stderr, "usage: ctx-fontgen <file.ttf> [name [set1-set2-set3]]\n");
fprintf (stderr, "\nrecognized sets: latin1, ascii, extra, all, emoji\n");
fprintf (stderr, "\na final argument of \"binary\" might be appended, causing\nthe generated file to be binary ctx.\n");
return -1;
}
CtxDrawlist output_font={NULL,};
uint32_t glyphs[65536];
int n_glyphs = 0;
void
add_glyph (Ctx *ctx, uint32_t glyph)
{
for (int i = 0; i < n_glyphs; i++)
{
if (glyphs[i] == glyph)
return;
}
ctx_reset (ctx);
ctx_font_size (ctx, CTX_BAKE_FONT_SIZE);
ctx_move_to (ctx, 0, 0);
if (ctx_glyph (ctx, glyph, 1))
return;
glyphs[n_glyphs++] = glyph;
ctx->drawlist.flags = CTX_TRANSFORMATION_BITPACK;
ctx_drawlist_compact (&ctx->drawlist);
char buf[44]={0,0,0,0,0};
ctx_unichar_to_utf8 (glyph, (uint8_t*)buf);
uint32_t args[2] = {glyph, ctx_glyph_width (ctx, glyph) * 256};
ctx_drawlist_add_u32 (&output_font, CTX_DEFINE_GLYPH, args);
for (int i = 3; i < ctx->drawlist.count - 1; i++)
{
CtxEntry *entry = &ctx->drawlist.entries[i];
args[0] = entry->data.u32[0];
args[1] = entry->data.u32[1];
ctx_drawlist_add_u32 (&output_font, entry->code, &args[0]);
}
}
static int find_glyph (CtxDrawlist *drawlist, uint32_t unichar)
{
for (int i = 0; i < drawlist->count; i++)
{
if (drawlist->entries[i].code == CTX_DEFINE_GLYPH &&
drawlist->entries[i].data.u32[0] == unichar)
{
return i;
// XXX this could be prone to insertion of valid header
// data in included bitmaps.. is that an issue?
}
}
fprintf (stderr, "Eeeek %i\n", unichar);
return -1;
}
int main (int argc, char **argv)
{
int binary = 0;
const char *path;
const char *name = "regular";
const char *subsets = "latin1";
Ctx *ctx;
path = argv[1];
if (!path)
{
return usage();
}
if (argv[2])
{
name = argv[2];
if (argv[3])
subsets = argv[3];
if (argv[4] && !strcmp(argv[4], "binary"))
binary=1;
}
ctx_load_font_ttf_file ("import", argv[1]);
ctx = ctx_new ();
_ctx_set_transformation (ctx, CTX_TRANSFORMATION_RELATIVE);
ctx_font (ctx, "import");
if (strstr (subsets, "all"))
for (int glyph = 0; glyph < 65536*8; glyph++) add_glyph (ctx, glyph);
if (strstr (subsets, "latin1"))
for (int glyph = 0; glyph < 256; glyph++) add_glyph (ctx, glyph);
if (strstr (subsets, "ascii"))
for (int glyph = 0; glyph < 127; glyph++) add_glyph (ctx, glyph);
if (strstr (subsets, "terminal"))
{
char* string = "☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼! #$%&'()*+,-.🔒"
"⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐"
"└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■"
"!#$%&'()*+,-./◆▒␉␌␍␊°±␤␋┘┐┌└┼⎺⎻─⎼⎽├┤┴┬│≤≥π≠£·";
for (const char *utf8 = string; *utf8; utf8 = ctx_utf8_skip (utf8, 1))
add_glyph (ctx, ctx_utf8_to_unichar (utf8));
}
if (strstr (subsets, "cp437"))
{
char* string = " ☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼!\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^,`abcdefghijklmnopqrstuvwxyz{|}~⌂"
"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»"
"░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀"
"αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■";
for (const char *utf8 = string; *utf8; utf8 = ctx_utf8_skip (utf8, 1))
add_glyph (ctx, ctx_utf8_to_unichar (utf8));
}
if (strstr (subsets, "vt100"))
{
char* string =
" !\"#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_◆▒␉␌␍␊°±␤␋┘┐┌└┼⎺⎻─⎼⎽├┤┴┬│≤≥π≠£· ";
for (const char *utf8 = string; *utf8; utf8 = ctx_utf8_skip (utf8, 1))
add_glyph (ctx, ctx_utf8_to_unichar (utf8));
}
if (strstr (subsets, "extras"))
{
char *string =
"éñÑßæøåö£ÆÖØÅ€§π°üÜ…”““”«»©®™⭾⏎⌫·←↑↓→☀☁☂☢☭☮☯☽✉⚙⚠␣²◆♥♦♣♠÷≈±╴−╶";
for (const char *utf8 = string; *utf8; utf8 = ctx_utf8_skip (utf8, 1))
add_glyph (ctx, ctx_utf8_to_unichar (utf8));
}
if (strstr (subsets, "emoji"))
{
char *string = "๛ ☬☣☠☀☁☂☃☢☭☮☯☼☽✉✓❤№℃∞◌◎☎☐☑♉♩♪♫♬☆◦☄☉☏☤☥☹☺☻♲♨♼♽♾⚀⚁🥕⚂⚃⚄⚅⚙⚠␣⚡⌨⌚⏏⋯•‥․‣•↺↻⌘☕✈✉✓✔✕✖✗✘☑☒☐☓✶❄❍❢❣❤❥❤❥❦❧➲㎏㎆㎅㎇㎤㎥㎦㎝㎧㎨㎞㎐㎏㎑㎒㎓㎠㎡㎢★⁈ ⁉ ⁂✵✺✽✾✿❀❁❂❉❆✡✠🤐🤑🤒🤓🤔🤕🤖🤗🤘🤙🤚🤛🤜🤝🤞🤟🤠🤡🤢🤣🤤🤥🤦🤧🤨🤩🤪🤫🤬🤭🤮🤯🤷🤸🤹🤺🥂🥇🥈🥉🥤🥨🥬🥰🥱🥳🥴🥵🥶🥺🦁🦄🦉🦊🦋🦎🦓🦔🦕🦖🦘🦙🦚🦜🦝🦟🦴🦽🦾🦿🧁🧉🧐🧙🧚🧛🧜🧟🧠🧡🧥🧤🧦🧪🧬🧭🧮🧯🧰🧱🧲🧵🧷🧸🧺🧻🛹🛸🛵🛴🛰🛬🛫🛩🛠🛣🛤🛥🛒🛏🛌🛂🛁🚶🚴🚲🚬🚩🚗🚜🚴🚘🚖🚔🚚🚑🚍🚆🚀🙈🙉🙊🙄🙃🙂🙁🙀😿😾😽😼😻😺😹😸😷😶😵😴😳😲😱😰😯😮😭😬😫😪😩😨😧😦😥😤😣😢😡😠😟😞😝😜😛😚😙😘😗😖😕😔😓😒😑😐😏😎😍😌😋😊😉😈😇😆😅😄😃😂😁😀🗝🗜🗞🗓🗒🗑🗄🖼🖤🖥🖨🖖🖕🖐🖍🖌🖋🖊🖇🕺🕹🕸🕷🕶🕵🕴🕰🕯🔭🔬🔫🔪🔩🔨🔧🔦🔥🔤🔢🔣🔡🔠🔗🔕🔔🔓🔒🔑🔐🔏🔌🔋🔊🔉🔈🔇🔅🔆📽📻📺📹📸📷📳📱📰📯📭📬📫📪📨📦📡📞📚📖📐📏📎📍📌📉📈📄📃📂📁💿💾💻💸💶💳💰💯💫💩💧💦💤💣💢💡💞💖💕💔💓💊💃💀👾👽👻👺👹👸👷👶👵👴👯👭👬👫👣👓👋👍👎🐾🐼🐻🐺🐹🐸🐷🐶🐵🐳🐲🐱🐰🐯🐮🐭🐬🐧🐦🐥🐤🐣🐢🐡🐠🐟🐞🐝🐜🐛🐙🐘🐔🐓🐒🐑🐐🐏🐎🐍🐌🐋🐊🐉🐈🐇🐆🐅🐄🐃🐂🐁🐀🏺🏹🏸🏷🏴🏳🏵🏰🏭🏬🏫🏪🏧🏢🏠🏡🏐🏍🏆🏅🏁🎼🎶🎵🎲🎰🎮🎬🎨🎧🎥🎞🎃🎄🍸🍷🍄🌿🍀🍁🍒🌵🌳🌲🌩🌪🌨🌧🌦🌥🌤🌡🌠🌟🌞🌝🌜🌛🌚🌙🌘🌗🌖🌕🌔🌓🌒🌑🌐🌏🌎🌍🌌🌋🌊🌅🌄🌂🌀";
for (const char *utf8 = string; *utf8; utf8 = ctx_utf8_skip (utf8, 1))
add_glyph (ctx, ctx_utf8_to_unichar (utf8));
}
for (int i = 0; i < n_glyphs; i++)
for (int j = 0; j < n_glyphs; j++)
{
float kerning = ctx_glyph_kern (ctx, glyphs[i], glyphs[j]);
if (kerning > 0.2)
{
CtxCommand command;
int pos = find_glyph (&output_font, glyphs[i]);
pos ++;
while (pos < output_font.count &&
output_font.entries[pos].code != CTX_DEFINE_GLYPH)
pos++;
command.code = CTX_KERNING_PAIR;
command.kern.glyph_before = glyphs[i];
command.kern.glyph_after = glyphs[j];
command.kern.amount = kerning * 256;
ctx_drawlist_insert_entry (&output_font, pos, (CtxEntry*)&command);
}
}
ctx_free (ctx);
if (!binary)
{
printf ("#ifndef CTX_FONT_%s\n", name);
printf ("/* this is a ctx encoded font based on %s */\n", basename (argv[1]));
printf ("/* CTX_SUBDIV:%i CTX_BAKE_FONT_SIZE:%i */\n", CTX_SUBDIV, CTX_BAKE_FONT_SIZE);
printf ("/* glyphs covered: \n\n");
int col = 0;
for (int i = 0; i < output_font.count; i++)
{
CtxEntry *entry = &output_font.entries[i];
if (entry->code == '@')
{
char buf[44]={0,0,0,0,0};
ctx_unichar_to_utf8 (entry->data.u32[0], (uint8_t*)buf);
switch (buf[0])
{
case '\\':
printf ("\\");
break;
default:
printf ("%s", buf);
}
col++;
if (col > 73)
{
col = 0;
printf ("\n ");
}
}
}
printf (" */\n");
printf ("static const struct __attribute__ ((packed)) {uint8_t code; uint32_t a; uint32_t b;}\nctx_font_%s[]={\n", name);
for (int i = 0; i < output_font.count; i++)
{
CtxEntry *entry = &output_font.entries[i];
if (entry->code > 32 && entry->code < 127)
{
printf ("{'%c', 0x%08x, 0x%08x},", entry->code,
entry->data.u32[0],
entry->data.u32[1]);
}
else
{
printf ("{%i, 0x%08x, 0x%08x},", entry->code,
entry->data.u32[0],
entry->data.u32[1]);
}
if (entry->code == '@')
{
char buf[44]={0,0,0,0,0};
ctx_unichar_to_utf8 (entry->data.u32[0], (uint8_t*)buf);
switch (buf[0])
{
case '\\':
printf ("/* \\ x-advance: %f */", entry->data.u32[1]/256.0);
break;
default:
printf ("/* %s x-advance: %f */", buf, entry->data.u32[1]/256.0);
}
}
else
{
}
printf ("\n");
}
printf ("};\n");
printf ("#define CTX_FONT_%s 1\n", name);
printf ("#endif\n");
}
else
{
for (int i = 0; i < output_font.count; i++)
{
CtxEntry *entry = &output_font.entries[i];
for (int c = 0; c < (int)sizeof (CtxEntry); c++)
printf ("%c",((uint8_t*)(entry))[c]);
}
}
return 0;
}
Source diff could not be displayed: it is too large. Options to address this: view the blob.
#include <math.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdint.h>
/* clang-format off */
#define CTX_MIN_EDGE_LIST_SIZE 256
#define CTX_MAX_EDGE_LIST_SIZE 512
#define CTX_MIN_JOURNAL_SIZE 512
#define CTX_MAX_JOURNAL_SIZE 512
#define CTX_LIMIT_FORMATS 1
#define CTX_DITHER 1
#define CTX_ENABLE_RGB565_BYTESWAPPED 1
#define CTX_BITPACK_PACKER 0
#define CTX_COMPOSITING_GROUPS 0
#define CTX_RENDERSTREAM_STATIC 0
#define CTX_GRADIENT_CACHE 1
#define CTX_ENABLE_CLIP 1
#define CTX_BLOATY_FAST_PATHS 0
#define CTX_1BIT_CLIP 1
#define CTX_RASTERIZER_AA 15
#define CTX_RASTERIZER_FORCE_AA 0
#define CTX_SHAPE_CACHE 0
#define CTX_SHAPE_CACHE_DIM 16*18
#define CTX_SHAPE_CACHE_ENTRIES 128
#define CTX_RASTERIZER_MAX_CIRCLE_SEGMENTS 36
#define CTX_RASTERIZER 1
#define CTX_EVENTS 0
#define CTX_STRINGPOOL_SIZE 512
#define CTX_ENABLE_SHADOW_BLUR 0
#define CTX_FORMATTER 0
#define CTX_PARSER 0
#define CTX_FONTS_FROM_FILE 0
/* clang-format on */
#define CTX_IMPLEMENTATION
/* Defining this causes the internal font to be dropped. */
#define _CTX_INTERNAL_FONT_
#include "font-fira-mono.h"
#include "ctx.h"
Source diff could not be displayed: it is too large. Options to address this: view the blob.
File added
ctx.h is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
ctx.h is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with ctx; if not, see <https://www.gnu.org/licenses/>.
2002, 2012, 2015, 2019, 2020 Øyvind Kolås <pippin@gimp.org>
includes = include_directories(
'./',
)
libm_native = meson.get_compiler('c', native: true).find_library('m')
ctx_fontgen_bin = executable(
'ctx-fontgen',
'ctx-fontgen.c',
native: true,
include_directories: includes,
dependencies: libm_native,
c_args: ['-w', '-DNO_LIBCURL']
)
ctx_fontgen = generator(
ctx_fontgen_bin,
output: 'font-@BASENAME@.h',
arguments: ['@INPUT@', 'mono', 'ascii-extras'],
capture: true,
)
font = ctx_fontgen.process('fira-mono.ttf')
sources = files(
'ctx.c',
)
lib = static_library(
'ctx',
sources,
font,
include_directories: includes,
dependencies: periphdriver,
c_args: ['-O3', '-w']
)
libctx = declare_dependency(
include_directories: includes,
link_with: lib,
)