Initialize.cpp
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[Real2Virtual202111]]
#code(c){{
#include "Initialize.h"
#include "mbed.h"
/* */
DigitalInOut pe0(p27);
DigitalInOut pe1(p28);
DigitalInOut pe2(p30); //2024 5/17 swap with p29
DigitalInOut pe3(p29); // 2024 5/17 swap with p30
DigitalInOut pe4(p26);
DigitalInOut pe5(p25);
DigitalInOut pe6(p24);
DigitalInOut pe7(p23);
DigitalInOut pe8(p22);
DigitalInOut pe9(p21);
DigitalInOut pea(p19); //2024 5/16 p20->p19
DigitalInOut peb(p18); //2024 5/16 p19->p18
DigitalInOut pec(p17); // 2024 5/16 p18->p17
DigitalInOut ped(p16); // 2024 5/16 p17->p16
DigitalInOut pee(p14); // 2024 5/16 p16->p14
DigitalInOut pef(p13); // 2024 5/16 p15->p13
/* */
/*
DigitalInOut pe0(P1_30); //pe0(p27);
DigitalInOut pe1(P1_29); //pe1(p28);
DigitalInOut pe2(P0_0); //pe2(p29);
DigitalInOut pe3(P0_1); //pe3(p30);
DigitalInOut pe4(P1_31); //pe4(p26);
DigitalInOut pe5(P0_28); //pe5(p25);
DigitalInOut pe6(P0_22); //pe6(p24);
DigitalInOut pe7(P0_19); //pe7(p23);
DigitalInOut pe8(P0_18); //pe8(p22);
DigitalInOut pe9(P0_17); //pe9(p21);
DigitalInOut pea(P0_10); //pea(p20);
DigitalInOut peb(P1_0); //peb(p19);
DigitalInOut pec(P0_31); //pec(p18);
DigitalInOut ped(P0_23); //ped(p17);
DigitalInOut pee(P0_16); //pee(p16);
//DigitalInOut pef(P0_15); //pef(p15);
DigitalIn pef(P0_15);
*/
/* */
#define PXMAX 16
#define PBMAX 6
unsigned char (*getPEX[PXMAX])(void);
unsigned char (*getPMEX[PXMAX])(void);
void (*setPEX[PXMAX])(unsigned char);
void (*setPMEX[PXMAX])(unsigned char);
unsigned char (*getPBX[PBMAX])(void);
unsigned char (*getPMBX[PBMAX])(void);
void (*setPBX[PBMAX])(unsigned char);
void (*setPMBX[PBMAX])(unsigned char);
/* */
unsigned char getPEX_i(int i){
if(i<0) return (unsigned char)(-1);
if(i>PXMAX) return (unsigned char)(-1);
return (*getPEX[i])();
}
unsigned char getPMEX_i(int i){
if(i<0) return(unsigned char)(-1);
return (*getPMEX[i])();
}
void setPEX_i(int i, unsigned char c){
if(i>PXMAX) return;
(*setPEX[i])(c);
}
void setPMEX_i(int i, unsigned char c){
if(i<0) return;
if(i>PXMAX) return;
(*setPMEX[i])(c);
}
unsigned char getPBX_i(int i){
if(i<0) return (unsigned char)(-1);
if(i>PBMAX) return (unsigned char)(-1);
return (*getPBX[i])();
}
unsigned char getPMBX_i(int i){
return (*getPMBX[i])();
}
void setPBX_i(int i, unsigned char c){
if(i>PBMAX) return;
if(i<0) return;
(*setPBX[i])(c);
}
void setPMBX_i(int i, unsigned char c){
if(i>PBMAX) return;
if(i<0) return;
(*setPMBX[i])(c);
}
int pinIO[16];
void setPE0(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<8);
// else
// LPC_GPIO0->DATA &= ~(1<<8);
pe0=s;
}
void setPE1(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<9);
// else
// LPC_GPIO0->DATA &= ~(1<<9);
pe1=s;
}
void setPE2(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<11);
// else
// LPC_GPIO0->DATA &= ~(1<<11);
pe2=s;
}
void setPE3(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<5);
// else
// LPC_GPIO1->DATA &= ~(1<<5);
pe3=s;
}
void setPE4(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<6);
// else
// LPC_GPIO0->DATA &= ~(1<<6);
pe4=s;
}
void setPE5(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<7);
// else
// LPC_GPIO0->DATA &= ~(1<<7);
pe5=s;
}
void setPE6(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<4);
// else
// LPC_GPIO0->DATA &= ~(1<<4);
pe6=s;
}
void setPE7(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<3);
// else
// LPC_GPIO0->DATA &= ~(1<<3);
pe7=s;
}
void setPE8(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<2);
// else
// LPC_GPIO0->DATA &= ~(1<<2);
pe8=s;
}
void setPE9(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<0);
// else
// LPC_GPIO1->DATA &= ~(1<<0);
pe9=s;
}
void setPEA(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<1);
// else
// LPC_GPIO1->DATA &= ~(1<<1);
pea=s;
}
void setPEB(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<2);
// else
// LPC_GPIO1->DATA &= ~(1<<2);
peb=s;
}
void setPEC(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<4);
// else
// LPC_GPIO1->DATA &= ~(1<<4);
pec=s;
}
void setPED(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<5);
// else
// LPC_GPIO1->DATA &= ~(1<<5);
ped=s;
}
void setPEE(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<8);
// else
// LPC_GPIO1->DATA &= ~(1<<8);
pee=s;
}
void setPEF(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<9);
// else
// LPC_GPIO1->DATA &= ~(1<<9);
pef=s;
}
/*
// 1. port initialize
LPC_IOCON->PIO0_7 = 0xd0;
LPC_IOCON->PIO1_5 = 0xd0;
LPC_IOCON->PIO0_1 = 0xd0;
// 2. port direction
LPC_GPIO0->DIR |= (1<<7); //PIO0-7 to output
LPC_GPIO1->DIR |= (1<<5); //PIO0-5 to output
LPC_GPIO0->DIR &= ~(1<<1); //PIO0-1 to input
*/
void setPME0(unsigned char s){
// LPC_IOCON->PIO0_8 = 0xd0;
pinIO[0]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<8); // output
pe0.output();
else
// LPC_GPIO0->DIR &= ~(1<<8); // input
pe0.input();
}
void setPME1(unsigned char s){
// LPC_IOCON->PIO0_9 = 0xd0;
pinIO[1]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<9); // output
pe1.output();
else
// LPC_GPIO0->DIR &= ~(1<<9); // input
pe1.input();
}
//void setPME2(unsigned char s){ PD.DDR.BIT.B2 = s; PMD.R...
void setPME2(unsigned char s){
// LPC_IOCON->R_PIO0_11 = 0xd0;
pinIO[2]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<11); // output
pe2.output();
else
// LPC_GPIO0->DIR &= ~(1<<11); // input
pe2.input();
}
//void setPME3(unsigned char s){ PD.DDR.BIT.B3 = s; PMD.R...
void setPME3(unsigned char s){
// LPC_IOCON->PIO0_5 = 0xd0;
pinIO[3]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<5); // output
pe3.output();
else
// LPC_GPIO0->DIR &= ~(1<<5); // input
pe3.input();
}
//void setPME4(unsigned char s){ PD.DDR.BIT.B4 = s; PMD.R...
void setPME4(unsigned char s){
// LPC_IOCON->PIO0_6 = 0xd0;
pinIO[4]=s;
if(s==1)
pe4.output();
// LPC_GPIO0->DIR |= (1<<6); // output
else
// LPC_GPIO0->DIR &= ~(1<<6); // input
pe4.input();
}
//void setPME5(unsigned char s){ PD.DDR.BIT.B5 = s; PMD.R...
void setPME5(unsigned char s){
// LPC_IOCON->PIO0_7 = 0xd0;
pinIO[5]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<7); // output
pe5.output();
else
// LPC_GPIO0->DIR &= ~(1<<7); // input
pe5.input();
}
//void setPME6(unsigned char s){ PD.DDR.BIT.B6 = s; PMD.R...
void setPME6(unsigned char s){
// LPC_IOCON->PIO0_4 = 0xd0;
pinIO[6]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<4); // output
pe6.output();
else
// LPC_GPIO0->DIR &= ~(1<<4); // input
pe6.input();
}
//void setPME7(unsigned char s){ PD.DDR.BIT.B7 = s; PMD.R...
void setPME7(unsigned char s){
// LPC_IOCON->PIO0_3 = 0xd0;
pinIO[7]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<3); // output
pe7.output();
else
// LPC_GPIO0->DIR &= ~(1<<3); // input
pe7.input();
}
void setPME8(unsigned char s){
// LPC_IOCON->PIO0_2 = 0xd0;
pinIO[8]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<2); // output
pe8.output();
else
// LPC_GPIO0->DIR &= ~(1<<2); // input
pe8.input();
}
void setPME9(unsigned char s){
// LPC_IOCON->PIO1_0 = 0xd0;
pinIO[9]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<0); // output
pe9.output();
else
// LPC_GPIO1->DIR &= ~(1<<0); // input
pe9.input();
}
//void setPME2(unsigned char s){ PD.DDR.BIT.B2 = s; PMD.R...
void setPMEA(unsigned char s){
// LPC_IOCON->PIO1_1 = 0xd0;
pinIO[10]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<1); // output
pea.output();
else{
// LPC_GPIO1->DIR &= ~(1<<1); // input
pea.input();
pea.mode(PullNone);
}
}
//void setPME3(unsigned char s){ PD.DDR.BIT.B3 = s; PMD.R...
void setPMEB(unsigned char s){
// LPC_IOCON->PIO1_2 = 0xd0;
pinIO[11]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<2); // output
peb.output();
else{
// LPC_GPIO1->DIR &= ~(1<<2); // input
peb.input();
peb.mode(PullNone);
}
}
//void setPME4(unsigned char s){ PD.DDR.BIT.B4 = s; PMD.R...
void setPMEC(unsigned char s){
// LPC_IOCON->PIO1_4 = 0xd0;
pinIO[12]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<4); // output
pec.output();
else{
// LPC_GPIO1->DIR &= ~(1<<4); // input
pec.input();
pec.mode(PullNone);
}
}
//void setPME5(unsigned char s){ PD.DDR.BIT.B5 = s; PMD.R...
void setPMED(unsigned char s){
// LPC_IOCON->PIO1_5 = 0xd0;
pinIO[13]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<5); // output
ped.output();
else{
// LPC_GPIO1->DIR &= ~(1<<5); // input
ped.input();
ped.mode(PullNone);
}
}
//void setPME6(unsigned char s){ PD.DDR.BIT.B6 = s; PMD.R...
void setPMEE(unsigned char s){
// LPC_IOCON->PIO1_8 = 0xd0;
pinIO[14]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<8); // output
pee.output();
else{
// LPC_GPIO1->DIR &= ~(1<<8); // input
pee.input();
pee.mode(PullNone);
}
}
//void setPME7(unsigned char s){ PD.DDR.BIT.B7 = s; PMD.R...
void setPMEF(unsigned char s){
// LPC_IOCON->PIO1_9 = 0xd0;
pinIO[15]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<9); // output
pef.output();
else{
// LPC_GPIO1->DIR &= ~(1<<9); // input
pef.input();
pef.mode(PullNone);
}
}
unsigned char getPE0(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<8)] >> 8;
// return rtn;
return pe0;
}
unsigned char getPE1(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<9)] >> 9;
// return rtn;
return pe1;
}
unsigned char getPE2(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<11)] >> 11;
return pe2;
}
unsigned char getPE3(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<5)] >> 5;
return pe3;
}
unsigned char getPE4(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<6)] >> 6;
return pe4;
}
unsigned char getPE5(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<7)] >> 7;
return pe5;
}
unsigned char getPE6(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<4)] >> 4;
return pe6;
}
unsigned char getPE7(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<3)] >> 3;
return pe7;
}
unsigned char getPE8(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<5)] >> 5;
return pe8;
}
unsigned char getPE9(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<0)] >> 0;
return pe9;
}
unsigned char getPEA(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<1)] >> 1;
return pea;
}
unsigned char getPEB(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<2)] >> 2;
return peb;
}
unsigned char getPEC(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<4)] >> 4;
return pec;
}
unsigned char getPED(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<5)] >> 5;
return ped;
}
unsigned char getPEE(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<8)] >> 8;
return pee;
}
unsigned char getPEF(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<9)] >> 9;
return pef;
}
unsigned char getPME0(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<8))>>8);
return pinIO[0];
}
unsigned char getPME1(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<9))>>9);
return pinIO[1];
}
unsigned char getPME2(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<11))>>11);
return pinIO[2];
}
unsigned char getPME3(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<5))>>5);
return pinIO[3];
}
unsigned char getPME4(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<6))>>6);
return pinIO[4];
}
unsigned char getPME5(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<7))>>7);
return pinIO[5];
}
unsigned char getPME6(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<4))>>4);
return pinIO[6];
}
unsigned char getPME7(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<3))>>3);
return pinIO[7];
}
unsigned char getPME8(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<2))>>2);
return pinIO[8];
}
unsigned char getPME9(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<0))>>0);
return pinIO[9];
}
unsigned char getPMEA(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<1))>>1);
return pinIO[10];
}
unsigned char getPMEB(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<2))>>2);
return pinIO[11];
}
unsigned char getPMEC(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<4))>>4);
return pinIO[12];
}
unsigned char getPMED(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<5))>>5);
return pinIO[13];
}
unsigned char getPMEE(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<8))>>8);
return pinIO[14];
}
unsigned char getPMEF(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<9))>>9);
return pinIO[15];
}
void setPortFunctions(){
/*
unsigned char (*getPEX[16])()={
getPE0, getPE1, getPE2, getPE3,
getPE4, getPE5, getPE6, getPE7,
getPE8, getPE9, getPEA, getPEB,
getPEC, getPED, getPEE, getPEF
};
*/
getPEX[0]=getPE0;
getPEX[1]=getPE1;
getPEX[2]=getPE2;
getPEX[3]=getPE3;
getPEX[4]=getPE4;
getPEX[5]=getPE5;
getPEX[6]=getPE6;
getPEX[7]=getPE7;
getPEX[8]=getPE8;
getPEX[9]=getPE9;
getPEX[10]=getPEA;
getPEX[11]=getPEB;
getPEX[12]=getPEC;
getPEX[13]=getPED;
getPEX[14]=getPEE;
getPEX[15]=getPEF;
getPBX[0]=getPEA;
getPBX[1]=getPEB;
getPBX[2]=getPEC;
getPBX[3]=getPED;
getPBX[4]=getPEE;
getPBX[5]=getPEF;
setPEX[0]=setPE0;
setPEX[1]=setPE1;
setPEX[2]=setPE2;
setPEX[3]=setPE3;
setPEX[4]=setPE4;
setPEX[5]=setPE5;
setPEX[6]=setPE6;
setPEX[7]=setPE7;
setPEX[8]=setPE8;
setPEX[9]=setPE9;
setPEX[10]=setPEA;
setPEX[11]=setPEB;
setPEX[12]=setPEC;
setPEX[13]=setPED;
setPEX[14]=setPEE;
setPEX[15]=setPEF;
setPBX[0]=setPEA;
setPBX[1]=setPEB;
setPBX[2]=setPEC;
setPBX[3]=setPED;
setPBX[4]=setPEE;
setPBX[5]=setPEF;
getPMEX[0]=getPME0;
getPMEX[1]=getPME1;
getPMEX[2]=getPME2;
getPMEX[3]=getPME3;
getPMEX[4]=getPME4;
getPMEX[5]=getPME5;
getPMEX[6]=getPME6;
getPMEX[7]=getPME7;
getPMEX[8]=getPME8;
getPMEX[9]=getPME9;
getPMEX[10]=getPMEA;
getPMEX[11]=getPMEB;
getPMEX[12]=getPMEC;
getPMEX[13]=getPMED;
getPMEX[14]=getPMEE;
getPMEX[15]=getPMEF;
getPMBX[0]=getPMEA;
getPMBX[1]=getPMEB;
getPMBX[2]=getPMEC;
getPMBX[3]=getPMED;
getPMBX[4]=getPMEE;
getPMBX[5]=getPMEF;
setPMEX[0]=setPME0;
setPMEX[1]=setPME1;
setPMEX[2]=setPME2;
setPMEX[3]=setPME3;
setPMEX[4]=setPME4;
setPMEX[5]=setPME5;
setPMEX[6]=setPME6;
setPMEX[7]=setPME7;
setPMEX[8]=setPME8;
setPMEX[9]=setPME9;
setPMEX[10]=setPMEA;
setPMEX[11]=setPMEB;
setPMEX[12]=setPMEC;
setPMEX[13]=setPMED;
setPMEX[14]=setPMEE;
setPMEX[15]=setPMEF;
setPMBX[0]=setPMEA;
setPMBX[1]=setPMEB;
setPMBX[2]=setPMEC;
setPMBX[3]=setPMED;
setPMBX[4]=setPMEE;
setPMBX[5]=setPMEF;
}
}}
----
#counter
終了行:
[[Real2Virtual202111]]
#code(c){{
#include "Initialize.h"
#include "mbed.h"
/* */
DigitalInOut pe0(p27);
DigitalInOut pe1(p28);
DigitalInOut pe2(p30); //2024 5/17 swap with p29
DigitalInOut pe3(p29); // 2024 5/17 swap with p30
DigitalInOut pe4(p26);
DigitalInOut pe5(p25);
DigitalInOut pe6(p24);
DigitalInOut pe7(p23);
DigitalInOut pe8(p22);
DigitalInOut pe9(p21);
DigitalInOut pea(p19); //2024 5/16 p20->p19
DigitalInOut peb(p18); //2024 5/16 p19->p18
DigitalInOut pec(p17); // 2024 5/16 p18->p17
DigitalInOut ped(p16); // 2024 5/16 p17->p16
DigitalInOut pee(p14); // 2024 5/16 p16->p14
DigitalInOut pef(p13); // 2024 5/16 p15->p13
/* */
/*
DigitalInOut pe0(P1_30); //pe0(p27);
DigitalInOut pe1(P1_29); //pe1(p28);
DigitalInOut pe2(P0_0); //pe2(p29);
DigitalInOut pe3(P0_1); //pe3(p30);
DigitalInOut pe4(P1_31); //pe4(p26);
DigitalInOut pe5(P0_28); //pe5(p25);
DigitalInOut pe6(P0_22); //pe6(p24);
DigitalInOut pe7(P0_19); //pe7(p23);
DigitalInOut pe8(P0_18); //pe8(p22);
DigitalInOut pe9(P0_17); //pe9(p21);
DigitalInOut pea(P0_10); //pea(p20);
DigitalInOut peb(P1_0); //peb(p19);
DigitalInOut pec(P0_31); //pec(p18);
DigitalInOut ped(P0_23); //ped(p17);
DigitalInOut pee(P0_16); //pee(p16);
//DigitalInOut pef(P0_15); //pef(p15);
DigitalIn pef(P0_15);
*/
/* */
#define PXMAX 16
#define PBMAX 6
unsigned char (*getPEX[PXMAX])(void);
unsigned char (*getPMEX[PXMAX])(void);
void (*setPEX[PXMAX])(unsigned char);
void (*setPMEX[PXMAX])(unsigned char);
unsigned char (*getPBX[PBMAX])(void);
unsigned char (*getPMBX[PBMAX])(void);
void (*setPBX[PBMAX])(unsigned char);
void (*setPMBX[PBMAX])(unsigned char);
/* */
unsigned char getPEX_i(int i){
if(i<0) return (unsigned char)(-1);
if(i>PXMAX) return (unsigned char)(-1);
return (*getPEX[i])();
}
unsigned char getPMEX_i(int i){
if(i<0) return(unsigned char)(-1);
return (*getPMEX[i])();
}
void setPEX_i(int i, unsigned char c){
if(i>PXMAX) return;
(*setPEX[i])(c);
}
void setPMEX_i(int i, unsigned char c){
if(i<0) return;
if(i>PXMAX) return;
(*setPMEX[i])(c);
}
unsigned char getPBX_i(int i){
if(i<0) return (unsigned char)(-1);
if(i>PBMAX) return (unsigned char)(-1);
return (*getPBX[i])();
}
unsigned char getPMBX_i(int i){
return (*getPMBX[i])();
}
void setPBX_i(int i, unsigned char c){
if(i>PBMAX) return;
if(i<0) return;
(*setPBX[i])(c);
}
void setPMBX_i(int i, unsigned char c){
if(i>PBMAX) return;
if(i<0) return;
(*setPMBX[i])(c);
}
int pinIO[16];
void setPE0(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<8);
// else
// LPC_GPIO0->DATA &= ~(1<<8);
pe0=s;
}
void setPE1(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<9);
// else
// LPC_GPIO0->DATA &= ~(1<<9);
pe1=s;
}
void setPE2(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<11);
// else
// LPC_GPIO0->DATA &= ~(1<<11);
pe2=s;
}
void setPE3(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<5);
// else
// LPC_GPIO1->DATA &= ~(1<<5);
pe3=s;
}
void setPE4(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<6);
// else
// LPC_GPIO0->DATA &= ~(1<<6);
pe4=s;
}
void setPE5(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<7);
// else
// LPC_GPIO0->DATA &= ~(1<<7);
pe5=s;
}
void setPE6(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<4);
// else
// LPC_GPIO0->DATA &= ~(1<<4);
pe6=s;
}
void setPE7(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<3);
// else
// LPC_GPIO0->DATA &= ~(1<<3);
pe7=s;
}
void setPE8(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO0->DATA |= (1<<2);
// else
// LPC_GPIO0->DATA &= ~(1<<2);
pe8=s;
}
void setPE9(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<0);
// else
// LPC_GPIO1->DATA &= ~(1<<0);
pe9=s;
}
void setPEA(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<1);
// else
// LPC_GPIO1->DATA &= ~(1<<1);
pea=s;
}
void setPEB(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<2);
// else
// LPC_GPIO1->DATA &= ~(1<<2);
peb=s;
}
void setPEC(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<4);
// else
// LPC_GPIO1->DATA &= ~(1<<4);
pec=s;
}
void setPED(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<5);
// else
// LPC_GPIO1->DATA &= ~(1<<5);
ped=s;
}
void setPEE(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<8);
// else
// LPC_GPIO1->DATA &= ~(1<<8);
pee=s;
}
void setPEF(unsigned char s){
//LPC_GPIO0->DATA |= (1<<7); //PIO0-7 high led 1 on
// LPC_GPIO0->DATA &= ~(1<<7); //PIO0-7 low
//LPC_GPIO1->DATA |= (1<<5); //PIO0-5 high led 2 off
// if(s==1)
// LPC_GPIO1->DATA |= (1<<9);
// else
// LPC_GPIO1->DATA &= ~(1<<9);
pef=s;
}
/*
// 1. port initialize
LPC_IOCON->PIO0_7 = 0xd0;
LPC_IOCON->PIO1_5 = 0xd0;
LPC_IOCON->PIO0_1 = 0xd0;
// 2. port direction
LPC_GPIO0->DIR |= (1<<7); //PIO0-7 to output
LPC_GPIO1->DIR |= (1<<5); //PIO0-5 to output
LPC_GPIO0->DIR &= ~(1<<1); //PIO0-1 to input
*/
void setPME0(unsigned char s){
// LPC_IOCON->PIO0_8 = 0xd0;
pinIO[0]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<8); // output
pe0.output();
else
// LPC_GPIO0->DIR &= ~(1<<8); // input
pe0.input();
}
void setPME1(unsigned char s){
// LPC_IOCON->PIO0_9 = 0xd0;
pinIO[1]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<9); // output
pe1.output();
else
// LPC_GPIO0->DIR &= ~(1<<9); // input
pe1.input();
}
//void setPME2(unsigned char s){ PD.DDR.BIT.B2 = s; PMD.R...
void setPME2(unsigned char s){
// LPC_IOCON->R_PIO0_11 = 0xd0;
pinIO[2]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<11); // output
pe2.output();
else
// LPC_GPIO0->DIR &= ~(1<<11); // input
pe2.input();
}
//void setPME3(unsigned char s){ PD.DDR.BIT.B3 = s; PMD.R...
void setPME3(unsigned char s){
// LPC_IOCON->PIO0_5 = 0xd0;
pinIO[3]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<5); // output
pe3.output();
else
// LPC_GPIO0->DIR &= ~(1<<5); // input
pe3.input();
}
//void setPME4(unsigned char s){ PD.DDR.BIT.B4 = s; PMD.R...
void setPME4(unsigned char s){
// LPC_IOCON->PIO0_6 = 0xd0;
pinIO[4]=s;
if(s==1)
pe4.output();
// LPC_GPIO0->DIR |= (1<<6); // output
else
// LPC_GPIO0->DIR &= ~(1<<6); // input
pe4.input();
}
//void setPME5(unsigned char s){ PD.DDR.BIT.B5 = s; PMD.R...
void setPME5(unsigned char s){
// LPC_IOCON->PIO0_7 = 0xd0;
pinIO[5]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<7); // output
pe5.output();
else
// LPC_GPIO0->DIR &= ~(1<<7); // input
pe5.input();
}
//void setPME6(unsigned char s){ PD.DDR.BIT.B6 = s; PMD.R...
void setPME6(unsigned char s){
// LPC_IOCON->PIO0_4 = 0xd0;
pinIO[6]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<4); // output
pe6.output();
else
// LPC_GPIO0->DIR &= ~(1<<4); // input
pe6.input();
}
//void setPME7(unsigned char s){ PD.DDR.BIT.B7 = s; PMD.R...
void setPME7(unsigned char s){
// LPC_IOCON->PIO0_3 = 0xd0;
pinIO[7]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<3); // output
pe7.output();
else
// LPC_GPIO0->DIR &= ~(1<<3); // input
pe7.input();
}
void setPME8(unsigned char s){
// LPC_IOCON->PIO0_2 = 0xd0;
pinIO[8]=s;
if(s==1)
// LPC_GPIO0->DIR |= (1<<2); // output
pe8.output();
else
// LPC_GPIO0->DIR &= ~(1<<2); // input
pe8.input();
}
void setPME9(unsigned char s){
// LPC_IOCON->PIO1_0 = 0xd0;
pinIO[9]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<0); // output
pe9.output();
else
// LPC_GPIO1->DIR &= ~(1<<0); // input
pe9.input();
}
//void setPME2(unsigned char s){ PD.DDR.BIT.B2 = s; PMD.R...
void setPMEA(unsigned char s){
// LPC_IOCON->PIO1_1 = 0xd0;
pinIO[10]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<1); // output
pea.output();
else{
// LPC_GPIO1->DIR &= ~(1<<1); // input
pea.input();
pea.mode(PullNone);
}
}
//void setPME3(unsigned char s){ PD.DDR.BIT.B3 = s; PMD.R...
void setPMEB(unsigned char s){
// LPC_IOCON->PIO1_2 = 0xd0;
pinIO[11]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<2); // output
peb.output();
else{
// LPC_GPIO1->DIR &= ~(1<<2); // input
peb.input();
peb.mode(PullNone);
}
}
//void setPME4(unsigned char s){ PD.DDR.BIT.B4 = s; PMD.R...
void setPMEC(unsigned char s){
// LPC_IOCON->PIO1_4 = 0xd0;
pinIO[12]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<4); // output
pec.output();
else{
// LPC_GPIO1->DIR &= ~(1<<4); // input
pec.input();
pec.mode(PullNone);
}
}
//void setPME5(unsigned char s){ PD.DDR.BIT.B5 = s; PMD.R...
void setPMED(unsigned char s){
// LPC_IOCON->PIO1_5 = 0xd0;
pinIO[13]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<5); // output
ped.output();
else{
// LPC_GPIO1->DIR &= ~(1<<5); // input
ped.input();
ped.mode(PullNone);
}
}
//void setPME6(unsigned char s){ PD.DDR.BIT.B6 = s; PMD.R...
void setPMEE(unsigned char s){
// LPC_IOCON->PIO1_8 = 0xd0;
pinIO[14]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<8); // output
pee.output();
else{
// LPC_GPIO1->DIR &= ~(1<<8); // input
pee.input();
pee.mode(PullNone);
}
}
//void setPME7(unsigned char s){ PD.DDR.BIT.B7 = s; PMD.R...
void setPMEF(unsigned char s){
// LPC_IOCON->PIO1_9 = 0xd0;
pinIO[15]=s;
if(s==1)
// LPC_GPIO1->DIR |= (1<<9); // output
pef.output();
else{
// LPC_GPIO1->DIR &= ~(1<<9); // input
pef.input();
pef.mode(PullNone);
}
}
unsigned char getPE0(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<8)] >> 8;
// return rtn;
return pe0;
}
unsigned char getPE1(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<9)] >> 9;
// return rtn;
return pe1;
}
unsigned char getPE2(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<11)] >> 11;
return pe2;
}
unsigned char getPE3(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<5)] >> 5;
return pe3;
}
unsigned char getPE4(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<6)] >> 6;
return pe4;
}
unsigned char getPE5(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<7)] >> 7;
return pe5;
}
unsigned char getPE6(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<4)] >> 4;
return pe6;
}
unsigned char getPE7(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<3)] >> 3;
return pe7;
}
unsigned char getPE8(void){
// unsigned char rtn;
// rtn = LPC_GPIO0-> MASKED_ACCESS[(1<<5)] >> 5;
return pe8;
}
unsigned char getPE9(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<0)] >> 0;
return pe9;
}
unsigned char getPEA(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<1)] >> 1;
return pea;
}
unsigned char getPEB(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<2)] >> 2;
return peb;
}
unsigned char getPEC(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<4)] >> 4;
return pec;
}
unsigned char getPED(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<5)] >> 5;
return ped;
}
unsigned char getPEE(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<8)] >> 8;
return pee;
}
unsigned char getPEF(void){
// unsigned char rtn;
// rtn = LPC_GPIO1-> MASKED_ACCESS[(1<<9)] >> 9;
return pef;
}
unsigned char getPME0(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<8))>>8);
return pinIO[0];
}
unsigned char getPME1(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<9))>>9);
return pinIO[1];
}
unsigned char getPME2(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<11))>>11);
return pinIO[2];
}
unsigned char getPME3(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<5))>>5);
return pinIO[3];
}
unsigned char getPME4(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<6))>>6);
return pinIO[4];
}
unsigned char getPME5(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<7))>>7);
return pinIO[5];
}
unsigned char getPME6(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<4))>>4);
return pinIO[6];
}
unsigned char getPME7(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<3))>>3);
return pinIO[7];
}
unsigned char getPME8(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO0->DIR;
// rtn=(unsigned char) ((d & (1<<2))>>2);
return pinIO[8];
}
unsigned char getPME9(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<0))>>0);
return pinIO[9];
}
unsigned char getPMEA(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<1))>>1);
return pinIO[10];
}
unsigned char getPMEB(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<2))>>2);
return pinIO[11];
}
unsigned char getPMEC(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<4))>>4);
return pinIO[12];
}
unsigned char getPMED(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<5))>>5);
return pinIO[13];
}
unsigned char getPMEE(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<8))>>8);
return pinIO[14];
}
unsigned char getPMEF(void){
// unsigned char rtn;
// uint32_t d=LPC_GPIO1->DIR;
// rtn=(unsigned char) ((d & (1<<9))>>9);
return pinIO[15];
}
void setPortFunctions(){
/*
unsigned char (*getPEX[16])()={
getPE0, getPE1, getPE2, getPE3,
getPE4, getPE5, getPE6, getPE7,
getPE8, getPE9, getPEA, getPEB,
getPEC, getPED, getPEE, getPEF
};
*/
getPEX[0]=getPE0;
getPEX[1]=getPE1;
getPEX[2]=getPE2;
getPEX[3]=getPE3;
getPEX[4]=getPE4;
getPEX[5]=getPE5;
getPEX[6]=getPE6;
getPEX[7]=getPE7;
getPEX[8]=getPE8;
getPEX[9]=getPE9;
getPEX[10]=getPEA;
getPEX[11]=getPEB;
getPEX[12]=getPEC;
getPEX[13]=getPED;
getPEX[14]=getPEE;
getPEX[15]=getPEF;
getPBX[0]=getPEA;
getPBX[1]=getPEB;
getPBX[2]=getPEC;
getPBX[3]=getPED;
getPBX[4]=getPEE;
getPBX[5]=getPEF;
setPEX[0]=setPE0;
setPEX[1]=setPE1;
setPEX[2]=setPE2;
setPEX[3]=setPE3;
setPEX[4]=setPE4;
setPEX[5]=setPE5;
setPEX[6]=setPE6;
setPEX[7]=setPE7;
setPEX[8]=setPE8;
setPEX[9]=setPE9;
setPEX[10]=setPEA;
setPEX[11]=setPEB;
setPEX[12]=setPEC;
setPEX[13]=setPED;
setPEX[14]=setPEE;
setPEX[15]=setPEF;
setPBX[0]=setPEA;
setPBX[1]=setPEB;
setPBX[2]=setPEC;
setPBX[3]=setPED;
setPBX[4]=setPEE;
setPBX[5]=setPEF;
getPMEX[0]=getPME0;
getPMEX[1]=getPME1;
getPMEX[2]=getPME2;
getPMEX[3]=getPME3;
getPMEX[4]=getPME4;
getPMEX[5]=getPME5;
getPMEX[6]=getPME6;
getPMEX[7]=getPME7;
getPMEX[8]=getPME8;
getPMEX[9]=getPME9;
getPMEX[10]=getPMEA;
getPMEX[11]=getPMEB;
getPMEX[12]=getPMEC;
getPMEX[13]=getPMED;
getPMEX[14]=getPMEE;
getPMEX[15]=getPMEF;
getPMBX[0]=getPMEA;
getPMBX[1]=getPMEB;
getPMBX[2]=getPMEC;
getPMBX[3]=getPMED;
getPMBX[4]=getPMEE;
getPMBX[5]=getPMEF;
setPMEX[0]=setPME0;
setPMEX[1]=setPME1;
setPMEX[2]=setPME2;
setPMEX[3]=setPME3;
setPMEX[4]=setPME4;
setPMEX[5]=setPME5;
setPMEX[6]=setPME6;
setPMEX[7]=setPME7;
setPMEX[8]=setPME8;
setPMEX[9]=setPME9;
setPMEX[10]=setPMEA;
setPMEX[11]=setPMEB;
setPMEX[12]=setPMEC;
setPMEX[13]=setPMED;
setPMEX[14]=setPMEE;
setPMEX[15]=setPMEF;
setPMBX[0]=setPMEA;
setPMBX[1]=setPMEB;
setPMBX[2]=setPMEC;
setPMBX[3]=setPMED;
setPMBX[4]=setPMEE;
setPMBX[5]=setPMEF;
}
}}
----
#counter
ページ名: