Пример #1
0
void DisplayModule::SetTime(uint32_t time)
{
  Wire.beginTransmission(display_address);
  // Send the command
  Wire.write(SET_TIME);
  delay(1);
  Debug("SetTime : sending ("); Serial.print(SET_TIME, HEX); Serial.print(") ");
  DebugLn(time, HEX);

  SendValue(&time, sizeof(uint32_t));

  byte et = Wire.endTransmission();
  Debug("endTransmission returns ");
  DebugLn(et);
}
Пример #2
0
void SAC_ClockDisplay::SetTime(int h, int m)
{
  Debug("SetTime(");
  Debug(h); Debug(", "); Debug(m);
  DebugLn(")");
  if (h >= 0 && h < 24 && m >= 0 && m < 60) {
      mHour = h;
      mMinute = m;
      mClockIsSet = true;
    }
}
Пример #3
0
void DisplayModule::SetTemperature(short temperature) {
  Debug(" SET_TEMP: ");
  DebugLn(temperature);
  Wire.beginTransmission(display_address);
  Wire.write(SET_TEMP);
  delay(1);

  SendValue(&temperature, sizeof(short));

  byte et = Wire.endTransmission();
}
Пример #4
0
void DisplayModule::SetBrightness(int brightness) {
  Debug(" SET_BRIGHTNESS: ");
  DebugLn(brightness);
  Wire.beginTransmission(display_address);
  Wire.write(SET_BRIGHTNESS);
  delay(1);

  SendValue(&brightness, sizeof(int));

  byte et = Wire.endTransmission();
}
Пример #5
0
void DisplayModule::SetPressure(long pressure) {
  Debug(" SET_PRESSURE: ");
  DebugLn(pressure);
  Wire.beginTransmission(display_address);
  Wire.write(SET_PRESSURE);
  delay(1);

  SendValue(&pressure, sizeof(long));

  byte et = Wire.endTransmission();
}
Пример #6
0
void DrawCharRect(Vector2 p0, Vector2 p1, int sprite, int flags, Colour colour)
{
	if ((gRectVertCount + 6) > kMaxRectVerts)
	{
		DebugLn("DrawRect overflow");
		return;
	}

	Vertex* v = &gRectVerts[gRectVertCount];

	gRectVertCount += 6;

	int sx = sprite & 0x1F;
	int sy = sprite >> 5;

	Vector2 uv0(sx / 32.0f, sy / 32.0f);
	Vector2 uv1((sx + 1) / 32.0f, (sy + 1) / 32.0f);
	Vector2 scale(2.0f / (float)kWinWidth, -2.0f / (float)kWinHeight);

	if (flags & kFlipX) Swap(uv0.x, uv1.x);
	if (flags & kFlipY) Swap(uv0.y, uv1.y);

	// t0

	v->pos.x	= p0.x * scale.x;
	v->pos.y	= p0.y * scale.y;
	v->uv.x		= uv0.x;
	v->uv.y		= uv0.y;
	v->colour	= colour;
	v++;

	v->pos.x	= p1.x * scale.x;
	v->pos.y	= p0.y * scale.y;
	v->uv.x		= uv1.x;
	v->uv.y		= uv0.y;
	v->colour	= colour;
	v++;

	v->pos.x	= p1.x * scale.x;
	v->pos.y	= p1.y * scale.y;
	v->uv.x		= uv1.x;
	v->uv.y		= uv1.y;
	v->colour	= colour;
	v++;

	// t1

	v->pos.x	= p0.x * scale.x;
	v->pos.y	= p0.y * scale.y;
	v->uv.x		= uv0.x;
	v->uv.y		= uv0.y;
	v->colour	= colour;
	v++;

	v->pos.x	= p1.x * scale.x;
	v->pos.y	= p1.y * scale.y;
	v->uv.x		= uv1.x;
	v->uv.y		= uv1.y;
	v->colour	= colour;
	v++;

	v->pos.x	= p0.x * scale.x;
	v->pos.y	= p1.y * scale.y;
	v->uv.x		= uv0.x;
	v->uv.y		= uv1.y;
	v->colour	= colour;
}