Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
modpins.cpp@5:1d19b8110e11, 2016-04-24 (annotated)
- Committer:
- Colin Hogben
- Date:
- Sun Apr 24 21:57:21 2016 +0100
- Revision:
- 5:1d19b8110e11
Add pins module
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Colin Hogben |
5:1d19b8110e11 | 1 | /* |
| Colin Hogben |
5:1d19b8110e11 | 2 | * The MIT License (MIT) |
| Colin Hogben |
5:1d19b8110e11 | 3 | * |
| Colin Hogben |
5:1d19b8110e11 | 4 | * Copyright (c) 2016 Colin Hogben |
| Colin Hogben |
5:1d19b8110e11 | 5 | * |
| Colin Hogben |
5:1d19b8110e11 | 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| Colin Hogben |
5:1d19b8110e11 | 7 | * of this software and associated documentation files (the "Software"), to deal |
| Colin Hogben |
5:1d19b8110e11 | 8 | * in the Software without restriction, including without limitation the rights |
| Colin Hogben |
5:1d19b8110e11 | 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| Colin Hogben |
5:1d19b8110e11 | 10 | * copies of the Software, and to permit persons to whom the Software is |
| Colin Hogben |
5:1d19b8110e11 | 11 | * furnished to do so, subject to the following conditions: |
| Colin Hogben |
5:1d19b8110e11 | 12 | * |
| Colin Hogben |
5:1d19b8110e11 | 13 | * The above copyright notice and this permission notice shall be included in |
| Colin Hogben |
5:1d19b8110e11 | 14 | * all copies or substantial portions of the Software. |
| Colin Hogben |
5:1d19b8110e11 | 15 | * |
| Colin Hogben |
5:1d19b8110e11 | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| Colin Hogben |
5:1d19b8110e11 | 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| Colin Hogben |
5:1d19b8110e11 | 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| Colin Hogben |
5:1d19b8110e11 | 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| Colin Hogben |
5:1d19b8110e11 | 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| Colin Hogben |
5:1d19b8110e11 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| Colin Hogben |
5:1d19b8110e11 | 22 | * THE SOFTWARE. |
| Colin Hogben |
5:1d19b8110e11 | 23 | */ |
| Colin Hogben |
5:1d19b8110e11 | 24 | extern "C" { |
| Colin Hogben |
5:1d19b8110e11 | 25 | #include "py/mpconfig.h" |
| Colin Hogben |
5:1d19b8110e11 | 26 | #include "py/runtime.h" |
| Colin Hogben |
5:1d19b8110e11 | 27 | } |
| Colin Hogben |
5:1d19b8110e11 | 28 | |
| Colin Hogben |
5:1d19b8110e11 | 29 | #if MICROPY_PY_PINS |
| Colin Hogben |
5:1d19b8110e11 | 30 | |
| Colin Hogben |
5:1d19b8110e11 | 31 | #include "mbed.h" |
| Colin Hogben |
5:1d19b8110e11 | 32 | |
| Colin Hogben |
5:1d19b8110e11 | 33 | STATIC const mp_rom_map_elem_t mp_pins_module_globals_table[] = { |
| Colin Hogben |
5:1d19b8110e11 | 34 | { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_pins) }, |
| Colin Hogben |
5:1d19b8110e11 | 35 | #include "mbedpins.h" |
| Colin Hogben |
5:1d19b8110e11 | 36 | }; |
| Colin Hogben |
5:1d19b8110e11 | 37 | |
| Colin Hogben |
5:1d19b8110e11 | 38 | STATIC MP_DEFINE_CONST_DICT(mp_pins_module_globals, |
| Colin Hogben |
5:1d19b8110e11 | 39 | mp_pins_module_globals_table); |
| Colin Hogben |
5:1d19b8110e11 | 40 | |
| Colin Hogben |
5:1d19b8110e11 | 41 | const mp_obj_module_t mp_module_pins = { |
| Colin Hogben |
5:1d19b8110e11 | 42 | .base = { &mp_type_module }, |
| Colin Hogben |
5:1d19b8110e11 | 43 | .name = MP_QSTR_pins, |
| Colin Hogben |
5:1d19b8110e11 | 44 | .globals = (mp_obj_dict_t *)&mp_pins_module_globals, |
| Colin Hogben |
5:1d19b8110e11 | 45 | }; |
| Colin Hogben |
5:1d19b8110e11 | 46 | |
| Colin Hogben |
5:1d19b8110e11 | 47 | #endif // MICROPY_PY_PINS |