• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pybricks / pybricks-micropython / 19016791193

02 Nov 2025 06:40PM UTC coverage: 57.167% (-2.6%) from 59.744%
19016791193

Pull #406

github

laurensvalk
bricks/virtualhub: Replace with embedded simulation.

Instead of using the newly introduced simhub alongside the virtualhub, we'll just replace the old one entirely now that it has reached feature parity. We can keep calling it the virtualhub.
Pull Request #406: New virtual hub for more effective debugging

41 of 48 new or added lines in 7 files covered. (85.42%)

414 existing lines in 53 files now uncovered.

4479 of 7835 relevant lines covered (57.17%)

17178392.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pybricks/common/pb_type_keypad.c
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) 2018-2023 The Pybricks Authors
3

4
#include "py/mpconfig.h"
5

6
#if PYBRICKS_PY_COMMON && PYBRICKS_PY_COMMON_KEYPAD
7

8
#include <pbio/button.h>
9

10
#include "py/obj.h"
11

12
#include <pybricks/common.h>
13
#include <pybricks/parameters/pb_type_button.h>
14

15
#include <pybricks/util_pb/pb_error.h>
16

17
// pybricks._common.Keypad class object
18
typedef struct _common_Keypad_obj_t {
19
    mp_obj_base_t base;
20
    mp_obj_t parent_obj;
21
    pb_type_button_get_pressed_t get_pressed;
22
} common_Keypad_obj_t;
23

24
// pybricks._common.Keypad.pressed
25
static mp_obj_t common_Keypad_pressed(mp_obj_t self_in) {
×
26
    common_Keypad_obj_t *self = MP_OBJ_TO_PTR(self_in);
×
27
    return self->get_pressed(self->parent_obj);
×
28
}
29
MP_DEFINE_CONST_FUN_OBJ_1(common_Keypad_pressed_obj, common_Keypad_pressed);
30

31
// dir(pybricks.common.Keypad)
32
static const mp_rom_map_elem_t common_Keypad_locals_dict_table[] = {
33
    { MP_ROM_QSTR(MP_QSTR_pressed),     MP_ROM_PTR(&common_Keypad_pressed_obj)     },
34
};
35
static MP_DEFINE_CONST_DICT(common_Keypad_locals_dict, common_Keypad_locals_dict_table);
36

37
// type(pybricks.common.Keypad)
38
static MP_DEFINE_CONST_OBJ_TYPE(pb_type_Keypad,
39
    MP_QSTRnull,
40
    MP_TYPE_FLAG_NONE,
41
    locals_dict, &common_Keypad_locals_dict);
42

43
// pybricks._common.Keypad.__init__
UNCOV
44
mp_obj_t pb_type_Keypad_obj_new(mp_obj_t parent_obj, pb_type_button_get_pressed_t get_pressed) {
×
UNCOV
45
    common_Keypad_obj_t *self = mp_obj_malloc(common_Keypad_obj_t, &pb_type_Keypad);
×
UNCOV
46
    self->get_pressed = get_pressed;
×
UNCOV
47
    self->parent_obj = parent_obj;
×
UNCOV
48
    return MP_OBJ_FROM_PTR(self);
×
49
}
50

51
#endif // PYBRICKS_PY_COMMON && PYBRICKS_PY_COMMON_KEYPAD
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc