Feature #218

Que el led de power del joystick parpadee cuando se detecte algún contacto

Added by Txinto Vaz about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
02/08/2016
Due date:
% Done:

100%

Estimated time:
1.00 h
Spent time:

Description

Hacer que ese led se apague cuando detecte algo, y que se encienda si no.

photo668429746462369752.jpg View (241 KB) Txinto Vaz, 02/08/2016 09:17 PM

photo668429746462369751.jpg View (238 KB) Txinto Vaz, 02/08/2016 09:17 PM

199
200

History

#1 Updated by Txinto Vaz about 8 years ago

Añadimos alguna inicialización a prj_pinout.cpp y prj_pinout.h

...
/**** Pin assigment section ****/
#define CFG_POWERGND_PIN 2
...
...
/* Prepares the pinout for project use */
void pinoutInit(void){
  /* Configure the power led DO pin */
  pinMode(CFG_POWERGND_PIN,OUTPUT);
...

Añadimos unas cuantas líneas a prj_output.cpp

...
void prjOutputInit(void) {
  digitalWrite(CFG_POWERGND_PIN,LOW);
  ...
}

void prjOutput(void) {
  /* When any button is pressed, the power pin will be switched down to indicate something is detected */
  /* By default, the power led must be active */
  digitalWrite(CFG_POWERGND_PIN,LOW);

  /************* BUTTONS SECTION ***************/

  // read digital pins and use them for the buttons
  for (uint8_t i=0; i<CFG_JOYSTICK_NUMBER_OF_BUTTONS ; i++) {
    if (dre.detection.allButtons[i] == 1) {
      /* When any button is pressed, the power pin will be switched down to indicate something is detected */
      digitalWrite(CFG_POWERGND_PIN,HIGH);
    }
...
  }

  /************ JOYSTICK SECTION ***************/

...

  for (uint8_t i=0; i<CFG_JOYSTICK_NUMBER_OF_POSITIONS ; i++) {
    if (dre.detection.detectedJoy[i]) {
      /* When any button is pressed, the power pin will be switched down to indicate something is detected */
      digitalWrite(CFG_POWERGND_PIN,HIGH);
    }
  }

...
}

#2 Updated by Txinto Vaz about 8 years ago

199
200

Apagado:

Encendido:

#3 Updated by Txinto Vaz about 8 years ago

  • % Done changed from 0 to 100

#4 Updated by Txinto Vaz about 8 years ago

  • Status changed from In Progress to Resolved

#5 Updated by Txinto Vaz about 8 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF