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.
Revision 0:9777c29c1214, committed 2011-07-04
- Comitter:
- NathanWhitaker
- Date:
- Mon Jul 04 14:18:05 2011 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Header.hpp Mon Jul 04 14:18:05 2011 +0000 @@ -0,0 +1,172 @@ +I2C i2c(p9,p10); //Setup I2C connection + + +DigitalOut L1(LED1); +DigitalOut L2(LED2); +DigitalOut L3(LED3); +DigitalOut L4(LED4); + +int Add_PSU1 = 0xBE; // Defining PSU addresses +int Add_PSU2 = 0xBA; +int Add_PSU3 = 0xB2; +int Add_PSU4 = 0xA2; +int Add_PSU5 = 0x82; + +int PSU_Select=1; + +RPCVariable<int> Select_PSU(&PSU_Select, "PSU_Select"); +RPCVariable<int> PSU1_Add(&Add_PSU1, "PSU1_Address"); +RPCVariable<int> PSU2_Add(&Add_PSU2, "PSU2_Address"); +RPCVariable<int> PSU3_Add(&Add_PSU3, "PSU3_Address"); +RPCVariable<int> PSU4_Add(&Add_PSU4, "PSU4_Address"); +RPCVariable<int> PSU5_Add(&Add_PSU5, "PSU5_Address"); + +void L1_ON(void) { + + L1=1; + +} + +void L2_ON(void) { + + L2=1; + +} + +void L3_ON(void) { + + L3=1; + +} + +void L4_ON(void) { + + L4=1; + +} + +void L1_OFF(void) { + + L1=0; + +} + + +void L2_OFF(void) { + + L2=0; + +} + +void L3_OFF(void) { + + L3=0; + +} + +void L4_OFF(void) { + + L4=0; + +} + + + +void LED1_ON(char * input, char * output); +void LED2_ON(char * input, char * output); +void LED3_ON(char * input, char * output); +void LED4_ON(char * input, char * output); +void LED1_OFF(char * input, char * output); +void LED2_OFF(char * input, char * output); +void LED3_OFF(char * input, char * output); +void LED4_OFF(char * input, char * output); + +void LED1_ON(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L1=1; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} + +void LED2_ON(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L2=1; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} +void LED3_ON(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L3=1; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} +void LED4_ON(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L4=1; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} +void LED1_OFF(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L1=0; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} +void LED2_OFF(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L2=0; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} +void LED3_OFF(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L3=0; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} +void LED4_OFF(char * input, char * output) { + + if ((PSU_Select<=5)&&(PSU_Select>=1)) { + if (PSU_Select-5) { + L4=0; + } else printf("Nothing connected to address %d \r\n",PSU_Select); + } else { + printf("PSU Select value not valid \r\n"); + } + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RPCInterface.lib Mon Jul 04 14:18:05 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/MichaelW/code/RPCInterface/#a9e2c45097c8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jul 04 14:18:05 2011 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "rpc.h" +#include "SerialRPCInterface.h" +#include "Header.hpp" + + +SerialRPCInterface RPC(USBTX, USBRX); + +RPCFunction L1_On(&LED1_ON, "LED1_On"); +RPCFunction L2_On(&LED2_ON, "LED2_On"); +RPCFunction L3_On(&LED3_ON, "LED3_On"); +RPCFunction L4_On(&LED4_ON, "LED4_On"); +RPCFunction L1_Off(&LED1_OFF, "LED1_Off_LONG"); +RPCFunction L2_Off(&LED2_OFF, "LED2_Off_LONG"); +RPCFunction L3_Off(&LED3_OFF, "LED3_Off_LONG"); +RPCFunction L4_Off(&LED4_OFF, "LED4_Off_LONG_NAME"); + + + +int main() { + while (1) { + L1 = 1; + wait(0.25); + L1 = 0; + wait(0.25); + L1 = 1; + wait(0.25); + L1 = 0; + wait(0.25); + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jul 04 14:18:05 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912