Exemple #1
0
void AP_SENTRAL::_7186_displayStatusRegisters()
{
	uint8_t buf[4];
	char str[17];
	hal.console->printf("\n------------ Displaying Status Registers -----------\n");
	hal.i2c->readRegisters(SENTRAL_I2C_ADDR, SENTRAL_HOST_STATUS_REG, 3, buf);
	hal.console->printf("Host Status:       %5u, %s\n", buf[0], strBits(&buf[0], sizeof(buf[0]), str));
	hal.console->printf("Interrupt Status:  %5u, %s\n", buf[1], strBits(&buf[1], sizeof(buf[0]), str));
	hal.console->printf("Chip Status:       %5u, %s\n", buf[2], strBits(&buf[2], sizeof(buf[0]), str));
	hal.i2c->readRegisters(SENTRAL_I2C_ADDR, SENTRAL_ERR_REG, 4, buf);
	hal.console->printf("Error Register:    %5u, %s\n", buf[0], strBits(&buf[0], sizeof(buf[0]), str));
	hal.console->printf("Interrupt State:   %5u, %s\n", buf[1], strBits(&buf[1], sizeof(buf[0]), str));
	hal.console->printf("Debug Value:       %5u, %s\n", buf[2], strBits(&buf[2], sizeof(buf[0]), str));
	hal.console->printf("Debug State:       %5u, %s\n", buf[3], strBits(&buf[3], sizeof(buf[0]), str));
	hal.i2c->readRegisters(SENTRAL_I2C_ADDR, SENTRAL_BYTES_REMANING_REG, 2, buf);
	uint16_t* v = (uint16_t*)&buf;
	hal.console->printf("Bytes Remaining:   %5u, %s\n\n", v[0], strBits(&v[0], sizeof(v[0]), str));
}
Exemple #2
0
					}

					str[strIdx] = character.character;
					strIdx++;
				}
			}

			if (strIdx > 0)
			{
				// reset
				str[strIdx] = L'\0';

				strIdx = 0;

				// convert to a wstring manually and trim off any trailing spaces (as they make font-renderer sad)
				fwWString strBits(str);
				strBits.erase(strBits.find_last_not_of(' ') + 1);

				// write!
				CRect frontRect((strStart * 16.0f) + 8.0f, y + 8.0f, GetScreenResolutionX() - 8.0f, y + 8.0f);

				TheFonts->DrawText(strBits, frontRect, frontColor, 16.0f, 1.0f, "Lucida Console");
			}
		}

		int cx, cy;
		ConHost_GetCursorPos(cx, cy);

		CRect cursorRect(cx * stringRect.Width() + 8.0f, cy * 16.0f + 14.0f + 8.0f, cx * stringRect.Width() + stringRect.Width() + 8.0f, cy * 16.0f + 16.0f + 8.0f);

		TheFonts->DrawRectangle(cursorRect, CRGBA(255, 255, 255));