lib/ssd1306.cpp
/* The default init code.  99% of the time you will use
 * this if you aren't doing anything particuarly crazy.
 */
The default init code.  99% of the time you will use
this if you aren't doing anything particuarly crazy.
The default init code . 99% of the time you will use this if you aren ' t doing anything particuarly crazy .
void SSD1306::default_init(enum ssd1306_screen_type type,
			   enum ssd1306_vccstate vs,
			   enum ssd1306_addr_mode mode)
{
	uint8_t compins, cont, height, width;
	switch (type) {
		case ssd1306_128_32:
			compins = 0x02;
			cont = 0x8F;
			height = 32;
			width = 128;
			break;
		case ssd1306_128_64:
			compins = 0x12;
			cont = vs ?  0xCF : 0x9F;
			height = 64;
			width = 128;
			break;
		case ssd1306_96_16:
			compins = 0x02;
			cont = vs ? 0xAF : 0x10;
			height = 16;
			width = 96;
			break;
	}
	display_power(0);
	multiplex(height - 1);
	display_offset(0);
	start_line(0);
	segment_remap(1);
	com_scan_dir(0);
	pins(compins);
	contrast(cont);
	display_clock_div(0x80);
	charge_pump(vs);
	memory_mode(mode);
	if (mode == ssd1306_page_a) {
	} else {
	}
	precharge(vs ? 0xF1 : 0x22);
	vcom_deselect(0x40);
	display_all_on(1);
	display_invert(0);
	stop_scroll();
	fade(SSD1306_DISABLE_FADE);
	zoom(0);
	display_power(1);
}
void SSD1306 :: default_init ( enum ssd1306_screen_type type , enum ssd1306_vccstate vs , enum ssd1306_addr_mode mode ) { uint8_t compins , cont , height , width ; switch ( type ) { case ssd1306_128_32 : compins = 0x02 ; cont = 0x8F ; height = 32 ; width = 128 ; break ; case ssd1306_128_64 : compins = 0x12 ; cont = vs ? 0xCF : 0x9F ; height = 64 ; width = 128 ; break ; case ssd1306_96_16 : compins = 0x02 ; cont = vs ? 0xAF : 0x10 ; height = 16 ; width = 96 ; break ; } display_power ( 0 ) ; multiplex ( height - 1 ) ; display_offset ( 0 ) ; start_line ( 0 ) ; segment_remap ( 1 ) ; com_scan_dir ( 0 ) ; pins ( compins ) ; contrast ( cont ) ; display_clock_div ( 0x80 ) ; charge_pump ( vs ) ; memory_mode ( mode ) ; if ( mode == ssd1306_page_a ) { } else { } precharge ( vs ? 0xF1 : 0x22 ) ; vcom_deselect ( 0x40 ) ; display_all_on ( 1 ) ; display_invert ( 0 ) ; stop_scroll ( ) ; fade ( SSD1306_DISABLE_FADE ) ; zoom ( 0 ) ; display_power ( 1 ) ; }
The default init code.
The default init code .
//TODO: set higher column start addr //TODO: set page start addr //TODO: set column addr //TODO: set page addr