This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

libMiMic(MiMic library for mbed)は、WebService機能を提供するSDKです。 mbedでWebAPIに対応したネットワークデバイスを簡単に作ることが出来ます。

libMiMicはMiMic projectで開発しています。MiMic projectについてはこちらをご覧ください。 http://nyatla.jp/mimic/wp/

構成

libMiMicはmbedRTOS上で動作し、ユーザアプリケーションにAPIを提供します。コアAPIはC言語で記述されていますが、使用頻度の高いものについてはmbed向けのC++APIが準備されています。

/media/uploads/nyatla/libmimic-sdk.png

※libMiMicはmbedの標準イーサネットドライバをしようしていません。

標準イーサネットドライバと同時に使用することはできません。

  • MiMicIP - IPv4スタックです。レテンシとメモリ消費量を抑えたuipベースのライブラリです。
  • ARP/ICMP/UDP/TCP - 基礎的なソケットAPIを提供します。APIは独自です。
  • HTTP/1.1 Server - HTTP/1.1に対応したサーバです。マルチセッション・Chunked・持続性接続に対応しています。
  • HTTP Modules - HTTP/1.1の機能モジュールです。以下のモジュールがあります。
    • ROM file provider - ROMに格納したファイルイメージを公開します。
    • File system provider - mbedファイルシステムを公開します。
    • Onchip configuration - プログラムフラッシュを利用して設定を保存します。
    • MiMicVM processor - RPCリクエスト(MiMicVM)を処理します。
    • FileUpload - ファイルアップロードを受け取ります。
    • URL decoder - HTTPリクエストを解析します。
    • UPnP handler -UPnPメッセージを処理します。
    • WebSocket - Websocketサーバです。
  • mDNS - マルチキャストDNSサービスです。
  • UPnP - UPnP/1.0の機能を提供します。UPnP handlerと協調して動作します。(現在はデバイス探索(SSDP)・デスクリプション(Description)のみ実装してあります。)
  • DHCP/APIPA - ゼロコンフィギュレーション用のモジュールです。
  • HTTP/1.1 Client
  • mbed C++ class library - mbed向けのC++CPIです。C言語のものより簡単です。

対応機種

  • mbed(mbed LPC1768)
  • LPCXpresso1769

プログラム

Import programMiMicRemoteMCU-for-Mbed

MiMic RemoteMCU for mbed. This program provides MCU control API over REST API. It can control MCU from Javascript,PHP or any HTTP rest client directly. And, The application has self development environment.

Import programMbedFileServer

The program publishes files at local directory and SD filesystem. It is a full-fledged webServer somewhat.

サンプル

Import programMiMicSimpleHttpd

This is a simplest HTTP server made ​​of libMiMic. It will echo back a request path.

Import programUPnPBasicDevice

Simplest UPnP basic device example. This program to run UPnP basic device on the mbed.

Import programWebSocketSample

MiMicSDK Websocket module sample program.

Import programHttpClientSamlpe

A http client sample program.

Import programTcpSocketClientSamlpe

MiMicSDK Tcp client socket sample program.

Import programUdpSocketSamlpe

Udp socket sample program. This program will send back the received packet.

チュートリアル

English

libMiMic(MiMic library for mbed) is SDK which provides Webservice functions. It can be created networking device easily using mbed.

See more MiMic information, See MiMic project website. http://nyatla.jp/mimic/wp/

Structure

libMiMic run on mbed RTOS and provides networking API to user application. This library has C++ class API for the mbed, and low-level C language API.

/media/uploads/nyatla/libmimic-sdk.png

For WebService general, it can be written in a simple C + + API.

