Ejemplo n.º 1
0
void TestModeCommandHandler(void)
{
  /* see if the command is in the table */
  unsigned char i = 0;
  unsigned char match = 0;
  
  /* the more commands there are - the longer this will take */
  while ( i < NUMBER_OF_COMMANDS && !match )
  {
    /* match command to one in the table */
    if ( strcmp(CmdString,COMMAND_TABLE[i++].CommandNameString) == 0 )
    {
      match = 1;
    }
  }
  
  /* if the command exists then call the handler */
  if ( match )
  {
    COMMAND_TABLE[i-1].fpHandler();
  }
  else
  {
    PrintString3("Unknown Command ",CmdString,CR);
  }
   
  /* clear flags used by rx interrupt */
  portENTER_CRITICAL();
  RxIndex = 0;
  WaitForCommandToBeProcessed = 0;
  portEXIT_CRITICAL();
}
Ejemplo n.º 2
0
/* this function probably belongs somewhere else */
void WhoAmI(void)
{
  extern const char BUILD[];
  extern const char VERSION[];
  PrintString3("Version: ", VERSION,CR);
  PrintString3("Build: ", BUILD,CR);
  
  tVersion Version = GetWrapperVersion();
  PrintString3("Wrapper: ", Version.pSwVer,CR);
  
  PrintString2(SPP_DEVICE_NAME,CR);
  PrintString("Msp430 Version ");
  PrintCharacter(GetMsp430HardwareRevision());
  PrintString(CR);
  
  PrintStringAndDecimal("HwVersion: ", HardwareVersion());
}
Ejemplo n.º 3
0
void ShowWatchdogInfo(void)
{
  if (niReset == FLASH_RESET_CODE) niWdtCounter = 0;

  unsigned int ResetSource = GetResetSource();
  PrintResetSource(ResetSource);

  if (ResetSource == SYSRSTIV_WDTTO || ResetSource == SYSRSTIV_WDTKEY)
  {
    PrintString3("# WDT ", ResetSource == SYSRSTIV_WDTTO ? "Failsafe" : "Forced", CR);
    PrintStringAndDecimal("SppReadyToSleep ", WatchdogInfo.SppReadyToSleep);
    PrintStringAndDecimal("TaskDelayLockCount ", WatchdogInfo.TaskDelayLockCount);
    PrintStringAndDecimal("DisplayMsgWaiting ", WatchdogInfo.DisplayMessagesWaiting);
    PrintStringAndDecimal("SppMsgWaiting ", WatchdogInfo.SppMessagesWaiting);
    niWdtCounter ++;
  }
  
  PrintStringAndDecimal("Total Watchdogs: ", niWdtCounter);
}
Ejemplo n.º 4
0
static void ShowCall(tString *pString, unsigned char Type)
{
  static tString CallerId[15] = "";
  static tTimerId NotifyTimerId = UNASSIGNED;
  tMessage Msg;

  if (Type == SHOW_NOTIF_CALLER_ID) strcpy(CallerId, pString);
  
  if (Type == SHOW_NOTIF_CALLER_NAME && *CallerId)
  {
    PrintString3("- Caller:", pString, CR);
  
    SetupMessageAndAllocateBuffer(&Msg, SetVibrateMode, MSG_OPT_NONE);
    *(tSetVibrateModePayload *)Msg.pBuffer = RingTone;
    RouteMsg(&Msg);
    
    PageType = PAGE_TYPE_INFO;
    CurrentPage[PageType] = CallPage;
    DrawCallScreen(CallerId, pString);

    // set a 5s timer for switching back to idle screen
    if (NotifyTimerId == UNASSIGNED) NotifyTimerId = AllocateOneSecondTimer();
    SetupOneSecondTimer(NotifyTimerId, 10, NO_REPEAT, DISPLAY_QINDEX, CallerNameMsg, SHOW_NOTIF_END);
    StartOneSecondTimer(NotifyTimerId);
  }
  else if (Type == SHOW_NOTIF_END || Type == SHOW_NOTIF_REJECT_CALL)
  {
    PrintString2("- Call Notif End", CR);
    
    *CallerId = NULL;
    StopOneSecondTimer(NotifyTimerId);

    PageType = PAGE_TYPE_IDLE;
    SendMessage(&Msg, UpdateDisplayMsg, CurrentMode | MSG_OPT_UPD_INTERNAL |
                (CurrentMode == IDLE_MODE ? MSG_OPT_NEWUI : 0));

    if (Type == SHOW_NOTIF_REJECT_CALL) SendMessage(&Msg, HfpMsg, MSG_OPT_HFP_HANGUP);
  }
}
Ejemplo n.º 5
0
void Init(void)
{  
  __disable_interrupt();

  ENABLE_LCD_LED();
  DISABLE_LCD_POWER();

  /* clear shipping mode, if set to allow configuration */
  PMMCTL0_H = PMMPW_H;
  PM5CTL0 &= ~LOCKLPM5;  
  PMMCTL0_H = 0x00;
  
  /* disable DMA during read-modify-write cycles */
  DMACTL4 = DMARMWDIS;

  DetermineErrata();
  
#ifdef BOOTLOADER
  /*
   * enable RAM alternate interrupt vectors
   * these are defined in AltVect.s43 and copied to RAM by cstartup
   */
  SYSCTL |= SYSRIVECT;
  ClearBootloaderSignature();
#else
  SaveResetSource();
#endif
  
  SetupClockAndPowerManagementModule();
  
  CheckResetCode();
  if (niReset != NO_RESET_CODE) InitProperty();

  InitBufferPool(); // message queue

  InitBattery();
  CheckClip();

  PrintString2("\r\n*** ", niReset == FLASH_RESET_CODE ? "FLASH" :
    (niReset == MASTER_RESET_CODE ? "MASTER" : "NORMAL"));
  PrintString3(":", niBuild, CR);
  
  ShowWatchdogInfo();
  WhoAmI();

  /* timer for battery checking at a regular frequency. */
  BatteryTimerId = AllocateOneSecondTimer();
  SetupOneSecondTimer(BatteryTimerId,
                      BATTERY_MONITOR_INTERVAL,
                      REPEAT_FOREVER,
                      DISPLAY_QINDEX,
                      MonitorBatteryMsg,
                      MSG_OPT_NONE);
  StartOneSecondTimer(BatteryTimerId);

  InitVibration();
  InitRealTimeClock(); // enable rtc interrupt

  LcdPeripheralInit();
  DrawStartupScreen();
  SerialRamInit();

  /* turn the radio on; initialize the serial port profile or BLE/GATT */
  CreateAndSendMessage(TurnRadioOnMsg, MSG_OPT_NONE);

  DISABLE_LCD_LED();
}