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.

146 lines
3.5 KiB

5 months ago
#include "main.h"
#include "system_func.h"
#include "struct.h"
#include "sw_timer.h"
5 months ago
#include "app_gpio_led.h"
#include "app_gpio_i2c.h"
#include "app_i2c_master.h"
#include "app_uart.h"
#include "ssd1306.h"
#include "ak9757w.h"
#include "app_log.h"
#include "app_cli.h"
void Test_Process(void)
{
//AK9757_Check_ChipID();
//dbg_printf(LOG_LEVEL_DEBUG, "timer test\r\n");
}
5 months ago
#if 0
void App_Gpio_I2C_Initialization(uint32_t Frequency);
void App_Gpio_I2C_Start(void);
bool App_Gpio_I2C_WriteData(uint8_t TxData);
bool App_Gpio_I2C_ReadData(uint8_t* pRxData, bool isAck);
void App_Gpio_I2C_Stop(void);
bool App_Gpio_I2C_Write(uint8_t Address, uint8_t* pWriteData, uint32_t TxSize);
bool App_Gpio_I2C_Read(uint8_t Address, uint8_t* pReadData, uint32_t RxSize);
#endif
5 months ago
int main(void)
{
uint8_t i;
bool isAck;
5 months ago
ICC_Enable();
SystemCoreClockSet(HIRC_96MHZ);
App_Uart_Initialization();
App_Gpio_I2C_Initialization(100000);
I2C_Master_Initialization(TEMP_I2C_INSTANCE, I2C_FAST_MODE);
App_Led_Initialization();
App_CLI_Initialization();
5 months ago
__enable_irq();
App_Led_OutputSet(APP_LED_1, APP_LED_MODE_TOGGLE, 100, 900);
SW_Timer_Callback_Register(SW_TIMER_RUN_CONTINUE, 1000,Test_Process );
5 months ago
#if 0
if(SSD1306_Init(SSD1306_ADDR) != SSD1306_SUCCESS)
5 months ago
{
printf("ssd1306 init fail\r\n");
}
else
{
uint8_t i;
SSD1306_NormalScreen (SSD1306_ADDR);
SSD1306_ClearScreen ();
SSD1306_DrawBackGround_Log();
SSD1306_UpdateScreen (SSD1306_ADDR);
Delay_ms(1500);
SSD1306_InverseScreen (SSD1306_ADDR);
Delay_ms(1500);
SSD1306_NormalScreen (SSD1306_ADDR);
for(i = 0 ; i < 128 ; i++)
{
SSD1306_DrawBackGround_LeftShift(1);
if(i % 2 == 0)
{
SSD1306_UpdateScreen (SSD1306_ADDR);
}
//Delay_ms(10);
}
SSD1306_DrawBackGround();
SSD1306_UpdateScreen (SSD1306_ADDR);
#if 0
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
5 months ago
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
#endif
}
#endif
COMPLETE:
AK9757W_Initialization();
while(1)
{
SW_Timer_Callback_Process();
5 months ago
}
return 0;
}