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.
Diff: Header.hpp
- Revision:
- 0:9777c29c1214
--- /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