Skip to content
Snippets Groups Projects
Select Git revision
  • dba57955f9787562cbb58a20f35e2a8c9718a970
  • master default
  • test
  • rahix/hw-lock-new-mutex
  • dx/somewhat-more-dynamic-config
  • schneider/sdk-0.2.1-7
  • schneider/bsec
  • dx/meh-bdf-to-stm
  • dx/flatten-config-module
  • genofire/ble-follow-py
  • schneider/ble-stability
  • schneider/ble-stability-new-phy
  • add_menu_vibration
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • schneider/fundamental-test
  • schneider/ble-buffers
  • 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
  • bootloader-v1
  • v0.0
37 results

bootstrap.sh

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    modbtree.c 12.41 KiB
    /*
     * This file is part of the MicroPython project, http://micropython.org/
     *
     * The MIT License (MIT)
     *
     * Copyright (c) 2016 Paul Sokolovsky
     *
     * Permission is hereby granted, free of charge, to any person obtaining a copy
     * of this software and associated documentation files (the "Software"), to deal
     * in the Software without restriction, including without limitation the rights
     * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     * copies of the Software, and to permit persons to whom the Software is
     * furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included in
     * all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     * THE SOFTWARE.
     */
    
    #include <stdio.h>
    #include <string.h>
    #include <errno.h>
    #include <fcntl.h>
    
    #include "py/nlr.h"
    #include "py/runtime.h"
    #include "py/runtime0.h"
    #include "py/stream.h"
    
    #if MICROPY_PY_BTREE
    
    #include <db.h>
    #include <../../btree/btree.h>
    
    typedef struct _mp_obj_btree_t {
        mp_obj_base_t base;
        DB *db;
        mp_obj_t start_key;
        mp_obj_t end_key;
        #define FLAG_END_KEY_INCL 1
        #define FLAG_DESC 2
        #define FLAG_ITER_TYPE_MASK 0xc0
        #define FLAG_ITER_KEYS   0x40
        #define FLAG_ITER_VALUES 0x80
        #define FLAG_ITER_ITEMS  0xc0
        byte flags;
        byte next_flags;
    } mp_obj_btree_t;
    
    STATIC const mp_obj_type_t btree_type;
    
    #define CHECK_ERROR(res) \
            if (res == RET_ERROR) { \
                nlr_raise(mp_obj_new_exception_arg1(&mp_type_OSError, MP_OBJ_NEW_SMALL_INT(errno))); \
            }
    
    void __dbpanic(DB *db) {
        printf("__dbpanic(%p)\n", db);
    }
    
    STATIC mp_obj_btree_t *btree_new(DB *db) {
        mp_obj_btree_t *o = m_new_obj(mp_obj_btree_t);
        o->base.type = &btree_type;