2024-05-09 05:56:55 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <time.h>
|
2024-09-21 05:18:06 +00:00
|
|
|
#include "t_spi.h"
|
|
|
|
#include "t_iic.h"
|
|
|
|
#include "t_task.h"
|
|
|
|
#include "t_arg.h"
|
|
|
|
#include "t_list.h"
|
|
|
|
#include "t_key.h"
|
|
|
|
#include "t_oled.h"
|
|
|
|
#include "t_lvgl.h"
|
2024-08-29 08:46:54 +00:00
|
|
|
#include "t_tft.h"
|
2024-06-02 04:57:33 +00:00
|
|
|
#include "tool.h"
|
2024-09-21 08:07:31 +00:00
|
|
|
#include "sim_test.h"
|
2024-12-14 15:33:32 +00:00
|
|
|
|
2024-06-22 14:51:58 +00:00
|
|
|
#include <windows.h>
|
2024-06-25 14:09:23 +00:00
|
|
|
#include <stdint.h>
|
2024-09-21 12:43:31 +00:00
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <SDL3/SDL_main.h>
|
2024-06-22 15:06:40 +00:00
|
|
|
|
2024-09-21 12:43:31 +00:00
|
|
|
|
|
|
|
#define POINTS_COUNT 4
|
|
|
|
|
|
|
|
static SDL_Point points[POINTS_COUNT] = {
|
|
|
|
{320, 200},
|
|
|
|
{300, 240},
|
|
|
|
{340, 240},
|
|
|
|
{320, 200}
|
|
|
|
};
|
|
|
|
|
|
|
|
static SDL_Rect bigrect = {0, 0, 540, 380};
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
2024-06-02 04:57:33 +00:00
|
|
|
srand((unsigned) time(NULL));
|
2024-09-21 12:43:31 +00:00
|
|
|
|
|
|
|
|
2024-12-16 15:40:13 +00:00
|
|
|
// SDL_Log("Hello, SDL3!");
|
2024-09-21 12:43:31 +00:00
|
|
|
// int count = SDL_GetNumRenderDrivers();
|
|
|
|
// for (int i = 0; i < count; ++i) {
|
|
|
|
// const char* name = SDL_GetRenderDriver(i);
|
|
|
|
// SDL_Log("Render driver[%d]: %s", i, name);
|
|
|
|
// }
|
|
|
|
// if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
|
|
|
// SDL_Log("SDL_Init failed: %s", SDL_GetError());
|
|
|
|
// return -1;
|
|
|
|
// }
|
|
|
|
// SDL_Window* window = SDL_CreateWindow("Hello, SDL3!", 800, 600, SDL_WINDOW_RESIZABLE);
|
|
|
|
// if (!window) {
|
|
|
|
// SDL_Log("Could not create a window: %s", SDL_GetError());
|
|
|
|
// return -1;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
|
|
|
//
|
|
|
|
// SDL_Renderer* renderer = SDL_CreateRenderer(window, nullptr);
|
|
|
|
// if (!renderer) {
|
|
|
|
// SDL_Log("Create renderer failed: %s", SDL_GetError());
|
|
|
|
// return -1;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// SDL_SetRenderDrawColor(renderer, 16, 0, 16, 255);
|
|
|
|
// SDL_RenderClear(renderer);
|
|
|
|
// SDL_Delay(2000);
|
|
|
|
// SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
|
|
|
// for (int i = 0; i < 100; ++i) {
|
|
|
|
// SDL_RenderPoint(renderer,i,i);
|
|
|
|
// }
|
|
|
|
// if(!SDL_RenderPoints(renderer,points,POINTS_COUNT)){
|
|
|
|
// SDL_Log("Draw Renderer failed: %s", SDL_GetError());
|
|
|
|
// return -1;
|
|
|
|
// }
|
|
|
|
// SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
|
2024-11-27 05:49:34 +00:00
|
|
|
// SDL_FRect rect1 = { 1, 1, 500, 500 };
|
2024-09-21 12:43:31 +00:00
|
|
|
// SDL_RenderFillRect(renderer, &rect1);
|
|
|
|
//
|
|
|
|
// SDL_SetRenderDrawColor(renderer, 255, 0, 0, SDL_ALPHA_OPAQUE);
|
|
|
|
//
|
|
|
|
// SDL_RenderLines(renderer, points, POINTS_COUNT);
|
|
|
|
//
|
2024-11-27 05:49:34 +00:00
|
|
|
// SDL_FRect rect = { 200, 300, 100, 100 };
|
2024-09-21 12:43:31 +00:00
|
|
|
// SDL_RenderRect(renderer, &rect);
|
|
|
|
//
|
|
|
|
// SDL_SetRenderDrawColor(renderer, 0, 255, 255, 255);
|
|
|
|
// SDL_RenderFillRect(renderer, &rect);
|
|
|
|
//
|
|
|
|
// SDL_SetRenderDrawColor(renderer, 0, 0, 255, 255);
|
|
|
|
// SDL_RenderFillRect(renderer, &bigrect);
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// SDL_RenderPresent(renderer);
|
|
|
|
// SDL_Delay(5000);
|
|
|
|
// SDL_Event event;
|
|
|
|
// bool keep_going = true;
|
|
|
|
//
|
|
|
|
// while (keep_going) {
|
|
|
|
// while (SDL_PollEvent(&event)) {
|
|
|
|
// switch (event.type) {
|
|
|
|
// case SDL_EVENT_QUIT: {
|
|
|
|
// keep_going = false;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// case SDL_EVENT_KEY_DOWN: {
|
|
|
|
// keep_going = keep_going && (event.key.key != SDLK_ESCAPE);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//// SDL_Log("Event: %d", event.type);
|
|
|
|
// }
|
|
|
|
// SDL_RenderClear(renderer);
|
|
|
|
// SDL_RenderPresent(renderer);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// SDL_DestroyRenderer(renderer);
|
|
|
|
// SDL_DestroyWindow(window);
|
|
|
|
// SDL_Quit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SIM_SDLInit("TEST1",480,320,2,&sdls[0]);
|
|
|
|
// SIM_SDLInit("TEST2",480,320,1,&sdls[1]);
|
|
|
|
// SIM_SDLInit("TEST3",320,320,1,&sdls[2]);
|
|
|
|
// SIM_Color_t color;
|
|
|
|
// color.full=0xffff0000;
|
|
|
|
// for (int i = 0; i < 3; ++i) {
|
|
|
|
// for (int j = 0; j < 100; ++j) {
|
|
|
|
// SIM_SDL_Color_DrawPiexl(&sdls[i],j,j,color);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// SDL_Event event;
|
|
|
|
// bool keep_going = true;
|
|
|
|
// while (keep_going) {
|
|
|
|
// while (SDL_PollEvent(&event)) {
|
|
|
|
// switch (event.type) {
|
|
|
|
// case SDL_EVENT_QUIT: {
|
|
|
|
// keep_going = false;
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// case SDL_EVENT_KEY_DOWN: {
|
|
|
|
// keep_going = keep_going && (event.key.key != SDLK_ESCAPE);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//// SDL_Log("Event: %d", event.type);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// SIM_SDL_Stop(&sdls[0]);
|
|
|
|
// SIM_SDL_Stop(&sdls[1]);
|
|
|
|
// SIM_SDL_Stop(&sdls[2]);
|
|
|
|
|
2024-06-22 14:51:58 +00:00
|
|
|
// int i = 1;
|
|
|
|
// POUT((++i) + (++i));
|
|
|
|
//
|
|
|
|
// char str[] = "123.456";
|
|
|
|
// float result = Str2Float(str);
|
|
|
|
// printf("Result: %.3f\n", result);
|
2024-09-21 15:07:22 +00:00
|
|
|
// Test_Run("SPI", Test_spi,NULL);
|
|
|
|
// Test_Run("IIC", Test_iic,NULL);
|
|
|
|
// Test_Run("ArgPase", Test_argpase,NULL);
|
|
|
|
// Test_Run("List", Test_List,NULL);
|
2024-09-21 12:43:31 +00:00
|
|
|
// Test_RunTime("Key", Test_Key);
|
|
|
|
// Test_RunTime("Queue", Test_Queue);
|
2024-12-16 15:40:13 +00:00
|
|
|
Test_RunTime("Hash", Test_Hash);
|
2024-12-14 15:33:32 +00:00
|
|
|
// Test_RunTime("Task", Test_task);
|
2024-12-16 15:40:13 +00:00
|
|
|
// Test_RunTime("OLED", Test_OLED);
|
2024-11-27 05:49:34 +00:00
|
|
|
// Test_RunTime("LVGL", Test_lvgl);
|
2024-09-21 15:07:22 +00:00
|
|
|
// Test_RunTime("TFT", Test_tft);
|
2024-05-09 05:56:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|