コード例 #1
0
ファイル: IdlePageMain.c プロジェクト: kiapper/Watch
static int IdleUpdateHandler(struct IdleInfo *Info)
{
	/* select between 1 second and 1 minute */
	int IdleUpdateTime;

	StopAllDisplayTimers();

	if (GetDisplaySeconds())
	{
		IdleUpdateTime = ONE_SECOND;
	}
	else
	{
		IdleUpdateTime = ONE_SECOND * 60;
	}

	/* setup a timer to determine when to draw the screen again */
	SetupOneSecondTimer(Info->IdleModeTimerId, IdleUpdateTime, REPEAT_FOREVER,
			IdleUpdate, NO_MSG_OPTIONS);

	StartOneSecondTimer(Info->IdleModeTimerId);

	/* determine if the bottom of the screen should be drawn by the watch */
	if (QueryFirstContact())
	{
        tHostMsg* pOutgoingMsg;
		/*
		 * immediately update the screen
		 */
		if (GetIdleBufferConfiguration() == WATCH_CONTROLS_TOP)
		{
			/* only draw watch part */
			FillMyBuffer(STARTING_ROW, WATCH_DRAWN_IDLE_BUFFER_ROWS, 0x00);
			DrawIdleScreen();
//			PrepareMyBufferForLcd(STARTING_ROW, WATCH_DRAWN_IDLE_BUFFER_ROWS);
			SendMyBufferToLcd(WATCH_DRAWN_IDLE_BUFFER_ROWS);
		}

		/* now update the remainder of the display */
		/*! make a dirty flag for the idle page drawn by the phone
		 * set it whenever watch uses whole screen
		 */
		BPL_AllocMessageBuffer(&pOutgoingMsg);
		pOutgoingMsg->Type = UpdateDisplay;
		pOutgoingMsg->Options = IDLE_MODE | DONT_ACTIVATE_DRAW_BUFFER;
		RouteMsg(&pOutgoingMsg);

		return IDLE_UPDATE_TOP_ONLY;
	}
	FillMyBuffer(STARTING_ROW, NUM_LCD_ROWS, 0x00);
	DrawSimpleIdleScreen();
	DrawConnectionScreen();

	return IDLE_UPDATE_FULL_SCREEN;
}
コード例 #2
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
void DrawWatchStatusScreen(void)
{
  FillMyBuffer(0, LCD_ROW_NUM, 0);
  CopyColumnsIntoMyBuffer(RadioOn() ? pRadioOnIcon : pRadioOffIcon,
                          3,
                          STATUS_ICON_SIZE_IN_ROWS,
                          LEFT_STATUS_ICON_COLUMN,
                          STATUS_ICON_SIZE_IN_COLUMNS);
  // Connection status
  CopyColumnsIntoMyBuffer(Connected(CONN_TYPE_MAIN) ? pConnectedIcon : pDisconnectedIcon,
                          3,
                          STATUS_ICON_SIZE_IN_ROWS,
                          CENTER_STATUS_ICON_COLUMN,
                          STATUS_ICON_SIZE_IN_COLUMNS);

  gRow = 31;
  gColumn = 5;
  gBitColumnMask = BIT4;
  SetFont(MetaWatch5);

  if (PairedDeviceType() == DEVICE_TYPE_BLE)
  {
    if (Connected(CONN_TYPE_HFP) && Connected(CONN_TYPE_MAP)) DrawString("DUO", DRAW_OPT_BITWISE_OR);
    else DrawString("BLE", DRAW_OPT_BITWISE_OR);
  }
  else if (PairedDeviceType() == DEVICE_TYPE_SPP) DrawString("BR", DRAW_OPT_BITWISE_OR);

  DrawBatteryOnIdleScreen(6, 9, MetaWatch7);

  // Add Wavy line
  gRow += 12;
  CopyRowsIntoMyBuffer(pWavyLine, gRow, NUMBER_OF_ROWS_IN_WAVY_LINE);
  CopyColumnsIntoMyBuffer(pIconWatch, 54, 21, 0, 2); //54, 21, 2, 2);

  /* add the firmware version */
  gColumn = 2;
  gRow = 56;
  gBitColumnMask = BIT2;
  DrawString("SW: ", DRAW_OPT_BITWISE_OR);
  DrawString((char *)VERSION, DRAW_OPT_BITWISE_OR);
  DrawString(" (", DRAW_OPT_BITWISE_OR);
  DrawChar(BUILD[0], DRAW_OPT_BITWISE_OR);
  DrawChar(BUILD[1], DRAW_OPT_BITWISE_OR);
  DrawChar(BUILD[2], DRAW_OPT_BITWISE_OR);
  DrawChar(')', DRAW_OPT_BITWISE_OR);
  
  gColumn = 2;
  gRow = 65;
  gBitColumnMask = BIT2;
  DrawString("HW: REV ", DRAW_OPT_BITWISE_OR);
  DrawChar(GetMsp430HardwareRevision(), DRAW_OPT_BITWISE_OR);

  DrawLocalAddress(1, 80);
  
  SendMyBufferToLcd(STARTING_ROW, LCD_ROW_NUM);
}
コード例 #3
0
ファイル: Menu.c プロジェクト: Rodini/MetaWatch-WDS11x-IAR
void DrawMenu()
{
  const struct menu * const menu = menu_current();
  FillMyBuffer(STARTING_ROW,PHONE_IDLE_BUFFER_ROWS,0x00);
  DrawCommonMenuIcons();
  DrawItem(&(menu->items[0]), BUTTON_ICON_A_F_ROW,LEFT_BUTTON_COLUMN);
  DrawItem(&(menu->items[1]), BUTTON_ICON_B_E_ROW,LEFT_BUTTON_COLUMN);
  DrawItem(&(menu->items[2]), BUTTON_ICON_C_D_ROW,LEFT_BUTTON_COLUMN);
  DrawItem(&(menu->items[3]), BUTTON_ICON_A_F_ROW,RIGHT_BUTTON_COLUMN);
  DrawItem(&(menu->items[4]), BUTTON_ICON_B_E_ROW,RIGHT_BUTTON_COLUMN);

}
コード例 #4
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
void DrawCallScreen(char *pCallerId, char *pCallerName)
{
  FillMyBuffer(STARTING_ROW, LCD_ROW_NUM, 0x00);
  CopyRowsIntoMyBuffer(pCallNotif, CALL_NOTIF_START_ROW, CALL_NOTIF_ROWS);

  SetFont(MetaWatch16);
  gRow = 5;
  gColumn = 0;
  gBitColumnMask = BIT6;
  DrawString("Call from:", DRAW_OPT_BITWISE_OR);

  SetFont(MetaWatch7);
  gRow = 58;
  gColumn = 0;
  gBitColumnMask = BIT6;
  DrawString(pCallerId, DRAW_OPT_BITWISE_OR);

  SetFont(MetaWatch16);
  gRow = 24;
  gColumn = 0;
  gBitColumnMask = BIT6;

  unsigned char i = 0;
  while (pCallerName[i] != NUL && pCallerName[i] != SPACE) i ++;
  if (pCallerName[i] == SPACE) pCallerName[i] = NUL;
  else i = 0;

  DrawString(pCallerName, DRAW_OPT_BITWISE_OR);

  if (i)
  {
    gRow = 40;
    gColumn = 0;
    gBitColumnMask = BIT6;
    DrawString(&pCallerName[i + 1], DRAW_OPT_BITWISE_OR);
  }

  // write timestamp
  SetFont(MetaWatch5);
  gRow = 86;
  gColumn = 7;
  gBitColumnMask = BIT6;
  DrawHours(DRAW_OPT_BITWISE_NOT);
  DrawMins(DRAW_OPT_BITWISE_NOT);
  if (!GetProperty(PROP_24H_TIME_FORMAT)) DrawString((RTCHOUR > 11) ? "PM" : "AM", DRAW_OPT_BITWISE_NOT);

  SendMyBufferToLcd(STARTING_ROW, LCD_ROW_NUM);    
}
コード例 #5
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
void DrawMenu(eIdleModePage Page)
{
  /* clear entire region */
  FillMyBuffer(STARTING_ROW, LCD_ROW_NUM, 0x00);

  switch (Page)
  {
  case Menu1Page: DrawMenu1(); break;
  case Menu2Page: DrawMenu2(); break;
  case Menu3Page: DrawMenu3(); break;
  default: PrintF("# No Such Menu Page:%d", Page); break;
  }

  /* these icons are common to all menus */
  DrawCommonMenuIcons();
  SendMyBufferToLcd(STARTING_ROW, LCD_ROW_NUM);
}
コード例 #6
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
/*! Display the startup image or Splash Screen */
void DrawSplashScreen(void)
{
//  ClearLcd();
  // clear LCD buffer
  FillMyBuffer(0, LCD_ROW_NUM, 0x00);

#if COUNTDOWN_TIMER
  DrawWwzSplashScreen();
#else
  /* draw metawatch logo */
  CopyColumnsIntoMyBuffer(pIconSplashLogo, 21, 13, 3, 6);
  CopyRowsIntoMyBuffer(pIconSplashMetaWatch, SPLASH_START_ROW, 12);
  CopyColumnsIntoMyBuffer(pIconSplashHandsFree, 58, 5, 2, 8);
//  SendMyBufferToLcd(21, 42); // 58 + 5 - 21
#endif

  SendMyBufferToLcd(0, LCD_ROW_NUM);
}
コード例 #7
0
int IdlePageQrCodeInit()
{
	StopAllDisplayTimers();
	if(timerid == -1)
	{
		timerid = AllocateOneSecondTimer();
		if (timerid < 0)
		{
			// How do we report errors
		}
		SetupOneSecondTimer(timerid, 1, REPEAT_FOREVER, BarCode, QRTIMER_TIMER);
		StartOneSecondTimer(timerid);
	}
	FillMyBuffer(STARTING_ROW, NUM_LCD_ROWS, 0x00);


	return 0;
}
コード例 #8
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
void DrawBootloaderScreen(void)
{
#if BOOTLOADER
  FillMyBuffer(STARTING_ROW, LCD_ROW_NUM, 0x00);
  CopyRowsIntoMyBuffer(pBootloader, BOOTLOADER_START_ROW, BOOTLOADER_ROWS);
  
  // Draw version
  SetFont(MetaWatch5);
  gRow = 61;
  gColumn = 4;
  gBitColumnMask = BIT3;
  DrawString("V ", DRAW_OPT_BITWISE_OR);
  DrawString((char const *)VERSION, DRAW_OPT_BITWISE_OR);

  unsigned char i = 0;
  char const *pBootVer = BootVersion;

  PrintF("BL_VER addr:%04X", pBootVer);
  for (; i < 8; ++i) {PrintH(pBootVer[i]); PrintC(SPACE);}
  i = 0;

  while (*pBootVer && i++ < 8)
  {
    if ((*pBootVer < ZERO || *pBootVer > '9') && *pBootVer != '.') break;
    pBootVer ++;
  }
  
  if (i > 4) // at least x.x.x
  {
    gRow += 7;
    gColumn = 4;
    gBitColumnMask = BIT3;
    DrawString("B ", DRAW_OPT_BITWISE_OR);
    DrawString(BootVersion, DRAW_OPT_BITWISE_OR);
  }

  DrawLocalAddress(1, 80);
  
  SendMyBufferToLcd(STARTING_ROW, LCD_ROW_NUM);
#endif
}
コード例 #9
0
void DrawScreen()
{
	FillMyBuffer(STARTING_ROW, NUM_LCD_ROWS, 0x00);
	CopyColumnsIntoMyBuffer(pInvader,
				                ypos,
		                        8,
		                        0,
								1);
	int i;
	int col = 0;
	for(col = 0; col < 4; ++col)
	{
		for(i = 0; i < 8; ++i)
		{
			CopyColumnsIntoMyBuffer(pAlien,
				                	16+(i*8),
				                	8,
				                	4+col,
				                	1);
		}
	}
}
コード例 #10
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
void DrawConnectionScreen(void)
{
  const unsigned char *pSwash;

  if (!RadioOn()) pSwash = pBootPageBluetoothOffSwash;
  else if (ValidAuthInfo()) pSwash = pBootPagePairedSwash;
  else pSwash = pBootPageNoPairSwash;
  
  FillMyBuffer(WATCH_DRAW_SCREEN_ROW_NUM, PHONE_DRAW_SCREEN_ROW_NUM, 0x00);
  CopyRowsIntoMyBuffer(pSwash, WATCH_DRAW_SCREEN_ROW_NUM + 1, 32);

  /* add the firmware version */
  gRow = 68;
  gColumn = 4;
  gBitColumnMask = BIT0;
  SetFont(MetaWatch5);
  DrawString("V ", DRAW_OPT_BITWISE_OR);
  DrawString((char *)VERSION, DRAW_OPT_BITWISE_OR);

  DrawLocalAddress(1, 80);
  
  SendMyBufferToLcd(WATCH_DRAW_SCREEN_ROW_NUM, PHONE_DRAW_SCREEN_ROW_NUM);
}
コード例 #11
0
ファイル: LcdBuffer.c プロジェクト: lwalkera/MetaWatch-Gen2
void DrawDateTime(void)
{
  // clean date&time area
  FillMyBuffer(STARTING_ROW, WATCH_DRAW_SCREEN_ROW_NUM, 0x00);

  SetFont(DEFAULT_HOURS_FONT);  
  gRow = DEFAULT_HOURS_ROW;
  gColumn = DEFAULT_HOURS_COL;
  gBitColumnMask = DEFAULT_HOURS_COL_BIT;
  DrawHours(DRAW_OPT_BITWISE_OR);

  gRow = DEFAULT_MINS_ROW;
  gColumn = DEFAULT_MINS_COL;
  gBitColumnMask = DEFAULT_MINS_COL_BIT;
  DrawMins(DRAW_OPT_BITWISE_OR);
  
  if (GetProperty(PROP_TIME_SECOND)) DrawSecs();
  else if (Charging()) DrawBatteryOnIdleScreen(3, 9, MetaWatch5);
  else
  {
    if (!GetProperty(PROP_24H_TIME_FORMAT))
    {
      gRow = DEFAULT_AM_PM_ROW;
      gColumn = DEFAULT_AM_PM_COL;
      gBitColumnMask = DEFAULT_AM_PM_COL_BIT;
      SetFont(DEFAULT_AM_PM_FONT);
      DrawString((RTCHOUR > 11) ? "PM" : "AM", DRAW_OPT_BITWISE_OR);
    }

    gRow = GetProperty(PROP_24H_TIME_FORMAT) ? DEFAULT_DOW_24HR_ROW : DEFAULT_DOW_12HR_ROW;
    gColumn = DEFAULT_DOW_COL;
    gBitColumnMask = DEFAULT_DOW_COL_BIT;
    SetFont(DEFAULT_DOW_FONT);
    DrawString((tString *)DaysOfTheWeek[LANG_EN][RTCDOW], DRAW_OPT_BITWISE_OR);

    //add year when time is in 24 hour mode
    if (GetProperty(PROP_24H_TIME_FORMAT))
    {
      gRow = DEFAULT_DATE_YEAR_ROW;
      gColumn = DEFAULT_DATE_YEAR_COL;
      gBitColumnMask = DEFAULT_DATE_YEAR_COL_BIT;
      SetFont(DEFAULT_DATE_YEAR_FONT);

      unsigned char Year = RTCYEARH;
      DrawChar(BCD_H(Year) + ZERO, DRAW_OPT_BITWISE_OR);
      DrawChar(BCD_L(Year) + ZERO, DRAW_OPT_BITWISE_OR);
      Year = RTCYEARL;
      DrawChar(BCD_H(Year) + ZERO, DRAW_OPT_BITWISE_OR);
      DrawChar(BCD_L(Year) + ZERO, DRAW_OPT_BITWISE_OR);
    }

    //Display month and day
    //Watch controls time - use default date position
    unsigned char DayFirst = GetProperty(PROP_DDMM_DATE_FORMAT);
    char Rtc[2];
    Rtc[DayFirst ? 0 : 1] = RTCDAY;
    Rtc[DayFirst ? 1 : 0] = RTCMON;

    gRow = DEFAULT_DATE_FIRST_ROW;
    gColumn = DEFAULT_DATE_FIRST_COL;
    gBitColumnMask = DEFAULT_DATE_FIRST_COL_BIT;
    SetFont(DEFAULT_DATE_MONTH_FONT);
    
    DrawChar(BCD_H(Rtc[0]) + ZERO, DRAW_OPT_BITWISE_OR);
    DrawChar(BCD_L(Rtc[0]) + ZERO, DRAW_OPT_BITWISE_OR);
    
    //Display separator
    SetFont(DEFAULT_DATE_SEPARATOR_FONT);
    DrawChar(DayFirst ? '.' : '/', DRAW_OPT_BITWISE_OR);
    
    //Display day second
    gRow = DEFAULT_DATE_SECOND_ROW;
    gColumn = DEFAULT_DATE_SECOND_COL;
    gBitColumnMask = DEFAULT_DATE_SECOND_COL_BIT;
    SetFont(DEFAULT_DATE_DAY_FONT);
    
    DrawChar(BCD_H(Rtc[1]) + ZERO, DRAW_OPT_BITWISE_OR);
    DrawChar(BCD_L(Rtc[1]) + ZERO, DRAW_OPT_BITWISE_OR);
  }
  
  SendMyBufferToLcd(STARTING_ROW, WATCH_DRAW_SCREEN_ROW_NUM);
}