Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

How to wake up on keypad press ? [IR-Remote Project]

$
0
0
Hello,
I'm still working on my Project -> C2RC -> Calculator2Remote Conversion 
The circuit and the IR codes now work after I adjusted the pulse timings. 
But now I wonder how I can put the MSP430G2553  in sleep mode..
 
I've followed the suggestion of energia
 
But I must be doing something fundamentally wrong, because I think that would be too easy:
 
/* @file CustomKeypad.pde
|| @version 1.0
|| @author Alexander Brevig
|| @contact alexanderbrevig@gmail.com
||
|| @description
|| | Demonstrates changing the keypad size and key values.
|| #
*/
#include <Keypad.h>
#include <IRremote.h>


const byte ROWS = 6; //four rows
const byte COLS = 5; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'0','1','2','3','w'},
  {'b1','4','5','6','.'},
  {'7','8','9','-','C'},
  {'%','m','b2','+','R'},
  {'=','M','/','*','b3'},
  {'b4','O','o','b5','b6'}
};
byte rowPins[ROWS] = {P1_3, P1_4, P2_1, P1_5, P2_0, P2_2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {P1_0, P2_4, P2_5, P1_6, P1_7}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
IRsend irsend;

void setup(){
  Serial.begin(9600);
  
  
  
  //LPM
  disableWatchDog();
  attachInterrupt(P1_3, awake, FALLING);    //row Pins = INPUT_PULLUP
  attachInterrupt(P1_4, awake, FALLING);
  attachInterrupt(P2_1, awake, FALLING);
  attachInterrupt(P1_5, awake, FALLING);
  attachInterrupt(P2_0, awake, FALLING);
  attachInterrupt(P2_2, awake, FALLING);
}
 
void loop() {
 __bis_status_register(LPM4_bits + GIE);
  /* Code after this will never be reached */
} 
  
void awake(){
  char customKey = customKeypad.getKey();
  
  switch (customKey) {
    case 'o':    
      irsend.sendSamsung(0xe0e040bf, 32);
      
      break;
    
    default:
      //irsend.sendSamsung(0xe0e040bf, 32);
    
      break;
      }
  }

The IR-LED is always OFF.

Where is my mistake?

 


Viewing all articles
Browse latest Browse all 2077

Trending Articles