libMiMic does not have the standard Ethernet driver of mbed. It is not possible that will be used with the standard Ethernet driver.

  • MiMicIP - IPv4 protocol stack. This is based uip which is reduced memory and latency.
  • ARP / ICMP / UDP / TCP - Those are provide basic IP protocols.
  • HTTP/1.1 Server - The Http server compatible HTTP/1.1. It supports multi-session, chunked transport, persistent connection.
  • HTTP Modules - There are addon-module for HTTP server. The following modules.
    • ROM file module - Publish the file images in ROM.
    • File system module - Publish thefiles in mbed file system.
    • Onchip configuration module - To save the network settings to the program flash via REST.
    • MiMicVM module - To handle the (MiMicVM) RPC request.
    • FileUpload module - Accept a file via HTTP POST.
    • URL dedoce module - A versatility URL decoder.
    • UPnP handle module - To handle UPnP messages.
    • UPnP - This provides UPnP/1.0 device functions. It works together with UPnP handler.
    • Websocket - websocket (version13) server
  • mDNS Service - DNS-SD protocol server.
  • UPnP - This provides UPnP/1.0 device functions which works with UPnP handler. (You have been implemented (SSDP) ? description only (Description) device search now.) It is a module zero configuration for - DHCP / APIPA. mbed C + + class library - C of mbed for + + is the CPI. It is simple than that of the C language.
  • DHCP/APIPA - It support zero-cpnfigulation.
  • mbed C++ class library. Almost APIs for Web applications are available.
  • HTTP/1.1 Client

Supported target

  • mbed(mbed LPC1768)
  • LPCXpresso1769

Application

Import programMiMicRemoteMCU-for-Mbed

MiMic RemoteMCU for mbed. This program provides MCU control API over REST API. It can control MCU from Javascript,PHP or any HTTP rest client directly. And, The application has self development environment.

Import programMbedFileServer

The program publishes files at local directory and SD filesystem. It is a full-fledged webServer somewhat.

Sample

Import programMiMicSimpleHttpd

This is a simplest HTTP server made ​​of libMiMic. It will echo back a request path.

Import programUPnPBasicDevice

Simplest UPnP basic device example. This program to run UPnP basic device on the mbed.

Import programWebSocketSample

MiMicSDK Websocket module sample program.

Import programHttpClientSamlpe

A http client sample program.

Import programTcpSocketClientSamlpe

MiMicSDK Tcp client socket sample program.

Import programUdpSocketSamlpe

Udp socket sample program. This program will send back the received packet.

Tutorial

