Esempio n. 1
0
/***************************************************************************//**
  OLED_write_data()
  See "oled.h" for details of how to use this function.
 */
void OLED_write_data(struct oled_data* data, oled_no_of_line LINES)
{
    uint8_t line;
    uint8_t char_offset;
    char *string;

    switch(LINES)
    {

        case FIRST_LINE:
        {
            OLED_clear_display(FIRST_LINE);
            line = data->line1;
            char_offset = data->char_offset1;
            string = data->string1;
        }

        case SECOND_LINE:
        {
            OLED_clear_display(SECOND_LINE);
            line = data->line2;
            char_offset = data->char_offset2;
           string = data->string2;
        }

        case BOTH_LINES:
        {
            OLED_clear_display(BOTH_LINES);
            line = data->line1;
            char_offset = data->char_offset1;
            string = data->string1;
            OLED_set_cursor(line,char_offset);
            OLED_write_string(string);
            line = data->line2;
            char_offset = data->char_offset2;
            string = data->string2;
        }

        OLED_set_cursor(line,char_offset);
        OLED_write_string(string);
        OLED_contrast(data->contrast_val);
    }
}
Esempio n. 2
0
void OLED_write_align_center(uint8_t x, uint8_t y, char *str) {
	
	//Guards
	x %= COLUMNS;
	y %= PAGES;
	
	uint8_t offset = strlen(str)*4;
	
	OLED_set_pages(y,y);
	OLED_set_columns(x-offset,127);
	OLED_write_string(str);
}