|
| 1 | +/* |
| 2 | + * This file is part of the MicroPython project, http://micropython.org/ |
| 3 | + * |
| 4 | + * The MIT License (MIT) |
| 5 | + * |
| 6 | + * Copyright (c) 2015 Damien P. George |
| 7 | + * |
| 8 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | + * of this software and associated documentation files (the "Software"), to deal |
| 10 | + * in the Software without restriction, including without limitation the rights |
| 11 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | + * copies of the Software, and to permit persons to whom the Software is |
| 13 | + * furnished to do so, subject to the following conditions: |
| 14 | + * |
| 15 | + * The above copyright notice and this permission notice shall be included in |
| 16 | + * all copies or substantial portions of the Software. |
| 17 | + * |
| 18 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 | + * THE SOFTWARE. |
| 25 | + */ |
| 26 | + |
| 27 | +#include "py/runtime.h" |
| 28 | + |
| 29 | +STATIC const char *this_text = |
| 30 | +"The Zen of MicroPython, by Nicholas H. Tollervey\n" |
| 31 | +"\n" |
| 32 | +"Code,\n" |
| 33 | +"Hack it,\n" |
| 34 | +"Less is more,\n" |
| 35 | +"Keep it simple,\n" |
| 36 | +"Small is beautiful,\n" |
| 37 | +"\n" |
| 38 | +"Be brave! Break things! Learn and have fun!\n" |
| 39 | +"Express yourself with MicroPython.\n" |
| 40 | +"\n" |
| 41 | +"Happy hacking! :-)\n"; |
| 42 | + |
| 43 | +// If you contribute code to this project, add your name here. |
| 44 | +STATIC const char *authors_text = |
| 45 | +"MicroPython on the micro:bit is brought to you by:\n" |
| 46 | +"Damien P. George, Mark Shannon, Radomir Dopieralski, Matthew Else,\n" |
| 47 | +"Carol Willing, Tom Viner, Alan Jackson, Nick Coghlan, Joseph Haig,\n" |
| 48 | +"Alex Chan, Andrea Grandi, Paul Egan, Piotr Kasprzyk, Andrew Mulholland,\n" |
| 49 | +"Matt Wheeler, Joe Glancy, Abbie Brooks and Nicholas H. Tollervey.\n"; |
| 50 | + |
| 51 | +STATIC mp_obj_t this__init__(void) { |
| 52 | + mp_printf(&mp_plat_print, "%s", this_text); |
| 53 | + return mp_const_none; |
| 54 | +} |
| 55 | +MP_DEFINE_CONST_FUN_OBJ_0(this___init___obj, this__init__); |
| 56 | + |
| 57 | +STATIC mp_obj_t this_authors(void) { |
| 58 | + mp_printf(&mp_plat_print, "%s", authors_text); |
| 59 | + return mp_const_none; |
| 60 | +} |
| 61 | +MP_DEFINE_CONST_FUN_OBJ_0(this_authors_obj, this_authors); |
| 62 | + |
| 63 | +STATIC const mp_rom_map_elem_t this_module_globals_table[] = { |
| 64 | + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_this) }, |
| 65 | + { MP_ROM_QSTR(MP_QSTR___init__), MP_ROM_PTR(&this___init___obj) }, |
| 66 | + { MP_ROM_QSTR(MP_QSTR_authors), MP_ROM_PTR(&this_authors_obj) }, |
| 67 | +}; |
| 68 | +STATIC MP_DEFINE_CONST_DICT(this_module_globals, this_module_globals_table); |
| 69 | + |
| 70 | +const mp_obj_module_t this_module = { |
| 71 | + .base = { &mp_type_module }, |
| 72 | + .globals = (mp_obj_dict_t *)&this_module_globals, |
| 73 | +}; |
0 commit comments