Skip to content
Snippets Groups Projects
Select Git revision
  • 7170157244651c929a25fb0f5566ddff6033c64a
  • master default protected
  • esb_py
  • analog_gpio
  • config
  • esb
  • esb_squashed_nopy
  • card10.cfg
  • fix-intid
  • hwlock_pc
  • jailbreak
  • debug_module
  • gpio_fix
  • fd_ownership
  • moar_blacklist
  • hula
  • mx_printf
  • fileapi
  • dir
  • tidy
  • fatfs-generation
21 results

simple_menu.py

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    main.c 700 B
    #include "py/runtime.h"
    #include "py/gc.h"
    #include "lib/utils/pyexec.h"
    #include "py/stackctrl.h"
    #include <stdio.h>
    
    #include "max32665.h"
    
    static char heap[4096];
    
    extern int __StackTop, __StackLimit;
    
    int main(void)
    {
    	if (0) {
    		mp_stack_set_top(&__StackTop);
    		mp_stack_set_limit((mp_int_t)&__StackLimit);
    	}
    
    	/* TMR5 is used to notify on keyboard interrupt */
    	NVIC_EnableIRQ(TMR5_IRQn);
    
    	while (1) {
    		gc_init(heap, heap + sizeof(heap));
    
    		mp_init();
    		pyexec_friendly_repl();
    		mp_deinit();
    	}
    }
    
    void gc_collect(void)
    {
    	void *sp = (void *)__get_MSP();
    
    	gc_collect_start();
    	gc_collect_root(
    		sp,
    		((mp_uint_t)&__StackTop - (mp_uint_t)sp) / sizeof(mp_uint_t)
    	);
    	gc_collect_end();
    }