Beispiel #1
0
int main(void)
{

	WyzBeeGpio_Init(10, GPIO_INPUT, GPIO_LOW);
	WyzBeeGpio_Init(GPIO_1, GPIO_OUTPUT, GPIO_LOW);
	
	while(1)
	{
		WyzBeeGpio_Put(GPIO_1, WyzBeeGpio_Get(10));
		delay(100);
	}
}
Beispiel #2
0
void Adafruit_SSD1351::writeCommand(uint8_t c)
{

	WyzBeeGpio_Put(GPIO_PWM2,GPIO_LOW);//DC
	spiwrite(c);
}
Beispiel #3
0
void Adafruit_SSD1351::writeData(uint8_t c)
{
	WyzBeeGpio_Put(GPIO_PWM2,GPIO_HIGH); //DC
	spiwrite(c);
}
Beispiel #4
0
void Adafruit_SSD1351::begin(void) {


	WyzBeeGpio_InitOut(GPIO_PWM2,GPIO_HIGH); //DC
	FM4_GPIO->ADE=0;
	WyzBeeGpio_Put(GPIO_SPI2CS,GPIO_LOW);// P53 	CS LOW
	WyzBeeGpio_Init(GPIO_PWM1,GPIO_OUTPUT,GPIO_HIGH);//P41 reset
	WyzBeeGpio_Put(GPIO_PWM1,GPIO_HIGH);
	delay(500);
	WyzBeeGpio_Put(GPIO_PWM1,GPIO_LOW);
	delay(500);
	WyzBeeGpio_Put(GPIO_PWM1,GPIO_HIGH);
	delay(500);


	// Initialization Sequence
	writeCommand(SSD1351_CMD_COMMANDLOCK);  // set command lock
	writeData(0x12);
	writeCommand(SSD1351_CMD_COMMANDLOCK);  // set command lock
	writeData(0xB1);

	writeCommand(SSD1351_CMD_DISPLAYOFF);  		// 0xAE

	writeCommand(SSD1351_CMD_CLOCKDIV);  		// 0xB3
	writeCommand(0xF1);  						// 7:4 = Oscillator Frequency, 3:0 = CLK Div Ratio (A[3:0]+1 = 1..16)

	writeCommand(SSD1351_CMD_MUXRATIO);
	writeData(127);

	writeCommand(SSD1351_CMD_SETREMAP);
	writeData(0x74);

	writeCommand(SSD1351_CMD_SETCOLUMN);
	writeData(0x00);
	writeData(0x7F);
	writeCommand(SSD1351_CMD_SETROW);
	writeData(0x00);
	writeData(0x7F);

	writeCommand(SSD1351_CMD_STARTLINE); 		// 0xA1
	if (SSD1351HEIGHT == 96)
	{
		writeData(96);
	}
	else
	{
		writeData(0);
	}

	writeCommand(SSD1351_CMD_DISPLAYOFFSET); 	// 0xA2
	writeData(0x0);

	writeCommand(SSD1351_CMD_SETGPIO);
	writeData(0x00);

	writeCommand(SSD1351_CMD_FUNCTIONSELECT);
	writeData(0x01); // internal (diode drop)
	writeCommand(SSD1351_CMD_PRECHARGE);  		// 0xB1
	writeCommand(0x32);

	writeCommand(SSD1351_CMD_VCOMH);  			// 0xBE
	writeCommand(0x05);

	writeCommand(SSD1351_CMD_NORMALDISPLAY);  	// 0xA6

	writeCommand(SSD1351_CMD_CONTRASTABC);
	writeData(0xC8);
	writeData(0x80);
	writeData(0xC8);

	writeCommand(SSD1351_CMD_CONTRASTMASTER);
	writeData(0x0F);

	writeCommand(SSD1351_CMD_SETVSL );
	writeData(0xA0);
	writeData(0xB5);
	writeData(0x55);

	writeCommand(SSD1351_CMD_PRECHARGE2);
	writeData(0x01);

	writeCommand(SSD1351_CMD_DISPLAYON);		//--turn on oled panel
}