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); if (PairedDeviceType() == DEVICE_TYPE_SPP) { DrawString(Connected(CONN_TYPE_SPP) && QuerySniffState() == Active ? "ACT" : "BR", DRAW_OPT_BITWISE_OR); } #if SUPPORT_BLE else if (PairedDeviceType() == DEVICE_TYPE_BLE) { DrawString(Connected(CONN_TYPE_BLE) && CurrentInterval(INTERVAL_STATE) == SHORT ? "ACT" : (Connected(CONN_TYPE_HFP) && Connected(CONN_TYPE_MAP) ? "DUO" : "BLE"), DRAW_OPT_BITWISE_OR); } #endif 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); }
void HandleAccelerometer(tMessage *pMsg) { if (Control == INIT_MODE) InitAccelerometer(); switch (pMsg->Options) { case MSG_OPT_ACCEL_DATA: if (Connected(CONN_TYPE_SPP) && QuerySniffState() == Active #if SUPPORT_BLE || Connected(CONN_TYPE_BLE) && CurrentInterval(INTERVAL_STATE) == SHORT #endif ) AccelerometerSendDataHandler(); break; case MSG_OPT_ACCEL_ENABLE: if (Connected(CONN_TYPE_BLE)) SendMessage(UpdConnParamMsg, SHORT); else if (Connected(CONN_TYPE_SPP)) SendMessage(SniffControlMsg, MSG_OPT_EXIT_SNIFF); if (pMsg->Length) { ENTER_STANDBY_MODE(); Control &= ~ACCEL_RANGE_MASK; Control |= (*pMsg->pBuffer & 0x03) << ACCEL_RANGE_SHFT; AccelerometerWrite(KIONIX_CTRL_REG1, &Control, ONE_BYTE); } /* enable accelerometer */ ENTER_OPERATING_MODE(); ACCELEROMETER_INT_ENABLE(); break; case MSG_OPT_ACCEL_DISABLE: /* put into low power mode */ ACCELEROMETER_INT_DISABLE(); ENTER_STANDBY_MODE(); if (Connected(CONN_TYPE_BLE)) SendMessage(UpdConnParamMsg, LONG); break; case MSG_OPT_ACCEL_STREAMING: ENTER_STANDBY_MODE(); Control &= ~WUF_ENABLE; Control |= DRDYE_DATA_AVAILABLE; AccelerometerWrite(KIONIX_CTRL_REG1, &Control, ONE_BYTE); ENTER_OPERATING_MODE(); break; case MSG_OPT_ACCEL_WUF: ENTER_STANDBY_MODE(); if (pMsg->Length) AccelerometerWrite(KIONIX_WUF_THRESH, pMsg->pBuffer, ONE_BYTE); Control &= ~DRDYE_DATA_AVAILABLE; Control |= WUF_ENABLE; AccelerometerWrite(KIONIX_CTRL_REG1, &Control, ONE_BYTE); ENTER_OPERATING_MODE(); break; default: break; } }