JOSHUA ROCAMORA
Published

Digital Campus Guide: MSU-IIT CCS Edition

Interactive CCS Kiosk built on Renesas RA6M3, RT-Thread & LVGL.

BeginnerShowcase (no instructions)10 hours29
Digital Campus Guide: MSU-IIT CCS Edition

Things used in this project

Hardware components

renesas
×1

Software apps and online services

RT-Thread IoT OS
RT-Thread IoT OS

Story

Read more

Code

game.h

C/C++
#ifndef INC_GAME_H_
#define INC_GAME_H_

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

/* Logic initialization entry point */
void game_logic_init(void);

#endif /* INC_GAME_H_ */

ui.h

C/C++
#ifndef INC_UI_H_
#define INC_UI_H_

#include "lvgl.h"

/* Entry point to create all screens */
void ui_init(void);

/* Global references to screens (optional, useful if you need external access) */
extern lv_obj_t *ui_Screen1;
extern lv_obj_t *ui_Screen2;
extern lv_obj_t *ui_Screen3;
extern lv_obj_t *ui_Screen4;

#endif /* INC_UI_H_ */

game.c

C/C++
#include "game.h"
#include "ui.h"

void game_logic_init(void)
{
    /* * Note: P600 Backlight is handled in main.c as per your context.
     * If you needed to toggle LEDS or handle hardware logic specific
     * to the game state, it would go here.
     */

    /* Initialize the LVGL User Interface */
    ui_init();

    rt_kprintf("Game/App Logic Initialized. UI Started.\n");
}

lvgl-port.c

C/C++
#include "game.h"
#include "ui.h"

void game_logic_init(void)
{
    /* * Note: P600 Backlight is handled in main.c as per your context.
     * If you needed to toggle LEDS or handle hardware logic specific
     * to the game state, it would go here.
     */

    /* Initialize the LVGL User Interface */
    ui_init();

    rt_kprintf("Game/App Logic Initialized. UI Started.\n");
}

main.c

C/C++
/* src/main.c */
#include <rtthread.h>
#include <rtdevice.h>
#include "hal_data.h"
#include <board.h>

/* Define the Backlight Pin (P600) */
#ifndef BSP_IO_PORT_06_PIN_00
#define BACKLIGHT_PIN    BSP_IO_PORT_06_PIN_00
#else
#define BACKLIGHT_PIN    BSP_IO_PORT_06_PIN_00
#endif

int main(void)
{
    /* --- 1. Hardware Initialization --- */

    /* Set the Backlight Pin to Output Mode */
    rt_pin_mode(BACKLIGHT_PIN, PIN_MODE_OUTPUT);

    /* Force the Backlight HIGH to turn on the LCD */
    rt_pin_write(BACKLIGHT_PIN, PIN_HIGH);

    rt_kprintf("System Init: Backlight ON (P600 HIGH)\n");

    /* --- 2. Keep Main Thread Alive --- */
    /* The LVGL logic starts automatically in its own thread because
       we defined lv_user_gui_init in lvgl_port.c */
    while (1)
    {
        rt_thread_mdelay(1000);
    }

    return 0;
}

ui.c

C/C++
/* src/main.c */
#include <rtthread.h>
#include <rtdevice.h>
#include "hal_data.h"
#include <board.h>

/* Define the Backlight Pin (P600) */
#ifndef BSP_IO_PORT_06_PIN_00
#define BACKLIGHT_PIN    BSP_IO_PORT_06_PIN_00
#else
#define BACKLIGHT_PIN    BSP_IO_PORT_06_PIN_00
#endif

int main(void)
{
    /* --- 1. Hardware Initialization --- */

    /* Set the Backlight Pin to Output Mode */
    rt_pin_mode(BACKLIGHT_PIN, PIN_MODE_OUTPUT);

    /* Force the Backlight HIGH to turn on the LCD */
    rt_pin_write(BACKLIGHT_PIN, PIN_HIGH);

    rt_kprintf("System Init: Backlight ON (P600 HIGH)\n");

    /* --- 2. Keep Main Thread Alive --- */
    /* The LVGL logic starts automatically in its own thread because
       we defined lv_user_gui_init in lvgl_port.c */
    while (1)
    {
        rt_thread_mdelay(1000);
    }

    return 0;
}

SConscript

Python
import os
from building import *

cwd = GetCurrentDir()
src = Glob('*.c')

# Add the parent 'inc' folder to the include path
CPPPATH = [cwd, os.path.join(cwd, '../inc')]

group = DefineGroup('Applications', src, depend=[''], CPPPATH=CPPPATH)

Return('group')

Credits

JOSHUA ROCAMORA
1 project • 0 followers

Comments