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.
Fork of libMiMic by
Diff: mbed/jsonrpc/Target_LPC176x.cpp
- Revision:
- 77:8651d3c19a55
- Parent:
- 76:b375b3d750d8
- Child:
- 78:8cdb8fc7eda8
--- a/mbed/jsonrpc/Target_LPC176x.cpp Sat Jun 14 17:42:11 2014 +0000
+++ b/mbed/jsonrpc/Target_LPC176x.cpp Fri Jun 20 15:38:30 2014 +0000
@@ -3,7 +3,7 @@
* LPC176xのターゲットテーブルです。
*/
#include "TargetTypes.h"
-#include "MbedJsApi.h"
+#include "RpcHandlerBase.h"
#ifdef TARGET_LPC1768
namespace MiMic
{
@@ -15,7 +15,7 @@
#define NS_LPC_PIN_4 (NS_LPC_PIN_2+32)
#define NS_LPC_PIN_5 (NS_LPC_PIN_2+32)
-const static struct TPinNameMapItem table[]={
+const static struct TPinNameMapItem pin_table[]={
{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},
{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},
{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},
@@ -94,15 +94,51 @@
{NC,PINID_NC}
};
-PinName MbedJsApi::pinId2PinName(unsigned int i_id)
+const static struct TPinModeMapItem pinmode_table[]=
+{
+ {PullUp ,PINMODEID+0},
+ {PullDown ,PINMODEID+1},
+ {PullNone ,PINMODEID+2},
+ {OpenDrain ,PINMODEID+3},
+ {PullDefault,PINMODEID+4}
+};
+const static struct TPortNameMapItem portname_table[]=
{
- for(int i=0;table[i].name!=NC;i++){
- if(i_id==table[i].id){
- return table[i].name;
+ {Port0 ,PORTID+0},
+ {Port1 ,PORTID+1},
+ {Port2 ,PORTID+2},
+ {Port3 ,PORTID+3},
+ {Port4 ,PORTID+4}
+};
+
+PinName RpcHandlerBase::pinId2PinName(unsigned int i_id)
+{
+ for(int i=0;pin_table[i].name!=NC;i++){
+ if(i_id==pin_table[i].id){
+ return pin_table[i].name;
}
}
return NC;
}
+
+PinMode RpcHandlerBase::pinmodeId2PinMode(unsigned int i_id)
+{
+ for(int i=0;pinmode_table[i].mode!=PullDefault;i++){
+ if(i_id==pinmode_table[i].id){
+ return pinmode_table[i].mode;
+ }
+ }
+ return PullDefault;
+}
+PortName RpcHandlerBase::portId2PortName(unsigned int i_id)
+{
+ for(int i=0;portname_table[i].port!=Port4;i++){
+ if(i_id==portname_table[i].id){
+ return portname_table[i].port;
+ }
+ }
+ return Port0;
+}
+
}
#endif
-
