Exemple #1
0
void displaySettings() {
	char mode_buf[32];
	snprintf(mode_buf, sizeof(mode_buf), "%s", "settings");

	/* TODO : Settings display
	 * We display all settings lines, highlighting the active row 
	 * Static display of settings, bitmapLine under active row
	 * 0,0  mode buffer
	 * 0,12 tcr buffer
	 * 0,24 flip buffer
	 * 0,36 
	 * Line at 0,(currentSetting * 13)
	 * */
	char item1[32];
	char item2[32];
	char item3[32];
	char item4[32];

	double tcr = ctx.settings.tcrValue * 100000;
	int cleanTCR = (int)tcr;
	snprintf(item1, sizeof(item1), "%s: %d", "TCR", cleanTCR);
	snprintf(item2, sizeof(item2), "%d", ctx.atomizer.resistance);

	int pos = ctx.settings.setPos * 12 + 10;

	Display_Clear();
	Display_PutText(0, 0, mode_buf, FONT_DEJAVU_8PT);
	Display_PutText(0, 12, item1, FONT_DEJAVU_8PT);
	Display_PutText(0, 24, item2, FONT_DEJAVU_8PT);
	Display_PutPixels(0, pos, bitmapLine, bitmapLineWidth, bitmapLineHeight);
	Display_Update();
}
Exemple #2
0
void tempDisplay(uint8_t atomizerOn) {
    char buff[9];
    if (atomizerOn) {
        printNumber(buff, CToDisplay(g.curTemp));
    } else {
        printNumber(buff, s.displayTemperature);
    }
    Display_PutText(0, 5, buff, FONT_LARGE);
    getString(buff, (char *) tempScaleType[s.tempScaleTypeIndex].display);
    Display_PutText(48, 2, buff, FONT_SMALL);

    // Material
    getString(buff, vapeMaterialList[s.materialIndex].name);
    Display_PutText(48, 15, buff, FONT_SMALL);
}
Exemple #3
0
int main() {
	int i;

	// The virtual COM port is not initialized by default.
	// To initialize it, follow those steps:
	// 1) Unlock system control registers.
	SYS_UnlockReg();
	// 2) Initialize the virtual COM port.
	USB_VirtualCOM_Init();
	// 3) Lock system control registers.
	SYS_LockReg();

	// Display some text, just to know it's working
	Display_PutText(0, 0, "USB OK.", FONT_DEJAVU_8PT);
	Display_Update();

	while(1) {
		// Send string over the virtual COM port
		USB_VirtualCOM_SendString("Hello, USB!\r\n");

		// Wait 3 seconds
		for(i=0;i<30;i++) {
			Timer_DelayUs(100000);
		}
	}
}
void buildRow(uint8_t y, uint8_t* icon, void (*parsingCallback)(char* buff, int32_t value), uint32_t value) {
    char buff[9];
    Display_PutPixels(0, y, icon, 24, 24);

    parsingCallback(buff, value);
    Display_PutText(26, y+5, buff, FONT_MEDIUM);
}
Exemple #5
0
int main() {
	// Blit text
	Display_PutText(8, 56, "Hello,\nWorld.", FONT_DEJAVU_8PT);

	// Update display
	Display_Update();
}
Exemple #6
0
void displayVW() {
	char mode_buf[3];
	char out_buf[5];
	char bat_buf[5];
	
	snprintf(mode_buf, sizeof(mode_buf), "%s", "vw");
	snprintf(out_buf, sizeof(out_buf), "%dw", ctx.settings.tW/1000);
	snprintf(bat_buf, sizeof(bat_buf), "%d%%", ctx.battery.percent);
	
	Display_Clear();
	Display_PutPixels(4, 2, bitmapBottle, bitmapBottleWidth, bitmapBottleHeight);
	Display_PutText(24, 0, mode_buf, FONT_DEJAVU_8PT);
	Display_PutPixels(0, 112, bitmapLine, bitmapLineWidth, bitmapLineHeight);
	Display_PutText(0, 116, out_buf, FONT_DEJAVU_8PT);
	Display_PutText(32, 116, bat_buf, FONT_DEJAVU_8PT);
	Display_Update();
}
Exemple #7
0
void displayFiring() {
	char temp_buf[12];
	char out_buf[5];
	snprintf(temp_buf, sizeof(temp_buf), "%dc", (int)ctx.coil.temp);
	snprintf(out_buf, sizeof(out_buf), "%dw",
			(ctx.atomizer.voltage * ctx.atomizer.current) / 1000000);

	Display_Clear();

	int lines;
	lines = numLines();
	for(int i = 0; i < lines; i += 2) {
		Display_PutPixels(0, i, bitmapLine, bitmapLineWidth, bitmapLineHeight);
	}

	Display_PutPixels(0, 112, bitmapLine, bitmapLineWidth, bitmapLineHeight);
	Display_PutText(0, 116, temp_buf, FONT_DEJAVU_8PT);
	Display_PutText(32, 116, out_buf, FONT_DEJAVU_8PT);
	Display_Update();
}
Exemple #8
0
void tempBottomDisplay(uint8_t atomizerOn) {
    char buff[9];
    Display_PutPixels(0, 100, watts, watts_width, watts_height);

    if (atomizerOn) {
        getFloating(buff, g.watts);
    } else {
        getFloating(buff, s.initWatts);
    }
    Display_PutText(26, 105, buff, FONT_MEDIUM);
}
Exemple #9
0
int main() {
	int hwVerMajor, hwVerMinor;
	char buffer[100];

	// Separate major/minor version
	hwVerMajor = Dataflash_info.hwVersion / 100;
	hwVerMinor = Dataflash_info.hwVersion % 100;

	// Build and blit text
	siprintf(buffer, "Hw: %d.%02d\n%s\nFlip: %d\nBoot: %s",
		hwVerMajor, hwVerMinor,
		Display_GetType() == DISPLAY_SSD1327 ? "SSD1327" : "SSD1306",
		Display_IsFlipped(),
		Dataflash_info.bootFlag == DATAFLASH_BOOTFLAG_LDROM ? "LD" : "AP");
	Display_PutText(0, 0, buffer, FONT_DEJAVU_8PT);

	// Update display
	Display_Update();
}
Exemple #10
0
int main() {
	uint8_t state;
	char buf[100];

	while(1) {
		// Build state report
		state = Button_GetState();
		sprintf(buf, "Mask: %02X\n\nFire: %d\nRight: %d\nLeft: %d",
			state,
			(state & BUTTON_MASK_FIRE) ? 1 : 0,
			(state & BUTTON_MASK_RIGHT) ? 1 : 0,
			(state & BUTTON_MASK_LEFT) ? 1 : 0);

		// Clear and blit text
		Display_Clear();
		Display_PutText(0, 0, buf, FONT_DEJAVU_8PT);
		Display_Update();
	}
}