You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.4 KiB

#include "main.h"
#include "system_func.h"
#include "struct.h"
#include "sw_timer.h"
#include "app_gpio_led.h"
#include "app_gpio_i2c.h"
#include "app_uart.h"
#include "ssd1306.h"
void Test_Process(void)
{
static uint32_t count = 0;
uint8_t temp[100];
SSD1306_SetPosition (7, 1); // set position
sprintf(temp, "count = %d", count++);
SSD1306_DrawString (temp); // draw string
SSD1306_UpdateScreen (SSD1306_ADDR); // update
//printf("12345678\r\n");
}
int main(void)
{
uint8_t i;
ICC_Enable();
SystemCoreClockSet(HIRC_96MHZ);
App_Uart_Initialization();
App_Gpio_I2C_Initialization(200000);
App_Led_Initialization();
__enable_irq();
App_Led_OutputSet(APP_LED_1, APP_LED_MODE_TOGGLE, 100, 100);
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 100,Test_Process );
if(SSD1306_Init(SSD1306_ADDR) != SSD1306_SUCCESS)
{
printf("ssd1306 init fail\r\n");
}
else
{
SSD1306_NormalScreen (SSD1306_ADDR);
SSD1306_ClearScreen (); // clear screen
SSD1306_DrawLine (0, MAX_X, 4, 4); // draw line
SSD1306_SetPosition (7, 1); // set position
SSD1306_DrawString ("SSD1306 OLED DRIVER"); // draw string
SSD1306_DrawLine (0, MAX_X, 18, 18); // draw line
SSD1306_SetPosition (40, 3); // set position
SSD1306_DrawString ("MATIASUS"); // draw string
//SSD1306_SetPosition (53, 5); // set position
//SSD1306_DrawString ("2021"); // draw string
SSD1306_UpdateScreen (SSD1306_ADDR); // update
Delay_ms (1000);
SSD1306_InverseScreen (SSD1306_ADDR);
Delay_ms (1000);
SSD1306_NormalScreen (SSD1306_ADDR);
#if 0
Delay_ms (1000);
SSD1306_InverseScreen (SSD1306_ADDR);
Delay_ms (1000);
SSD1306_NormalScreen (SSD1306_ADDR);
Delay_ms (1000);
SSD1306_InverseScreen (SSD1306_ADDR);
Delay_ms (1000);
SSD1306_NormalScreen (SSD1306_ADDR);
#endif
}
while(1)
{
SW_Timer_Callback_Process();
}
return 0;
}