Skip to content
Snippets Groups Projects
Select Git revision
  • schneider/ir
  • master default protected
  • rahix/user-space-ctx
  • schneider/iaq-python
  • schneider/ble-mini-demo
  • schneider/ble-ecg-stream-visu
  • schneider/mp-exception-print
  • schneider/sleep-display
  • schneider/deepsleep4
  • schneider/deepsleep2
  • schneider/deepsleep
  • schneider/ble-central
  • rahix/bluetooth-app-favorite
  • schneider/v1.17-changelog
  • schneider/ancs
  • schneider/png
  • schneider/freertos-list-debug
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/bonding-fail-if-full
  • schneider/ble-fixes-2020-3
  • v1.18
  • v1.17
  • v1.16
  • v1.15
  • v1.14
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
40 results

sys_ble.c

Blame
  • sys_ble.c 1.46 KiB
    #include "epicardium.h"
    
    #include "py/obj.h"
    #include "py/objlist.h"
    #include "py/runtime.h"
    
    #include <stdint.h>
    
    static mp_obj_t mp_ble_confirm_compare_value(void)
    {
    	epic_ble_confirm_compare_value();
    	return mp_const_none;
    }
    static MP_DEFINE_CONST_FUN_OBJ_0(ble_confirm_compare_value_obj, mp_ble_confirm_compare_value);
    
    static mp_obj_t mp_ble_get_compare_value(void)
    {
    	return mp_obj_new_int(epic_ble_get_compare_value());
    }
    static MP_DEFINE_CONST_FUN_OBJ_0(ble_get_compare_value_obj, mp_ble_get_compare_value);
    
    static mp_obj_t mp_ble_set_bondable(mp_obj_t bondable_obj)
    {
    	bool bondable = mp_obj_is_true(bondable_obj);
    	epic_ble_set_bondable(bondable);
    	return mp_const_none;
    }
    static MP_DEFINE_CONST_FUN_OBJ_1(ble_set_bondable_obj, mp_ble_set_bondable);
    
    static const mp_rom_map_elem_t ble_module_globals_table[] = {
    	{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys_ble) },
    	{ MP_ROM_QSTR(MP_QSTR_confirm_compare_value), MP_ROM_PTR(&ble_confirm_compare_value_obj) },
    	{ MP_ROM_QSTR(MP_QSTR_get_compare_value), MP_ROM_PTR(&ble_get_compare_value_obj) },
    	{ MP_ROM_QSTR(MP_QSTR_set_bondable), MP_ROM_PTR(&ble_set_bondable_obj) },
    };
    static MP_DEFINE_CONST_DICT(ble_module_globals, ble_module_globals_table);
    
    const mp_obj_module_t ble_module = {
    	.base    = { &mp_type_module },
    	.globals = (mp_obj_dict_t *)&ble_module_globals,
    };
    
    /* Register the module to make it available in Python */
    /* clang-format off */
    MP_REGISTER_MODULE(MP_QSTR_sys_ble, ble_module, MODULE_BLE_ENABLED);