Committer:
nyatla
Date:
Sat Jun 04 06:51:04 2016 +0000
Revision:
114:f6aef16d4e60
Parent:
91:db8279c869d3
include????????; ???????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nyatla 79:baa21f8763cf 1 /**
nyatla 79:baa21f8763cf 2 * @file
nyatla 79:baa21f8763cf 3 * LPC176xのターゲットテーブルです。
nyatla 79:baa21f8763cf 4 */
nyatla 79:baa21f8763cf 5 #include "TargetTypes.h"
nyatla 79:baa21f8763cf 6 #include "RpcHandlerBase.h"
nyatla 79:baa21f8763cf 7 #ifdef TARGET_LPC4088
nyatla 79:baa21f8763cf 8 namespace MiMic
nyatla 79:baa21f8763cf 9 {
nyatla 79:baa21f8763cf 10
nyatla 79:baa21f8763cf 11 #define NS_LPC_PIN_0 PINID_LPC
nyatla 79:baa21f8763cf 12 #define NS_LPC_PIN_1 (NS_LPC_PIN_0+32)
nyatla 79:baa21f8763cf 13 #define NS_LPC_PIN_2 (NS_LPC_PIN_1+32)
nyatla 79:baa21f8763cf 14 #define NS_LPC_PIN_3 (NS_LPC_PIN_2+32)
nyatla 79:baa21f8763cf 15 #define NS_LPC_PIN_4 (NS_LPC_PIN_3+32)
nyatla 79:baa21f8763cf 16 #define NS_LPC_PIN_5 (NS_LPC_PIN_4+32)
nyatla 79:baa21f8763cf 17
nyatla 79:baa21f8763cf 18 const static struct TPinNameMapItem pin_table[]={
nyatla 79:baa21f8763cf 19 {P0_0 ,NS_LPC_PIN_0+0}, {P0_1 ,NS_LPC_PIN_0+1}, {P0_2 ,NS_LPC_PIN_0+2}, {P0_3 ,NS_LPC_PIN_0+3},
nyatla 79:baa21f8763cf 20 {P0_4 ,NS_LPC_PIN_0+4}, {P0_5 ,NS_LPC_PIN_0+5}, {P0_6 ,NS_LPC_PIN_0+6}, {P0_7 ,NS_LPC_PIN_0+7},
nyatla 79:baa21f8763cf 21 {P0_8 ,NS_LPC_PIN_0+8}, {P0_9 ,NS_LPC_PIN_0+9}, {P0_10 ,NS_LPC_PIN_0+10}, {P0_11 ,NS_LPC_PIN_0+11},
nyatla 79:baa21f8763cf 22 {P0_12 ,NS_LPC_PIN_0+12}, {P0_13 ,NS_LPC_PIN_0+13}, {P0_14 ,NS_LPC_PIN_0+14}, {P0_15 ,NS_LPC_PIN_0+15},
nyatla 79:baa21f8763cf 23 {P0_16 ,NS_LPC_PIN_0+16}, {P0_17 ,NS_LPC_PIN_0+17}, {P0_18 ,NS_LPC_PIN_0+18}, {P0_19 ,NS_LPC_PIN_0+19},
nyatla 79:baa21f8763cf 24 {P0_20 ,NS_LPC_PIN_0+20}, {P0_21 ,NS_LPC_PIN_0+21}, {P0_22 ,NS_LPC_PIN_0+22}, {P0_23 ,NS_LPC_PIN_0+23},
nyatla 79:baa21f8763cf 25 {P0_24 ,NS_LPC_PIN_0+24}, {P0_25 ,NS_LPC_PIN_0+25}, {P0_26 ,NS_LPC_PIN_0+26}, {P0_27 ,NS_LPC_PIN_0+27},
nyatla 79:baa21f8763cf 26 {P0_28 ,NS_LPC_PIN_0+28}, {P0_29 ,NS_LPC_PIN_0+29}, {P0_30 ,NS_LPC_PIN_0+30}, {P0_31 ,NS_LPC_PIN_0+31},
nyatla 79:baa21f8763cf 27
nyatla 79:baa21f8763cf 28 {P1_0 ,NS_LPC_PIN_1+0}, {P1_1 ,NS_LPC_PIN_1+1}, {P1_2 ,NS_LPC_PIN_1+2}, {P1_3 ,NS_LPC_PIN_1+3},
nyatla 79:baa21f8763cf 29 {P1_4 ,NS_LPC_PIN_1+4}, {P1_5 ,NS_LPC_PIN_1+5}, {P1_6 ,NS_LPC_PIN_1+6}, {P1_7 ,NS_LPC_PIN_1+7},
nyatla 79:baa21f8763cf 30 {P1_8 ,NS_LPC_PIN_1+8}, {P1_9 ,NS_LPC_PIN_1+9}, {P1_10 ,NS_LPC_PIN_1+10}, {P1_11 ,NS_LPC_PIN_1+11},
nyatla 79:baa21f8763cf 31 {P1_12 ,NS_LPC_PIN_1+12}, {P1_13 ,NS_LPC_PIN_1+13}, {P1_14 ,NS_LPC_PIN_1+14}, {P1_15 ,NS_LPC_PIN_1+15},
nyatla 79:baa21f8763cf 32 {P1_16 ,NS_LPC_PIN_1+16}, {P1_17 ,NS_LPC_PIN_1+17}, {P1_18 ,NS_LPC_PIN_1+18}, {P1_19 ,NS_LPC_PIN_1+19},
nyatla 79:baa21f8763cf 33 {P1_20 ,NS_LPC_PIN_1+20}, {P1_21 ,NS_LPC_PIN_1+21}, {P1_22 ,NS_LPC_PIN_1+22}, {P1_23 ,NS_LPC_PIN_1+23},
nyatla 79:baa21f8763cf 34 {P1_24 ,NS_LPC_PIN_1+24}, {P1_25 ,NS_LPC_PIN_1+25}, {P1_26 ,NS_LPC_PIN_1+26}, {P1_27 ,NS_LPC_PIN_1+27},
nyatla 79:baa21f8763cf 35 {P1_28 ,NS_LPC_PIN_1+28}, {P1_29 ,NS_LPC_PIN_1+29}, {P1_30 ,NS_LPC_PIN_1+30}, {P1_31 ,NS_LPC_PIN_1+31},
nyatla 79:baa21f8763cf 36
nyatla 79:baa21f8763cf 37 {P2_0 ,NS_LPC_PIN_2+0}, {P2_1 ,NS_LPC_PIN_2+1}, {P2_2 ,NS_LPC_PIN_2+2}, {P2_3 ,NS_LPC_PIN_2+3},
nyatla 79:baa21f8763cf 38 {P2_4 ,NS_LPC_PIN_2+4}, {P2_5 ,NS_LPC_PIN_2+5}, {P2_6 ,NS_LPC_PIN_2+6}, {P2_7 ,NS_LPC_PIN_2+7},
nyatla 79:baa21f8763cf 39 {P2_8 ,NS_LPC_PIN_2+8}, {P2_9 ,NS_LPC_PIN_2+9}, {P2_10 ,NS_LPC_PIN_2+10}, {P2_11 ,NS_LPC_PIN_2+11},
nyatla 79:baa21f8763cf 40 {P2_12 ,NS_LPC_PIN_2+12}, {P2_13 ,NS_LPC_PIN_2+13}, {P2_14 ,NS_LPC_PIN_2+14}, {P2_15 ,NS_LPC_PIN_2+15},
nyatla 79:baa21f8763cf 41 {P2_16 ,NS_LPC_PIN_2+16}, {P2_17 ,NS_LPC_PIN_2+17}, {P2_18 ,NS_LPC_PIN_2+18}, {P2_19 ,NS_LPC_PIN_2+19},
nyatla 79:baa21f8763cf 42 {P2_20 ,NS_LPC_PIN_2+20}, {P2_21 ,NS_LPC_PIN_2+21}, {P2_22 ,NS_LPC_PIN_2+22}, {P2_23 ,NS_LPC_PIN_2+23},
nyatla 79:baa21f8763cf 43 {P2_24 ,NS_LPC_PIN_2+24}, {P2_25 ,NS_LPC_PIN_2+25}, {P2_26 ,NS_LPC_PIN_2+26}, {P2_27 ,NS_LPC_PIN_2+27},
nyatla 79:baa21f8763cf 44 {P2_28 ,NS_LPC_PIN_2+28}, {P2_29 ,NS_LPC_PIN_2+29}, {P2_30 ,NS_LPC_PIN_2+30}, {P2_31 ,NS_LPC_PIN_2+31},
nyatla 79:baa21f8763cf 45
nyatla 79:baa21f8763cf 46 {P3_0 ,NS_LPC_PIN_2+0}, {P3_1 ,NS_LPC_PIN_2+1}, {P3_2 ,NS_LPC_PIN_2+2}, {P3_3 ,NS_LPC_PIN_2+3},
nyatla 79:baa21f8763cf 47 {P3_4 ,NS_LPC_PIN_2+4}, {P3_5 ,NS_LPC_PIN_2+5}, {P3_6 ,NS_LPC_PIN_2+6}, {P3_7 ,NS_LPC_PIN_2+7},
nyatla 79:baa21f8763cf 48 {P3_8 ,NS_LPC_PIN_2+8}, {P3_9 ,NS_LPC_PIN_2+9}, {P3_10 ,NS_LPC_PIN_2+10}, {P3_11 ,NS_LPC_PIN_2+11},
nyatla 79:baa21f8763cf 49 {P3_12 ,NS_LPC_PIN_2+12}, {P3_13 ,NS_LPC_PIN_2+13}, {P3_14 ,NS_LPC_PIN_2+14}, {P3_15 ,NS_LPC_PIN_2+15},
nyatla 79:baa21f8763cf 50 {P3_16 ,NS_LPC_PIN_2+16}, {P3_17 ,NS_LPC_PIN_2+17}, {P3_18 ,NS_LPC_PIN_2+18}, {P3_19 ,NS_LPC_PIN_2+19},
nyatla 79:baa21f8763cf 51 {P3_20 ,NS_LPC_PIN_2+20}, {P3_21 ,NS_LPC_PIN_2+21}, {P3_22 ,NS_LPC_PIN_2+22}, {P3_23 ,NS_LPC_PIN_2+23},
nyatla 79:baa21f8763cf 52 {P3_24 ,NS_LPC_PIN_2+24}, {P3_25 ,NS_LPC_PIN_2+25}, {P3_26 ,NS_LPC_PIN_2+26}, {P3_27 ,NS_LPC_PIN_2+27},
nyatla 79:baa21f8763cf 53 {P3_28 ,NS_LPC_PIN_2+28}, {P3_29 ,NS_LPC_PIN_2+29}, {P3_30 ,NS_LPC_PIN_2+30}, {P3_31 ,NS_LPC_PIN_2+31},
nyatla 79:baa21f8763cf 54
nyatla 79:baa21f8763cf 55 {P4_0 ,NS_LPC_PIN_4+0}, {P4_1 ,NS_LPC_PIN_4+1}, {P4_2 ,NS_LPC_PIN_4+2}, {P4_3 ,NS_LPC_PIN_4+3},
nyatla 79:baa21f8763cf 56 {P4_4 ,NS_LPC_PIN_4+4}, {P4_5 ,NS_LPC_PIN_4+5}, {P4_6 ,NS_LPC_PIN_4+6}, {P4_7 ,NS_LPC_PIN_4+7},
nyatla 79:baa21f8763cf 57 {P4_8 ,NS_LPC_PIN_4+8}, {P4_9 ,NS_LPC_PIN_4+9}, {P4_10 ,NS_LPC_PIN_4+10}, {P4_11 ,NS_LPC_PIN_4+11},
nyatla 79:baa21f8763cf 58 {P4_12 ,NS_LPC_PIN_4+12}, {P4_13 ,NS_LPC_PIN_4+13}, {P4_14 ,NS_LPC_PIN_4+14}, {P4_15 ,NS_LPC_PIN_4+15},
nyatla 79:baa21f8763cf 59 {P4_16 ,NS_LPC_PIN_4+16}, {P4_17 ,NS_LPC_PIN_4+17}, {P4_18 ,NS_LPC_PIN_4+18}, {P4_19 ,NS_LPC_PIN_4+19},
nyatla 79:baa21f8763cf 60 {P4_20 ,NS_LPC_PIN_4+20}, {P4_21 ,NS_LPC_PIN_4+21}, {P4_22 ,NS_LPC_PIN_4+22}, {P4_23 ,NS_LPC_PIN_4+23},
nyatla 79:baa21f8763cf 61 {P4_24 ,NS_LPC_PIN_4+24}, {P4_25 ,NS_LPC_PIN_4+25}, {P4_26 ,NS_LPC_PIN_4+26}, {P4_27 ,NS_LPC_PIN_4+27},
nyatla 79:baa21f8763cf 62 {P4_28 ,NS_LPC_PIN_4+28}, {P4_29 ,NS_LPC_PIN_4+29}, {P4_30 ,NS_LPC_PIN_4+30}, {P4_31 ,NS_LPC_PIN_4+31},
nyatla 79:baa21f8763cf 63
nyatla 79:baa21f8763cf 64 {P5_0 ,NS_LPC_PIN_5+0}, {P5_1 ,NS_LPC_PIN_5+1}, {P5_2 ,NS_LPC_PIN_5+2}, {P5_3 ,NS_LPC_PIN_5+3},
nyatla 79:baa21f8763cf 65 {P5_4 ,NS_LPC_PIN_5+4},
nyatla 79:baa21f8763cf 66
nyatla 79:baa21f8763cf 67 // mbed DIP Pin Names
nyatla 79:baa21f8763cf 68 {P1_24,PINID_MBED_DIP+5}, {P1_23,PINID_MBED_DIP+6}, {P1_20,PINID_MBED_DIP+7}, {P0_21,PINID_MBED_DIP+8},
nyatla 79:baa21f8763cf 69 {P0_0,PINID_MBED_DIP+9}, {P0_1,PINID_MBED_DIP+10}, {P0_9,PINID_MBED_DIP+11}, {P0_8,PINID_MBED_DIP+12},
nyatla 79:baa21f8763cf 70 {P0_7,PINID_MBED_DIP+13}, {P0_6,PINID_MBED_DIP+14}, {P0_23,PINID_MBED_DIP+15}, {P0_24,PINID_MBED_DIP+16},
nyatla 79:baa21f8763cf 71 {P0_25,PINID_MBED_DIP+17}, {P0_26,PINID_MBED_DIP+18}, {P1_30,PINID_MBED_DIP+19}, {P1_31,PINID_MBED_DIP+20},
nyatla 79:baa21f8763cf 72
nyatla 79:baa21f8763cf 73 {P2_10,PINID_MBED_DIP+23}, {P1_12,PINID_MBED_DIP+24}, {P1_11,PINID_MBED_DIP+25}, {P1_7,PINID_MBED_DIP+26},
nyatla 79:baa21f8763cf 74 {P1_6,PINID_MBED_DIP+27}, {P1_5,PINID_MBED_DIP+28}, {P1_3,PINID_MBED_DIP+29}, {P1_2,PINID_MBED_DIP+30},
nyatla 79:baa21f8763cf 75 {P5_3,PINID_MBED_DIP+31}, {P5_2,PINID_MBED_DIP+32}, {P0_5,PINID_MBED_DIP+33}, {P0_4,PINID_MBED_DIP+34},
nyatla 79:baa21f8763cf 76 {P5_4,PINID_MBED_DIP+37}, {P5_1,PINID_MBED_DIP+38}, {P5_0,PINID_MBED_DIP+39},
nyatla 79:baa21f8763cf 77
nyatla 79:baa21f8763cf 78
nyatla 79:baa21f8763cf 79 // Other mbed Pin Names
nyatla 79:baa21f8763cf 80
nyatla 79:baa21f8763cf 81 {P1_18 ,PINID_OTHER_MBED_LEDx+0}, {P0_13 ,PINID_OTHER_MBED_LEDx+1}, {P1_13 ,PINID_OTHER_MBED_LEDx+2}, {P2_19 ,PINID_OTHER_MBED_LEDx+3},
nyatla 79:baa21f8763cf 82
nyatla 79:baa21f8763cf 83 {P0_2,PINID_OTHER_MBED_USBx+0},{P0_3,PINID_OTHER_MBED_USBx+1},
nyatla 79:baa21f8763cf 84
nyatla 79:baa21f8763cf 85 // Arch Pro Pin Names
nyatla 79:baa21f8763cf 86 {p10,PINID_ARCH_PRO_Dx+0}, {p9,PINID_ARCH_PRO_Dx+1}, {p31,PINID_ARCH_PRO_Dx+2}, {p32,PINID_ARCH_PRO_Dx+3},
nyatla 79:baa21f8763cf 87 {p33,PINID_ARCH_PRO_Dx+4}, {p37,PINID_ARCH_PRO_Dx+5}, {p38,PINID_ARCH_PRO_Dx+6}, {p34,PINID_ARCH_PRO_Dx+7},
nyatla 79:baa21f8763cf 88 {p8,PINID_ARCH_PRO_Dx+8}, {p39,PINID_ARCH_PRO_Dx+9}, {p14,PINID_ARCH_PRO_Dx+10}, {p11,PINID_ARCH_PRO_Dx+11},
nyatla 79:baa21f8763cf 89 {p12,PINID_ARCH_PRO_Dx+12}, {p13,PINID_ARCH_PRO_Dx+13}, {p19,PINID_ARCH_PRO_Dx+14}, {p20,PINID_ARCH_PRO_Dx+15},
nyatla 79:baa21f8763cf 90
nyatla 79:baa21f8763cf 91 {p15,PINID_ARCH_PRO_Ax+0}, {p16,PINID_ARCH_PRO_Ax+1}, {p17,PINID_ARCH_PRO_Ax+2}, {p18,PINID_ARCH_PRO_Ax+3},
nyatla 79:baa21f8763cf 92 {p19,PINID_ARCH_PRO_Ax+4}, {p20,PINID_ARCH_PRO_Ax+5},
nyatla 79:baa21f8763cf 93
nyatla 79:baa21f8763cf 94 {NC,PINID_NC}
nyatla 79:baa21f8763cf 95 };
nyatla 79:baa21f8763cf 96
nyatla 79:baa21f8763cf 97 #define NUMBER_OF_PINMODE 5
nyatla 79:baa21f8763cf 98 const static struct TPinModeMapItem pinmode_table[]=
nyatla 79:baa21f8763cf 99 {
nyatla 79:baa21f8763cf 100 {PullUp ,PINMODEID+0},
nyatla 79:baa21f8763cf 101 {PullDown ,PINMODEID+1},
nyatla 79:baa21f8763cf 102 {PullNone ,PINMODEID+2},
nyatla 79:baa21f8763cf 103 {OpenDrain ,PINMODEID+3},
nyatla 79:baa21f8763cf 104 {PullDefault,PINMODEID+1}
nyatla 79:baa21f8763cf 105 };
nyatla 79:baa21f8763cf 106 #define NUMBER_OF_PORT_NAME 6
nyatla 79:baa21f8763cf 107 const static struct TPortNameMapItem portname_table[]=
nyatla 79:baa21f8763cf 108 {
nyatla 79:baa21f8763cf 109 {Port0 ,PORTID+0},
nyatla 79:baa21f8763cf 110 {Port1 ,PORTID+1},
nyatla 79:baa21f8763cf 111 {Port2 ,PORTID+2},
nyatla 79:baa21f8763cf 112 {Port3 ,PORTID+3},
nyatla 79:baa21f8763cf 113 {Port4 ,PORTID+4},
nyatla 79:baa21f8763cf 114 {Port5 ,PORTID+5},
nyatla 79:baa21f8763cf 115 };
nyatla 79:baa21f8763cf 116
nyatla 79:baa21f8763cf 117 PinName RpcHandlerBase::pinId2PinName(unsigned int i_id)
nyatla 79:baa21f8763cf 118 {
nyatla 79:baa21f8763cf 119 for(int i=0;pin_table[i].name!=NC;i++){
nyatla 79:baa21f8763cf 120 if(i_id==pin_table[i].id){
nyatla 79:baa21f8763cf 121 return pin_table[i].name;
nyatla 79:baa21f8763cf 122 }
nyatla 79:baa21f8763cf 123 }
nyatla 79:baa21f8763cf 124 return NC;
nyatla 79:baa21f8763cf 125 }
nyatla 79:baa21f8763cf 126
nyatla 79:baa21f8763cf 127 PinMode RpcHandlerBase::pinmodeId2PinMode(unsigned int i_id)
nyatla 79:baa21f8763cf 128 {
nyatla 79:baa21f8763cf 129 for(int i=0;i<NUMBER_OF_PINMODE;i++){
nyatla 79:baa21f8763cf 130 if(i_id==pinmode_table[i].id){
nyatla 79:baa21f8763cf 131 return pinmode_table[i].mode;
nyatla 79:baa21f8763cf 132 }
nyatla 79:baa21f8763cf 133 }
nyatla 79:baa21f8763cf 134 return PullDefault;
nyatla 79:baa21f8763cf 135 }
nyatla 79:baa21f8763cf 136 PortName RpcHandlerBase::portId2PortName(unsigned int i_id)
nyatla 79:baa21f8763cf 137 {
nyatla 79:baa21f8763cf 138 for(int i=0;i<NUMBER_OF_PORT_NAME;i++){
nyatla 79:baa21f8763cf 139 if(i_id==portname_table[i].id){
nyatla 79:baa21f8763cf 140 return portname_table[i].port;
nyatla 79:baa21f8763cf 141 }
nyatla 79:baa21f8763cf 142 }
nyatla 79:baa21f8763cf 143 return Port0;
nyatla 79:baa21f8763cf 144 }
nyatla 79:baa21f8763cf 145
nyatla 79:baa21f8763cf 146 }
nyatla 79:baa21f8763cf 147 #endif
nyatla 79:baa21f8763cf 148