예제 #1
0
int main(int argc, char* argv[])
{
	
	int n;
	 api_io.init(MAX7219_CS, OUT_PUSH_PULL);	//初始化引脚
	 api_io.init(MAX7219_DAT, OUT_PUSH_PULL);
	 api_io.init(MAX7219_CLK, OUT_PUSH_PULL);

	MAX7219_CS_HIGH;	//三个引脚设置为高电平
	MAX7219_CLK_HIGH;
	MAX7219_DAT_HIGH;

	max7219_init();


	u8_t bits[8] = {0x3c, 0x42, 0xa5, 0x81, 0xa5, 0x99, 0x42, 0x3c};	//:-)

	// {0x3c, 0x42, 0x99, 0xa9, 0xa9, 0x9d, 0x42, 0x3c}; //symbol @

	for(n = 0; n < sizeof(bits); n++)
		max7219_write(n+1, bits[n]);	//write to 7219 buf




	LOG_INFO("main: MAX7219 starting...\r\n");


	return ADDON_LOADER_GRANTED;
//err_exit:
//	return ADDON_LOADER_ABORT;
}
void max7219s_init(void) {
	max7219_init();
	scheduler_init();
}