-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pybricks.hubs: Add system instance attribute.
This will group various system functions such as resetting and system data such as bluetooth address: pybricks/support#321 For now, the system attribute will be constant and read-only, so we can use a constant instance to save some code size and RAM.
- Loading branch information
1 parent
1450ee0
commit 547e81e
Showing
17 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2018-2020 The Pybricks Authors | ||
|
||
#include "py/mpconfig.h" | ||
|
||
#if PYBRICKS_PY_COMMON && PYBRICKS_PY_COMMON_SYSTEM | ||
|
||
#include "py/obj.h" | ||
|
||
#include <pybricks/common.h> | ||
|
||
#include <pybricks/util_pb/pb_error.h> | ||
|
||
// pybricks.common.System class object | ||
typedef struct _pb_type_System_obj_t { | ||
mp_obj_base_t base; | ||
} pb_type_System_obj_t; | ||
|
||
// dir(pybricks.common.System) | ||
STATIC const mp_rom_map_elem_t common_System_locals_dict_table[] = { | ||
}; | ||
STATIC MP_DEFINE_CONST_DICT(common_System_locals_dict, common_System_locals_dict_table); | ||
|
||
// type(pybricks.common.System) | ||
STATIC const mp_obj_type_t pb_type_System = { | ||
{ &mp_type_type }, | ||
.name = MP_QSTR_System, | ||
.locals_dict = (mp_obj_dict_t *)&common_System_locals_dict, | ||
}; | ||
|
||
// Preinstantiated constant singleton | ||
const mp_obj_base_t pb_type_System_obj = { | ||
&pb_type_System | ||
}; | ||
|
||
|
||
#endif // PYBRICKS_PY_COMMON && PYBRICKS_PY_COMMON_SYSTEM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters