Пример #1
0
void doLCD(void){
    //Initialize LCD and backlight    
    // 138 x 110, 4-level grayscale pixels.
    halLcdInit();       
    // halLcdBackLightInit();  
    // halLcdSetBackLight(0);  // 8 for normal
    halLcdSetContrast(100);
    halLcdClearScreen(); 
    halLcdImage(TI_TINY_BUG, 4, 32, 104, 12 );

    halLcdPrintLine("BTstack on ", 0, 0);
    halLcdPrintLine("TI MSP430", 1, 0);
    halLcdPrintLine("Keyboard", 2, 0);
    halLcdPrintLine("Init...", 3, 0);
    row = 4;
}
Пример #2
0
/**********************************************************************//**
 * @brief  Executes the "PMM-MCLK" menu option in the User Experience
 *         example code. This menu option allows one to change the frequency
 *         of operation for the MSP430 and the VCore setting. 
 * 
 * @param  none 
 * 
 * @return none 
 *************************************************************************/
void menuPMMMCLK( void )
{
  unsigned char menuLeftPos = 2, menuRightPos = 0, menuRightMaxAllowed = 5;
  unsigned char ledOn, quit = 0;
  volatile unsigned int i;
  
  halButtonsInterruptDisable( BUTTON_ALL );
  halButtonsInterruptEnable( BUTTON_SELECT + BUTTON_S1 +   \
                             BUTTON_S2 + BUTTON_RIGHT );
  halAccelerometerShutDown();
  halLcdClearScreen();
  
  halBoardOutputSystemClock();
  halLcdPrintLineCol(&VcoreText[0], 0, 1,  OVERWRITE_TEXT );

  for (i=0;i < MCLK_MENU_MAX+1; i++)
    halLcdPrintLineCol(&MCLKText[i*6], i, 12,  OVERWRITE_TEXT );
  
  halLcdPrintLineCol(&VcoreText[menuLeftPos*6 + 6],        \
                     menuLeftPos+1, 1, INVERT_TEXT | OVERWRITE_TEXT);
  halLcdPrintLineCol(&MCLKText[menuRightPos*6 + 6],        \
                     menuRightPos+1, 12, INVERT_TEXT | OVERWRITE_TEXT);    
  buttonsPressed = 0;  
  
  for (i = menuRightMaxAllowed; i < MCLK_MENU_MAX; i++)
  {
    halLcdLine(96, 12*(i+1)+6, 136, 12*(i+1)+6, PIXEL_ON);        
    halLcdLine(96, 12*(i+1)+7, 136, 12*(i+1)+7, PIXEL_ON);     
  }
  ledOn = 0;
  halLcdPrintLine("      LED", 6, 0);  
  halLcdPrintLine("      OFF", 7, 0);
  halLcdImage(IMG_RIGHT_FILLED, 4, 32, 10, 75);
  
  halBoardSetVCore(menuLeftPos);
  halBoardSetSystemClock(menuRightPos);  

  while (!quit)
  {
  	// The LED can be enabled to show the relative difference between
  	// frequencies of operation. 
    while (!buttonsPressed)    
      if (ledOn)
      {
        LED_PORT_OUT ^= LED_1;
        for (i=0; i < 0xFFFF; i++)
          if (buttonsPressed)
            break;
      }      
      else
      {
      	// To emulate a real application instead of continuous jumps, use nops 
        __no_operation();
        __no_operation();
        __no_operation();
        __no_operation();                           
        __no_operation();
        __no_operation();
        __no_operation();
        __no_operation();                           
        __no_operation();
      }
    if (buttonsPressed & BUTTON_S1)
    {
      /*
       * Disabled for MSP430F5438 RTM Silicon
      halLcdPrintLineCol(&VcoreText[menuLeftPos*6 + 6], menuLeftPos+1,      \
                         1,  OVERWRITE_TEXT);
      if (++ menuLeftPos >= VCORE_MENU_MAX)
      {
        menuLeftPos = 0;
        menuRightMaxAllowed = MAX_MCLK_ALLOWED[ menuLeftPos ];
        if (menuRightPos >= menuRightMaxAllowed)
        {
          halLcdPrintLineCol(&MCLKText[menuRightPos*6 + 6], menuRightPos+1, \
                             12,  OVERWRITE_TEXT);                
          menuRightPos = menuRightMaxAllowed - 1;
          halLcdPrintLineCol(&MCLKText[menuRightPos*6 + 6], menuRightPos+1, \
                             12, INVERT_TEXT | OVERWRITE_TEXT);  
        }        
        for (i = menuRightMaxAllowed; i < MCLK_MENU_MAX; i++)
        {
          halLcdLine(96, 12*(i+1)+6, 136, 12*(i+1)+6, PIXEL_ON);        
          halLcdLine(96, 12*(i+1)+7, 136, 12*(i+1)+7, PIXEL_ON);        
        }
      } 
         
      else            
      {
        for (i=menuRightMaxAllowed+1; i< MAX_MCLK_ALLOWED[menuLeftPos]+1; i ++)
          halLcdPrintLineCol(&MCLKText[i*6], i, 12,  OVERWRITE_TEXT );          
        menuRightMaxAllowed = MAX_MCLK_ALLOWED[menuLeftPos];
      }      
      halLcdPrintLineCol(&VcoreText[menuLeftPos*6 + 6], menuLeftPos+1,       \
                         1, INVERT_TEXT | OVERWRITE_TEXT);
      */
    }
    if ( buttonsPressed & BUTTON_S2 )
    {
      halLcdPrintLineCol(&MCLKText[menuRightPos*6 + 6],    \
                         menuRightPos+1, 12,  OVERWRITE_TEXT);        
      
      if ( ++menuRightPos >= menuRightMaxAllowed )      
        menuRightPos = 0;
        
      halLcdPrintLineCol(&MCLKText[menuRightPos*6 + 6],    \
                         menuRightPos+1, 12, INVERT_TEXT| OVERWRITE_TEXT);              
    }
    if ( buttonsPressed & BUTTON_RIGHT )
    {
      ledOn = 1 - ledOn;
      if ( ledOn )        
        halLcdPrintLineCol("ON ", 7, 6, OVERWRITE_TEXT);
      else
      {
      	halLcdPrintLineCol("OFF", 7, 6, OVERWRITE_TEXT);
        LED_PORT_OUT &= ~LED_1;
      }         
    }    
    
    if ( buttonsPressed & (BUTTON_S1 | BUTTON_S2) )
    {
      halBoardSetVCore(menuLeftPos);
  		halBoardSetSystemClock(menuRightPos);  
  		//halBoardDisableSVS();
    }
    if ( buttonsPressed & BUTTON_SELECT )    
      quit = 1;
    buttonsPressed = 0;
  }
  
  halBoardSetSystemClock( SYSCLK_16MHZ );
  halBoardStopOutputSystemClock();
  LED_PORT_OUT &= ~LED_1;
}