Library designed as an interface to the mbed Pin Connect Block
main.cpp@0:1b1cf3daf204, 2011-11-29 (annotated)
- Committer:
- Blaze513
- Date:
- Tue Nov 29 05:08:41 2011 +0000
- Revision:
- 0:1b1cf3daf204
initial release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Blaze513 | 0:1b1cf3daf204 | 1 | #include "mbed.h" |
Blaze513 | 0:1b1cf3daf204 | 2 | #include "PinConnectBlock.h" |
Blaze513 | 0:1b1cf3daf204 | 3 | |
Blaze513 | 0:1b1cf3daf204 | 4 | Serial myComputer(USBTX, USBRX); |
Blaze513 | 0:1b1cf3daf204 | 5 | void interruptHandler1(void) |
Blaze513 | 0:1b1cf3daf204 | 6 | { myComputer.printf("Testing Pin 1 |"); wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); |
Blaze513 | 0:1b1cf3daf204 | 7 | wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); |
Blaze513 | 0:1b1cf3daf204 | 8 | wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); wait(1); myComputer.printf("|"); } |
Blaze513 | 0:1b1cf3daf204 | 9 | void interruptHandler2(void) |
Blaze513 | 0:1b1cf3daf204 | 10 | { myComputer.printf("Testing Pin 2 |"); wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); |
Blaze513 | 0:1b1cf3daf204 | 11 | wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); |
Blaze513 | 0:1b1cf3daf204 | 12 | wait(1); myComputer.printf("-"); wait(1); myComputer.printf("-"); wait(1); myComputer.printf("|"); } |
Blaze513 | 0:1b1cf3daf204 | 13 | void checkFunctRegisters() |
Blaze513 | 0:1b1cf3daf204 | 14 | { |
Blaze513 | 0:1b1cf3daf204 | 15 | for (int i = 0; i < 10; i++) |
Blaze513 | 0:1b1cf3daf204 | 16 | { |
Blaze513 | 0:1b1cf3daf204 | 17 | myComputer.printf("\r\nPinselReg %d:\r\n\t", i); |
Blaze513 | 0:1b1cf3daf204 | 18 | for (int j = 0; j < 4; j++) |
Blaze513 | 0:1b1cf3daf204 | 19 | { |
Blaze513 | 0:1b1cf3daf204 | 20 | myComputer.printf("%X ", *((char*)((unsigned long*)&LPC_PINCON->PINSEL0 + i) + j)); |
Blaze513 | 0:1b1cf3daf204 | 21 | } |
Blaze513 | 0:1b1cf3daf204 | 22 | } |
Blaze513 | 0:1b1cf3daf204 | 23 | } |
Blaze513 | 0:1b1cf3daf204 | 24 | void checkResistRegisters() |
Blaze513 | 0:1b1cf3daf204 | 25 | { |
Blaze513 | 0:1b1cf3daf204 | 26 | for (int i = 0; i < 10; i++) |
Blaze513 | 0:1b1cf3daf204 | 27 | { |
Blaze513 | 0:1b1cf3daf204 | 28 | myComputer.printf("\r\nPinmodReg %d:\r\n\t", i); |
Blaze513 | 0:1b1cf3daf204 | 29 | for (int j = 0; j < 4; j++) |
Blaze513 | 0:1b1cf3daf204 | 30 | { |
Blaze513 | 0:1b1cf3daf204 | 31 | myComputer.printf("%X ", *((char*)((unsigned long*)&LPC_PINCON->PINMODE0 + i) + j)); |
Blaze513 | 0:1b1cf3daf204 | 32 | } |
Blaze513 | 0:1b1cf3daf204 | 33 | } |
Blaze513 | 0:1b1cf3daf204 | 34 | } |
Blaze513 | 0:1b1cf3daf204 | 35 | void checkODMRegisters() |
Blaze513 | 0:1b1cf3daf204 | 36 | { |
Blaze513 | 0:1b1cf3daf204 | 37 | for (int i = 0; i < 5; i++) |
Blaze513 | 0:1b1cf3daf204 | 38 | { |
Blaze513 | 0:1b1cf3daf204 | 39 | myComputer.printf("\r\nPinmodODReg %d:\r\n\t", i); |
Blaze513 | 0:1b1cf3daf204 | 40 | for (int j = 0; j < 4; j++) |
Blaze513 | 0:1b1cf3daf204 | 41 | { |
Blaze513 | 0:1b1cf3daf204 | 42 | myComputer.printf("%X ", *((char*)((unsigned long*)&LPC_PINCON->PINMODE_OD0 + i) + j)); |
Blaze513 | 0:1b1cf3daf204 | 43 | } |
Blaze513 | 0:1b1cf3daf204 | 44 | } |
Blaze513 | 0:1b1cf3daf204 | 45 | } |
Blaze513 | 0:1b1cf3daf204 | 46 | void checkTMRegister() |
Blaze513 | 0:1b1cf3daf204 | 47 | { |
Blaze513 | 0:1b1cf3daf204 | 48 | myComputer.printf("\r\nPinselTMReg:\r\n\t"); |
Blaze513 | 0:1b1cf3daf204 | 49 | for (int j = 0; j < 4; j++) |
Blaze513 | 0:1b1cf3daf204 | 50 | { |
Blaze513 | 0:1b1cf3daf204 | 51 | myComputer.printf("%X ", *((char*)&LPC_PINCON->PINSEL10 + j)); |
Blaze513 | 0:1b1cf3daf204 | 52 | } |
Blaze513 | 0:1b1cf3daf204 | 53 | } |
Blaze513 | 0:1b1cf3daf204 | 54 | void checkI2CRegister() |
Blaze513 | 0:1b1cf3daf204 | 55 | { |
Blaze513 | 0:1b1cf3daf204 | 56 | myComputer.printf("\r\nI2CPADReg:\r\n\t"); |
Blaze513 | 0:1b1cf3daf204 | 57 | for (int j = 0; j < 4; j++) |
Blaze513 | 0:1b1cf3daf204 | 58 | { |
Blaze513 | 0:1b1cf3daf204 | 59 | myComputer.printf("%X ", *((char*)&LPC_PINCON->I2CPADCFG + j)); |
Blaze513 | 0:1b1cf3daf204 | 60 | } |
Blaze513 | 0:1b1cf3daf204 | 61 | } |
Blaze513 | 0:1b1cf3daf204 | 62 | |
Blaze513 | 0:1b1cf3daf204 | 63 | int main () |
Blaze513 | 0:1b1cf3daf204 | 64 | { |
Blaze513 | 0:1b1cf3daf204 | 65 | PinConnectBlock::SetPinConnection(2, 11, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 66 | NVIC_SetVector(EINT1_IRQn, (uint32_t)interruptHandler1); |
Blaze513 | 0:1b1cf3daf204 | 67 | NVIC_SetPriority(EINT1_IRQn, 1); |
Blaze513 | 0:1b1cf3daf204 | 68 | NVIC_EnableIRQ(EINT1_IRQn); |
Blaze513 | 0:1b1cf3daf204 | 69 | |
Blaze513 | 0:1b1cf3daf204 | 70 | /*InterruptIn hardint(p30); |
Blaze513 | 0:1b1cf3daf204 | 71 | hardint.rise(&interruptHandler2); |
Blaze513 | 0:1b1cf3daf204 | 72 | NVIC_SetPriority(EINT3_IRQn, 0);*/ |
Blaze513 | 0:1b1cf3daf204 | 73 | |
Blaze513 | 0:1b1cf3daf204 | 74 | /*unsigned char result; |
Blaze513 | 0:1b1cf3daf204 | 75 | for (int i = 1; i < 7; i++) |
Blaze513 | 0:1b1cf3daf204 | 76 | { |
Blaze513 | 0:1b1cf3daf204 | 77 | myComputer.printf("Port %d:\r\n", i); |
Blaze513 | 0:1b1cf3daf204 | 78 | for (int j = 0; j < 35; j++) |
Blaze513 | 0:1b1cf3daf204 | 79 | { |
Blaze513 | 0:1b1cf3daf204 | 80 | myComputer.printf("\tPin %d:\r\n", j); |
Blaze513 | 0:1b1cf3daf204 | 81 | for (int k = 0; k < 4; k++) |
Blaze513 | 0:1b1cf3daf204 | 82 | { |
Blaze513 | 0:1b1cf3daf204 | 83 | result = PinConnectBlock::ValidateInput(i, j, k); |
Blaze513 | 0:1b1cf3daf204 | 84 | myComputer.printf("\t\tMode %d: %d ", k, result); |
Blaze513 | 0:1b1cf3daf204 | 85 | result = PinConnectBlock::ValidateInput(i, j, k | 0x0C); |
Blaze513 | 0:1b1cf3daf204 | 86 | myComputer.printf("Mode %d: %d ", k | 0x0C, result); |
Blaze513 | 0:1b1cf3daf204 | 87 | result = PinConnectBlock::ValidateInput(i, j, k | 0x10); |
Blaze513 | 0:1b1cf3daf204 | 88 | myComputer.printf("Mode %d: %d \r\n", k | 0x10, result); |
Blaze513 | 0:1b1cf3daf204 | 89 | result = PinConnectBlock::ValidateInput(i, j, k | 0x14); |
Blaze513 | 0:1b1cf3daf204 | 90 | myComputer.printf("Mode %d: %d \r\n", k | 0x14, result); |
Blaze513 | 0:1b1cf3daf204 | 91 | } |
Blaze513 | 0:1b1cf3daf204 | 92 | } |
Blaze513 | 0:1b1cf3daf204 | 93 | }*/ |
Blaze513 | 0:1b1cf3daf204 | 94 | |
Blaze513 | 0:1b1cf3daf204 | 95 | /*PinConnectBlock::SetPinConnection(2, 11, 0x13); |
Blaze513 | 0:1b1cf3daf204 | 96 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 97 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 98 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 99 | myComputer.printf("\r\nPin 2.11 Mode: %X\r\n\r\n", PinConnectBlock::GetPinConnection(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 100 | PinConnectBlock::SetPinConnection(2, 11, 0x0C); |
Blaze513 | 0:1b1cf3daf204 | 101 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 102 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 103 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 104 | myComputer.printf("\r\nPin 2.11 Mode: %X\r\n\r\n", PinConnectBlock::GetPinConnection(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 105 | PinConnectBlock::SetPinConnection(2, 11, 0x1F); |
Blaze513 | 0:1b1cf3daf204 | 106 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 107 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 108 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 109 | myComputer.printf("\r\nPin 2.11 Mode: %X\r\n\r\n", PinConnectBlock::GetPinConnection(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 110 | PinConnectBlock::SetPinConnection(2, 11, 0x00); |
Blaze513 | 0:1b1cf3daf204 | 111 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 112 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 113 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 114 | myComputer.printf("\r\nPin 2.11 Mode: %X\r\n\r\n", PinConnectBlock::GetPinConnection(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 115 | PinConnectBlock::SetPinConnection(2, 11, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 116 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 117 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 118 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 119 | myComputer.printf("\r\nPin 2.11 Mode: %X\r\n\r\n", PinConnectBlock::GetPinConnection(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 120 | PinConnectBlock::SetPinConnection(1, 10, 0x02); |
Blaze513 | 0:1b1cf3daf204 | 121 | PinConnectBlock::SetPinConnection(0, 28, 0x1F); |
Blaze513 | 0:1b1cf3daf204 | 122 | PinConnectBlock::SetPinConnection(0, 29, 0x1F); |
Blaze513 | 0:1b1cf3daf204 | 123 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 124 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 125 | checkODMRegisters();*/ |
Blaze513 | 0:1b1cf3daf204 | 126 | |
Blaze513 | 0:1b1cf3daf204 | 127 | /*PinConnectBlock::SetFunctionMode(1, 18, 0x02); |
Blaze513 | 0:1b1cf3daf204 | 128 | PinConnectBlock::SetFunctionMode(1, 20, 0x03); |
Blaze513 | 0:1b1cf3daf204 | 129 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 130 | myComputer.printf("\r\nPin 3.25 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(4, 29)); |
Blaze513 | 0:1b1cf3daf204 | 131 | myComputer.printf("\r\nPin 3.25 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(3, 25)); |
Blaze513 | 0:1b1cf3daf204 | 132 | myComputer.printf("\r\nPin 2.11 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 133 | myComputer.printf("\r\nPin 1.18 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(1, 18)); |
Blaze513 | 0:1b1cf3daf204 | 134 | myComputer.printf("\r\nPin 1.20 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(1, 20)); |
Blaze513 | 0:1b1cf3daf204 | 135 | myComputer.printf("\r\nPin 1.0 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(1, 0)); |
Blaze513 | 0:1b1cf3daf204 | 136 | myComputer.printf("\r\nPin 0.15 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(0, 15)); |
Blaze513 | 0:1b1cf3daf204 | 137 | myComputer.printf("\r\nPin 0.25 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(0, 25)); |
Blaze513 | 0:1b1cf3daf204 | 138 | PinConnectBlock::SetFunctionMode(4, 29, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 139 | PinConnectBlock::SetFunctionMode(3, 25, 0x02); |
Blaze513 | 0:1b1cf3daf204 | 140 | PinConnectBlock::SetFunctionMode(2, 11, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 141 | PinConnectBlock::SetFunctionMode(1, 0, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 142 | PinConnectBlock::SetFunctionMode(0, 15, 0x02); |
Blaze513 | 0:1b1cf3daf204 | 143 | PinConnectBlock::SetFunctionMode(0, 25, 0x03); |
Blaze513 | 0:1b1cf3daf204 | 144 | PinConnectBlock::SetFunctionMode(1, 18, 0x00); |
Blaze513 | 0:1b1cf3daf204 | 145 | PinConnectBlock::SetFunctionMode(1, 20, 0x00); |
Blaze513 | 0:1b1cf3daf204 | 146 | checkFunctRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 147 | myComputer.printf("\r\nPin 3.25 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(4, 29)); |
Blaze513 | 0:1b1cf3daf204 | 148 | myComputer.printf("\r\nPin 3.25 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(3, 25)); |
Blaze513 | 0:1b1cf3daf204 | 149 | myComputer.printf("\r\nPin 2.11 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(2, 11)); |
Blaze513 | 0:1b1cf3daf204 | 150 | myComputer.printf("\r\nPin 1.18 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(1, 18)); |
Blaze513 | 0:1b1cf3daf204 | 151 | myComputer.printf("\r\nPin 1.20 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(1, 20)); |
Blaze513 | 0:1b1cf3daf204 | 152 | myComputer.printf("\r\nPin 1.0 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(1, 0)); |
Blaze513 | 0:1b1cf3daf204 | 153 | myComputer.printf("\r\nPin 0.15 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(0, 15)); |
Blaze513 | 0:1b1cf3daf204 | 154 | myComputer.printf("\r\nPin 0.25 Fmode: %d\r\n\r\n", PinConnectBlock::GetFunctionMode(0, 25));*/ |
Blaze513 | 0:1b1cf3daf204 | 155 | |
Blaze513 | 0:1b1cf3daf204 | 156 | /*PinConnectBlock::SetResistorMode(1, 18, 0x00); |
Blaze513 | 0:1b1cf3daf204 | 157 | PinConnectBlock::SetResistorMode(1, 20, 0x03); |
Blaze513 | 0:1b1cf3daf204 | 158 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 159 | myComputer.printf("\r\nPin 0.0 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(0, 0)); |
Blaze513 | 0:1b1cf3daf204 | 160 | myComputer.printf("\r\nPin 0.15 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(0, 15)); |
Blaze513 | 0:1b1cf3daf204 | 161 | myComputer.printf("\r\nPin 1.18 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(1, 18)); |
Blaze513 | 0:1b1cf3daf204 | 162 | myComputer.printf("\r\nPin 1.20 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(1, 20)); |
Blaze513 | 0:1b1cf3daf204 | 163 | myComputer.printf("\r\nPin 1.31 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(1, 31)); |
Blaze513 | 0:1b1cf3daf204 | 164 | myComputer.printf("\r\nPin 2.0 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(2, 0)); |
Blaze513 | 0:1b1cf3daf204 | 165 | myComputer.printf("\r\nPin 3.26 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(3, 26)); |
Blaze513 | 0:1b1cf3daf204 | 166 | myComputer.printf("\r\nPin 4.28 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(4, 28)); |
Blaze513 | 0:1b1cf3daf204 | 167 | PinConnectBlock::SetResistorMode(0, 0, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 168 | PinConnectBlock::SetResistorMode(0, 15, 0x02); |
Blaze513 | 0:1b1cf3daf204 | 169 | PinConnectBlock::SetResistorMode(1, 18, 0x03); |
Blaze513 | 0:1b1cf3daf204 | 170 | PinConnectBlock::SetResistorMode(1, 20, 0x00); |
Blaze513 | 0:1b1cf3daf204 | 171 | PinConnectBlock::SetResistorMode(1, 31, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 172 | PinConnectBlock::SetResistorMode(2, 0, 0x02); |
Blaze513 | 0:1b1cf3daf204 | 173 | PinConnectBlock::SetResistorMode(3, 26, 0x03); |
Blaze513 | 0:1b1cf3daf204 | 174 | PinConnectBlock::SetResistorMode(4, 28, 0x01); |
Blaze513 | 0:1b1cf3daf204 | 175 | checkResistRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 176 | myComputer.printf("\r\nPin 0.0 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(0, 0)); |
Blaze513 | 0:1b1cf3daf204 | 177 | myComputer.printf("\r\nPin 0.15 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(0, 15)); |
Blaze513 | 0:1b1cf3daf204 | 178 | myComputer.printf("\r\nPin 1.18 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(1, 18)); |
Blaze513 | 0:1b1cf3daf204 | 179 | myComputer.printf("\r\nPin 1.20 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(1, 20)); |
Blaze513 | 0:1b1cf3daf204 | 180 | myComputer.printf("\r\nPin 1.31 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(1, 31)); |
Blaze513 | 0:1b1cf3daf204 | 181 | myComputer.printf("\r\nPin 2.0 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(2, 0)); |
Blaze513 | 0:1b1cf3daf204 | 182 | myComputer.printf("\r\nPin 3.26 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(3, 26)); |
Blaze513 | 0:1b1cf3daf204 | 183 | myComputer.printf("\r\nPin 4.28 Rmode: %d\r\n\r\n", PinConnectBlock::GetResistorMode(4, 28));*/ |
Blaze513 | 0:1b1cf3daf204 | 184 | |
Blaze513 | 0:1b1cf3daf204 | 185 | /*PinConnectBlock::SetOpenDrainMode(3, 26, 1); |
Blaze513 | 0:1b1cf3daf204 | 186 | PinConnectBlock::SetOpenDrainMode(3, 25, 1); |
Blaze513 | 0:1b1cf3daf204 | 187 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 188 | myComputer.printf("\r\nPin 0.0 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 0)); |
Blaze513 | 0:1b1cf3daf204 | 189 | myComputer.printf("\r\nPin 0.11 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 11)); |
Blaze513 | 0:1b1cf3daf204 | 190 | myComputer.printf("\r\nPin 0.15 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 15)); |
Blaze513 | 0:1b1cf3daf204 | 191 | myComputer.printf("\r\nPin 0.26 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 26)); |
Blaze513 | 0:1b1cf3daf204 | 192 | myComputer.printf("\r\nPin 0.29 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 29)); |
Blaze513 | 0:1b1cf3daf204 | 193 | myComputer.printf("\r\nPin 0.30 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 30)); |
Blaze513 | 0:1b1cf3daf204 | 194 | myComputer.printf("\r\nPin 1.0 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(1, 0)); |
Blaze513 | 0:1b1cf3daf204 | 195 | myComputer.printf("\r\nPin 1.31 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(1, 31)); |
Blaze513 | 0:1b1cf3daf204 | 196 | myComputer.printf("\r\nPin 2.0 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(2, 0)); |
Blaze513 | 0:1b1cf3daf204 | 197 | myComputer.printf("\r\nPin 2.13 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(2, 13)); |
Blaze513 | 0:1b1cf3daf204 | 198 | myComputer.printf("\r\nPin 3.25 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(3, 25)); |
Blaze513 | 0:1b1cf3daf204 | 199 | myComputer.printf("\r\nPin 3.26 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(3, 26)); |
Blaze513 | 0:1b1cf3daf204 | 200 | myComputer.printf("\r\nPin 4.28 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(4, 28)); |
Blaze513 | 0:1b1cf3daf204 | 201 | myComputer.printf("\r\nPin 4.29 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(4, 29)); |
Blaze513 | 0:1b1cf3daf204 | 202 | PinConnectBlock::SetOpenDrainMode(0, 0, 1); |
Blaze513 | 0:1b1cf3daf204 | 203 | PinConnectBlock::SetOpenDrainMode(0, 11, 1); |
Blaze513 | 0:1b1cf3daf204 | 204 | PinConnectBlock::SetOpenDrainMode(0, 15, 1); |
Blaze513 | 0:1b1cf3daf204 | 205 | PinConnectBlock::SetOpenDrainMode(0, 26, 1); |
Blaze513 | 0:1b1cf3daf204 | 206 | PinConnectBlock::SetOpenDrainMode(0, 29, 1); |
Blaze513 | 0:1b1cf3daf204 | 207 | PinConnectBlock::SetOpenDrainMode(0, 30, 1); |
Blaze513 | 0:1b1cf3daf204 | 208 | PinConnectBlock::SetOpenDrainMode(1, 0, 1); |
Blaze513 | 0:1b1cf3daf204 | 209 | PinConnectBlock::SetOpenDrainMode(1, 31, 1); |
Blaze513 | 0:1b1cf3daf204 | 210 | PinConnectBlock::SetOpenDrainMode(2, 0, 1); |
Blaze513 | 0:1b1cf3daf204 | 211 | PinConnectBlock::SetOpenDrainMode(2, 13, 1); |
Blaze513 | 0:1b1cf3daf204 | 212 | PinConnectBlock::SetOpenDrainMode(3, 25, 0); |
Blaze513 | 0:1b1cf3daf204 | 213 | PinConnectBlock::SetOpenDrainMode(3, 26, 0); |
Blaze513 | 0:1b1cf3daf204 | 214 | PinConnectBlock::SetOpenDrainMode(4, 28, 1); |
Blaze513 | 0:1b1cf3daf204 | 215 | PinConnectBlock::SetOpenDrainMode(4, 29, 1); |
Blaze513 | 0:1b1cf3daf204 | 216 | checkODMRegisters(); |
Blaze513 | 0:1b1cf3daf204 | 217 | myComputer.printf("\r\nPin 0.0 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 0)); |
Blaze513 | 0:1b1cf3daf204 | 218 | myComputer.printf("\r\nPin 0.11 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 11)); |
Blaze513 | 0:1b1cf3daf204 | 219 | myComputer.printf("\r\nPin 0.15 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 15)); |
Blaze513 | 0:1b1cf3daf204 | 220 | myComputer.printf("\r\nPin 0.26 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 26)); |
Blaze513 | 0:1b1cf3daf204 | 221 | myComputer.printf("\r\nPin 0.29 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 29)); |
Blaze513 | 0:1b1cf3daf204 | 222 | myComputer.printf("\r\nPin 0.30 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(0, 30)); |
Blaze513 | 0:1b1cf3daf204 | 223 | myComputer.printf("\r\nPin 1.0 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(1, 0)); |
Blaze513 | 0:1b1cf3daf204 | 224 | myComputer.printf("\r\nPin 1.31 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(1, 31)); |
Blaze513 | 0:1b1cf3daf204 | 225 | myComputer.printf("\r\nPin 2.0 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(2, 0)); |
Blaze513 | 0:1b1cf3daf204 | 226 | myComputer.printf("\r\nPin 2.13 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(2, 13)); |
Blaze513 | 0:1b1cf3daf204 | 227 | myComputer.printf("\r\nPin 3.25 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(3, 25)); |
Blaze513 | 0:1b1cf3daf204 | 228 | myComputer.printf("\r\nPin 3.26 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(3, 26)); |
Blaze513 | 0:1b1cf3daf204 | 229 | myComputer.printf("\r\nPin 4.28 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(4, 28)); |
Blaze513 | 0:1b1cf3daf204 | 230 | myComputer.printf("\r\nPin 4.29 ODmode: %d\r\n\r\n", PinConnectBlock::GetOpenDrainMode(4, 29));*/ |
Blaze513 | 0:1b1cf3daf204 | 231 | |
Blaze513 | 0:1b1cf3daf204 | 232 | /*checkTMRegister(); |
Blaze513 | 0:1b1cf3daf204 | 233 | myComputer.printf("\r\nTrace mode: %d\r\n\r\n", PinConnectBlock::GetTraceMode()); |
Blaze513 | 0:1b1cf3daf204 | 234 | PinConnectBlock::SetTraceMode(1); |
Blaze513 | 0:1b1cf3daf204 | 235 | checkTMRegister(); |
Blaze513 | 0:1b1cf3daf204 | 236 | myComputer.printf("\r\nTrace mode: %d\r\n\r\n", PinConnectBlock::GetTraceMode()); |
Blaze513 | 0:1b1cf3daf204 | 237 | PinConnectBlock::SetTraceMode(0); |
Blaze513 | 0:1b1cf3daf204 | 238 | checkTMRegister(); |
Blaze513 | 0:1b1cf3daf204 | 239 | myComputer.printf("\r\nTrace mode: %d\r\n\r\n", PinConnectBlock::GetTraceMode());*/ |
Blaze513 | 0:1b1cf3daf204 | 240 | |
Blaze513 | 0:1b1cf3daf204 | 241 | /*checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 242 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 243 | PinConnectBlock::SetI2C0Mode(0x03); |
Blaze513 | 0:1b1cf3daf204 | 244 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 245 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 246 | PinConnectBlock::SetI2C0Mode(0x01); |
Blaze513 | 0:1b1cf3daf204 | 247 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 248 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 249 | PinConnectBlock::SetI2C0Mode(0x02); |
Blaze513 | 0:1b1cf3daf204 | 250 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 251 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 252 | PinConnectBlock::SetI2C0Mode(0x00); |
Blaze513 | 0:1b1cf3daf204 | 253 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 254 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 255 | LPC_PINCON->I2CPADCFG |= 0x00000001; |
Blaze513 | 0:1b1cf3daf204 | 256 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 257 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 258 | LPC_PINCON->I2CPADCFG |= 0x00000003; |
Blaze513 | 0:1b1cf3daf204 | 259 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 260 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 261 | LPC_PINCON->I2CPADCFG |= 0x00000007; |
Blaze513 | 0:1b1cf3daf204 | 262 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 263 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 264 | LPC_PINCON->I2CPADCFG &= ~0x0000000F; |
Blaze513 | 0:1b1cf3daf204 | 265 | LPC_PINCON->I2CPADCFG |= 0x00000008; |
Blaze513 | 0:1b1cf3daf204 | 266 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 267 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 268 | LPC_PINCON->I2CPADCFG |= 0x0000000C; |
Blaze513 | 0:1b1cf3daf204 | 269 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 270 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode()); |
Blaze513 | 0:1b1cf3daf204 | 271 | LPC_PINCON->I2CPADCFG |= 0x0000000E; |
Blaze513 | 0:1b1cf3daf204 | 272 | checkI2CRegister(); |
Blaze513 | 0:1b1cf3daf204 | 273 | myComputer.printf("\r\nI2C0mode: %d\r\n\r\n", PinConnectBlock::GetI2C0Mode());*/ |
Blaze513 | 0:1b1cf3daf204 | 274 | |
Blaze513 | 0:1b1cf3daf204 | 275 | DigitalOut led1(LED1); |
Blaze513 | 0:1b1cf3daf204 | 276 | DigitalOut led2(LED2); |
Blaze513 | 0:1b1cf3daf204 | 277 | DigitalOut led3(LED3); |
Blaze513 | 0:1b1cf3daf204 | 278 | DigitalOut led4(LED4); |
Blaze513 | 0:1b1cf3daf204 | 279 | while (1) |
Blaze513 | 0:1b1cf3daf204 | 280 | { |
Blaze513 | 0:1b1cf3daf204 | 281 | led1 = !led1; |
Blaze513 | 0:1b1cf3daf204 | 282 | wait_ms(250); |
Blaze513 | 0:1b1cf3daf204 | 283 | led2 = !led2; |
Blaze513 | 0:1b1cf3daf204 | 284 | wait_ms(250); |
Blaze513 | 0:1b1cf3daf204 | 285 | led3 = !led3; |
Blaze513 | 0:1b1cf3daf204 | 286 | wait_ms(250); |
Blaze513 | 0:1b1cf3daf204 | 287 | led4 = !led4; |
Blaze513 | 0:1b1cf3daf204 | 288 | wait_ms(250); |
Blaze513 | 0:1b1cf3daf204 | 289 | |
Blaze513 | 0:1b1cf3daf204 | 290 | NVIC_SetPendingIRQ(EINT1_IRQn); |
Blaze513 | 0:1b1cf3daf204 | 291 | wait(10); |
Blaze513 | 0:1b1cf3daf204 | 292 | } |
Blaze513 | 0:1b1cf3daf204 | 293 | } |