Rev | Line | |
---|
[224] | 1 | /*
|
---|
| 2 |
|
---|
| 3 | This sketch allows the users to manage the Tian power management.
|
---|
| 4 | Users can power up or power down the MIPS side from the MCU serial console.
|
---|
| 5 |
|
---|
| 6 | After upload the sketch, open the Serial Terminal and press the send button.
|
---|
| 7 |
|
---|
| 8 | COMMANDS
|
---|
| 9 | ----------------------
|
---|
| 10 | h - help
|
---|
| 11 | D - power down MIPS
|
---|
| 12 | U - power up MIPS
|
---|
| 13 |
|
---|
| 14 | created March 2016
|
---|
| 15 | by andrea@arduino.org
|
---|
| 16 |
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | #define MIPS_PIN 32 //PA28 PIN 32
|
---|
| 20 |
|
---|
| 21 | char var;
|
---|
| 22 |
|
---|
| 23 | void setup() {
|
---|
| 24 | // put your setup code here, to run once:
|
---|
| 25 | Serial.begin(115200);
|
---|
| 26 |
|
---|
| 27 | pinMode(MIPS_PIN,OUTPUT); //MIPS
|
---|
| 28 | digitalWrite(MIPS_PIN,HIGH);
|
---|
| 29 | while(!Serial.available());;
|
---|
| 30 | menu('h');
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | void loop() {
|
---|
| 34 | // put your main code here, to run repeatedly:
|
---|
| 35 | while (Serial.available()){
|
---|
| 36 | var = Serial.read();
|
---|
| 37 | menu(var);
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | void menu( char var){
|
---|
| 42 | switch (var) {
|
---|
| 43 | case 'D':
|
---|
| 44 | Serial.println("MIPS OFF");
|
---|
| 45 | Serial.println();
|
---|
| 46 | digitalWrite(MIPS_PIN,LOW);
|
---|
| 47 | break;
|
---|
| 48 | case 'U':
|
---|
| 49 | Serial.println("MIPS ON");
|
---|
| 50 | Serial.println();
|
---|
| 51 | digitalWrite(MIPS_PIN,HIGH);
|
---|
| 52 | break;
|
---|
| 53 | case 'h':
|
---|
| 54 | Serial.println("COMMANDS");
|
---|
| 55 | Serial.println("----------------------");
|
---|
| 56 | Serial.println("h - help");
|
---|
| 57 | Serial.println("D - power down MIPS");
|
---|
| 58 | Serial.println("U - power up MIPS");
|
---|
| 59 | Serial.println();
|
---|
| 60 | break;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.