Mbed port of RMCIOS. www.rmcios.fi https://github.com/fkorhone/
Dependencies: mbed mbed-rtos EthernetInterface
RMCIOS-Mbed.cpp@0:aeaa6d2120a3, 2018-12-27 (annotated)
- Committer:
- ransu
- Date:
- Thu Dec 27 19:21:42 2018 +0000
- Revision:
- 0:aeaa6d2120a3
Initial commit to public.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ransu | 0:aeaa6d2120a3 | 1 | /* |
ransu | 0:aeaa6d2120a3 | 2 | RMCIOS - Reactive Multipurpose Control Input Output System |
ransu | 0:aeaa6d2120a3 | 3 | Copyright (c) 2018 Frans Korhonen |
ransu | 0:aeaa6d2120a3 | 4 | |
ransu | 0:aeaa6d2120a3 | 5 | RMCIOS was originally developed at Institute for Atmospheric |
ransu | 0:aeaa6d2120a3 | 6 | and Earth System Research / Physics, Faculty of Science, |
ransu | 0:aeaa6d2120a3 | 7 | University of Helsinki, Finland |
ransu | 0:aeaa6d2120a3 | 8 | |
ransu | 0:aeaa6d2120a3 | 9 | Assistance, experience and feedback from following persons have been |
ransu | 0:aeaa6d2120a3 | 10 | critical for development of RMCIOS: Erkki Siivola, Juha Kangasluoma, |
ransu | 0:aeaa6d2120a3 | 11 | Lauri Ahonen, Ella Häkkinen, Pasi Aalto, Joonas Enroth, Runlong Cai, |
ransu | 0:aeaa6d2120a3 | 12 | Markku Kulmala and Tuukka Petäjä. |
ransu | 0:aeaa6d2120a3 | 13 | |
ransu | 0:aeaa6d2120a3 | 14 | This file is part of RMCIOS. This notice was encoded using utf-8. |
ransu | 0:aeaa6d2120a3 | 15 | |
ransu | 0:aeaa6d2120a3 | 16 | RMCIOS is free software: you can redistribute it and/or modify |
ransu | 0:aeaa6d2120a3 | 17 | it under the terms of the GNU General Public License as published by |
ransu | 0:aeaa6d2120a3 | 18 | the Free Software Foundation, either version 3 of the License, or |
ransu | 0:aeaa6d2120a3 | 19 | (at your option) any later version. |
ransu | 0:aeaa6d2120a3 | 20 | |
ransu | 0:aeaa6d2120a3 | 21 | RMCIOS is distributed in the hope that it will be useful, |
ransu | 0:aeaa6d2120a3 | 22 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
ransu | 0:aeaa6d2120a3 | 23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ransu | 0:aeaa6d2120a3 | 24 | GNU General Public License for more details. |
ransu | 0:aeaa6d2120a3 | 25 | |
ransu | 0:aeaa6d2120a3 | 26 | You should have received a copy of the GNU General Public Licenses |
ransu | 0:aeaa6d2120a3 | 27 | along with RMCIOS. If not, see <http://www.gnu.org/licenses/>. |
ransu | 0:aeaa6d2120a3 | 28 | */ |
ransu | 0:aeaa6d2120a3 | 29 | |
ransu | 0:aeaa6d2120a3 | 30 | /* |
ransu | 0:aeaa6d2120a3 | 31 | * Changelog: (date,who,description) |
ransu | 0:aeaa6d2120a3 | 32 | */ |
ransu | 0:aeaa6d2120a3 | 33 | #define VERSION_STR "Mbed" |
ransu | 0:aeaa6d2120a3 | 34 | |
ransu | 0:aeaa6d2120a3 | 35 | #include "mbed.h" |
ransu | 0:aeaa6d2120a3 | 36 | #include "RMCIOS-system.h" |
ransu | 0:aeaa6d2120a3 | 37 | #include "std_channels.h" |
ransu | 0:aeaa6d2120a3 | 38 | #include "base_channels.h" |
ransu | 0:aeaa6d2120a3 | 39 | #include "mbed_channels.h" |
ransu | 0:aeaa6d2120a3 | 40 | |
ransu | 0:aeaa6d2120a3 | 41 | #include <stdio.h> |
ransu | 0:aeaa6d2120a3 | 42 | |
ransu | 0:aeaa6d2120a3 | 43 | LocalFileSystem local("local") ; |
ransu | 0:aeaa6d2120a3 | 44 | // data_handle_name,MAX_CLASSES,MAX_CHANNELS |
ransu | 0:aeaa6d2120a3 | 45 | CREATE_STATIC_CHANNEL_SYSTEM_DATA (ch_sys_dat, 80, 180); |
ransu | 0:aeaa6d2120a3 | 46 | |
ransu | 0:aeaa6d2120a3 | 47 | int main (void) |
ransu | 0:aeaa6d2120a3 | 48 | { |
ransu | 0:aeaa6d2120a3 | 49 | printf ("\nRMCIOS - Reactive Multipurpose Control Input Output Systen\r\n[" |
ransu | 0:aeaa6d2120a3 | 50 | "] \r\n"); |
ransu | 0:aeaa6d2120a3 | 51 | printf ("Copyright (c) 2018 Frans Korhonen\n"); |
ransu | 0:aeaa6d2120a3 | 52 | printf ("\nInitializing system:\r\n"); |
ransu | 0:aeaa6d2120a3 | 53 | //////////////////////////////////////////////////////////////////////// |
ransu | 0:aeaa6d2120a3 | 54 | // Init channel system |
ransu | 0:aeaa6d2120a3 | 55 | //////////////////////////////////////////////////////////////////////// |
ransu | 0:aeaa6d2120a3 | 56 | const struct context_rmcios *context; |
ransu | 0:aeaa6d2120a3 | 57 | // init channel api system |
ransu | 0:aeaa6d2120a3 | 58 | set_channel_system_data ((struct ch_system_data *) &ch_sys_dat); |
ransu | 0:aeaa6d2120a3 | 59 | context = get_rmios_context(); |
ransu | 0:aeaa6d2120a3 | 60 | |
ransu | 0:aeaa6d2120a3 | 61 | // Init channel modules: |
ransu | 0:aeaa6d2120a3 | 62 | init_base_channels(context) ; |
ransu | 0:aeaa6d2120a3 | 63 | init_std_channels(context) ; |
ransu | 0:aeaa6d2120a3 | 64 | init_mbed_channels(context) ; |
ransu | 0:aeaa6d2120a3 | 65 | init_mbed_platform_channels(context) ; |
ransu | 0:aeaa6d2120a3 | 66 | |
ransu | 0:aeaa6d2120a3 | 67 | write_str(context, context->control, |
ransu | 0:aeaa6d2120a3 | 68 | "read as control file /local/conf.ini\n", 0); |
ransu | 0:aeaa6d2120a3 | 69 | |
ransu | 0:aeaa6d2120a3 | 70 | /////////////////////////////////////////////////////////////////////// |
ransu | 0:aeaa6d2120a3 | 71 | // initial configuration |
ransu | 0:aeaa6d2120a3 | 72 | /////////////////////////////////////////////////////////////////////// |
ransu | 0:aeaa6d2120a3 | 73 | printf ("\r\nSystem initialized!\r\n"); |
ransu | 0:aeaa6d2120a3 | 74 | |
ransu | 0:aeaa6d2120a3 | 75 | ///////////////////////////////////////////////////////////////////////// |
ransu | 0:aeaa6d2120a3 | 76 | // reception loop |
ransu | 0:aeaa6d2120a3 | 77 | ///////////////////////////////////////////////////////////////////////// |
ransu | 0:aeaa6d2120a3 | 78 | while (1) |
ransu | 0:aeaa6d2120a3 | 79 | { |
ransu | 0:aeaa6d2120a3 | 80 | wait(1) ; |
ransu | 0:aeaa6d2120a3 | 81 | } |
ransu | 0:aeaa6d2120a3 | 82 | } |
ransu | 0:aeaa6d2120a3 | 83 | |
ransu | 0:aeaa6d2120a3 | 84 |