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:
78:8cdb8fc7eda8
include????????; ???????????

Who changed what in which revision?

UserRevisionLine numberNew contents of line
nyatla 76:b375b3d750d8 1 /**
nyatla 76:b375b3d750d8 2 * @file
nyatla 76:b375b3d750d8 3 * LPC176xのターゲットテーブルです。
nyatla 76:b375b3d750d8 4 */
nyatla 76:b375b3d750d8 5 #include "TargetTypes.h"
nyatla 77:8651d3c19a55 6 #include "RpcHandlerBase.h"
nyatla 76:b375b3d750d8 7 #ifdef TARGET_LPC1768
nyatla 76:b375b3d750d8 8 namespace MiMic
nyatla 76:b375b3d750d8 9 {
nyatla 76:b375b3d750d8 10
nyatla 76:b375b3d750d8 11 #define NS_LPC_PIN_0 PINID_LPC
nyatla 76:b375b3d750d8 12 #define NS_LPC_PIN_1 (NS_LPC_PIN_0+32)
nyatla 76:b375b3d750d8 13 #define NS_LPC_PIN_2 (NS_LPC_PIN_1+32)
nyatla 76:b375b3d750d8 14 #define NS_LPC_PIN_3 (NS_LPC_PIN_2+32)
nyatla 78:8cdb8fc7eda8 15 #define NS_LPC_PIN_4 (NS_LPC_PIN_3+32)
nyatla 78:8cdb8fc7eda8 16 #define NS_LPC_PIN_5 (NS_LPC_PIN_4+32)
nyatla 76:b375b3d750d8 17
nyatla 77:8651d3c19a55 18 const static struct TPinNameMapItem pin_table[]={
nyatla 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 27
nyatla 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 36
nyatla 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 45
nyatla 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 54
nyatla 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 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 76:b375b3d750d8 63
nyatla 76:b375b3d750d8 64 // mbed DIP Pin Names
nyatla 76:b375b3d750d8 65
nyatla 76:b375b3d750d8 66 {P0_9 ,PINID_MBED_DIP+5}, {P0_8 ,PINID_MBED_DIP+6}, {P0_7 ,PINID_MBED_DIP+7}, {P0_6 ,PINID_MBED_DIP+8},
nyatla 76:b375b3d750d8 67 {P0_0 ,PINID_MBED_DIP+9}, {P0_1 ,PINID_MBED_DIP+10},{P0_18 ,PINID_MBED_DIP+11},{P0_17 ,PINID_MBED_DIP+12},
nyatla 76:b375b3d750d8 68 {P0_15 ,PINID_MBED_DIP+13},{P0_16 ,PINID_MBED_DIP+14},{P0_23 ,PINID_MBED_DIP+15},{P0_24 ,PINID_MBED_DIP+16},
nyatla 76:b375b3d750d8 69 {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 76:b375b3d750d8 70 {P2_5, PINID_MBED_DIP+21}, {P2_4, PINID_MBED_DIP+22}, {P2_3, PINID_MBED_DIP+23}, {P2_2, PINID_MBED_DIP+24},
nyatla 76:b375b3d750d8 71 {P2_1, PINID_MBED_DIP+25}, {P2_0, PINID_MBED_DIP+26}, {P0_11, PINID_MBED_DIP+27}, {P0_10, PINID_MBED_DIP+28},
nyatla 76:b375b3d750d8 72 {P0_5, PINID_MBED_DIP+29}, {P0_4, PINID_MBED_DIP+30},
nyatla 76:b375b3d750d8 73
nyatla 76:b375b3d750d8 74 // Other mbed Pin Names
nyatla 76:b375b3d750d8 75
nyatla 76:b375b3d750d8 76 #ifdef MCB1700
nyatla 76:b375b3d750d8 77 {P1_28 ,PINID_OTHER_MBED_LEDx+0}, {P1_29 ,PINID_OTHER_MBED_LEDx+1}, {P1_31 ,PINID_OTHER_MBED_LEDx+2}, {P2_2 ,PINID_OTHER_MBED_LEDx+3},
nyatla 76:b375b3d750d8 78 #else
nyatla 76:b375b3d750d8 79 {P1_18 ,PINID_OTHER_MBED_LEDx+0}, {P1_20 ,PINID_OTHER_MBED_LEDx+1}, {P1_21 ,PINID_OTHER_MBED_LEDx+2}, {P1_23 ,PINID_OTHER_MBED_LEDx+3},
nyatla 76:b375b3d750d8 80 #endif
nyatla 76:b375b3d750d8 81 {P0_2,PINID_OTHER_MBED_USBx+0},{P0_3,PINID_OTHER_MBED_USBx+1},
nyatla 76:b375b3d750d8 82
nyatla 76:b375b3d750d8 83 // Arch Pro Pin Names
nyatla 76:b375b3d750d8 84
nyatla 76:b375b3d750d8 85 {P4_29 ,PINID_ARCH_PRO_Dx+0}, {P4_28 ,PINID_ARCH_PRO_Dx+1}, {P0_4 ,PINID_ARCH_PRO_Dx+2}, {P0_5 ,PINID_ARCH_PRO_Dx+3},
nyatla 76:b375b3d750d8 86 {P2_2 ,PINID_ARCH_PRO_Dx+4}, {P2_3 ,PINID_ARCH_PRO_Dx+5}, {P2_4 ,PINID_ARCH_PRO_Dx+6}, {P2_5 ,PINID_ARCH_PRO_Dx+7},
nyatla 76:b375b3d750d8 87 {P0_0 ,PINID_ARCH_PRO_Dx+8}, {P0_1 ,PINID_ARCH_PRO_Dx+9}, {P0_6 ,PINID_ARCH_PRO_Dx+10},{P0_9 ,PINID_ARCH_PRO_Dx+11},
nyatla 76:b375b3d750d8 88 {P0_8 ,PINID_ARCH_PRO_Dx+12},{P0_7 ,PINID_ARCH_PRO_Dx+13},{P0_27 ,PINID_ARCH_PRO_Dx+14},{P0_28 ,PINID_ARCH_PRO_Dx+15},
nyatla 76:b375b3d750d8 89
nyatla 76:b375b3d750d8 90 {P0_23,PINID_ARCH_PRO_Ax+0},{P0_24,PINID_ARCH_PRO_Ax+1},{P0_25,PINID_ARCH_PRO_Ax+2},{P0_26,PINID_ARCH_PRO_Ax+3},
nyatla 76:b375b3d750d8 91 {P1_30,PINID_ARCH_PRO_Ax+4},{P1_31,PINID_ARCH_PRO_Ax+5},
nyatla 76:b375b3d750d8 92
nyatla 76:b375b3d750d8 93 {D15,PINID_ARCH_PRO_I2C_x+0},{D14,PINID_ARCH_PRO_I2C_x+1},
nyatla 76:b375b3d750d8 94 {NC,PINID_NC}
nyatla 76:b375b3d750d8 95 };
nyatla 76:b375b3d750d8 96
nyatla 78:8cdb8fc7eda8 97 #define NUMBER_OF_PINMODE 5
nyatla 77:8651d3c19a55 98 const static struct TPinModeMapItem pinmode_table[]=
nyatla 77:8651d3c19a55 99 {
nyatla 77:8651d3c19a55 100 {PullUp ,PINMODEID+0},
nyatla 77:8651d3c19a55 101 {PullDown ,PINMODEID+1},
nyatla 77:8651d3c19a55 102 {PullNone ,PINMODEID+2},
nyatla 77:8651d3c19a55 103 {OpenDrain ,PINMODEID+3},
nyatla 77:8651d3c19a55 104 {PullDefault,PINMODEID+4}
nyatla 77:8651d3c19a55 105 };
nyatla 78:8cdb8fc7eda8 106 #define NUMBER_OF_PORT_NAME 5
nyatla 77:8651d3c19a55 107 const static struct TPortNameMapItem portname_table[]=
nyatla 76:b375b3d750d8 108 {
nyatla 77:8651d3c19a55 109 {Port0 ,PORTID+0},
nyatla 77:8651d3c19a55 110 {Port1 ,PORTID+1},
nyatla 77:8651d3c19a55 111 {Port2 ,PORTID+2},
nyatla 77:8651d3c19a55 112 {Port3 ,PORTID+3},
nyatla 77:8651d3c19a55 113 {Port4 ,PORTID+4}
nyatla 77:8651d3c19a55 114 };
nyatla 77:8651d3c19a55 115
nyatla 77:8651d3c19a55 116 PinName RpcHandlerBase::pinId2PinName(unsigned int i_id)
nyatla 77:8651d3c19a55 117 {
nyatla 77:8651d3c19a55 118 for(int i=0;pin_table[i].name!=NC;i++){
nyatla 77:8651d3c19a55 119 if(i_id==pin_table[i].id){
nyatla 77:8651d3c19a55 120 return pin_table[i].name;
nyatla 76:b375b3d750d8 121 }
nyatla 76:b375b3d750d8 122 }
nyatla 76:b375b3d750d8 123 return NC;
nyatla 76:b375b3d750d8 124 }
nyatla 77:8651d3c19a55 125
nyatla 77:8651d3c19a55 126 PinMode RpcHandlerBase::pinmodeId2PinMode(unsigned int i_id)
nyatla 77:8651d3c19a55 127 {
nyatla 78:8cdb8fc7eda8 128 for(int i=0;i<NUMBER_OF_PINMODE;i++){
nyatla 77:8651d3c19a55 129 if(i_id==pinmode_table[i].id){
nyatla 77:8651d3c19a55 130 return pinmode_table[i].mode;
nyatla 77:8651d3c19a55 131 }
nyatla 77:8651d3c19a55 132 }
nyatla 77:8651d3c19a55 133 return PullDefault;
nyatla 77:8651d3c19a55 134 }
nyatla 77:8651d3c19a55 135 PortName RpcHandlerBase::portId2PortName(unsigned int i_id)
nyatla 77:8651d3c19a55 136 {
nyatla 78:8cdb8fc7eda8 137 for(int i=0;i<NUMBER_OF_PORT_NAME;i++){
nyatla 77:8651d3c19a55 138 if(i_id==portname_table[i].id){
nyatla 77:8651d3c19a55 139 return portname_table[i].port;
nyatla 77:8651d3c19a55 140 }
nyatla 77:8651d3c19a55 141 }
nyatla 77:8651d3c19a55 142 return Port0;
nyatla 77:8651d3c19a55 143 }
nyatla 77:8651d3c19a55 144
nyatla 76:b375b3d750d8 145 }
nyatla 76:b375b3d750d8 146 #endif