描述
<div>
<p style="line-height:1.8;"><img src="https://image.lceda.cn/oshwhub/pullImage/fc02e3c580fa43f89181be25956d394c.jpg" alt="" width="1200" height="953"></p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">解决电子开发和生活中不同类型插座和电压兼容问题,可以实现8-40伏转5V、3.3V、1.8V等常用电源,电源输入输出接口包括T插、DC插座、XT90、XT60、XT30、JST插头、2.54杜邦头、USB A插头、type-c插头等,运行时可以实时查看输入输出电压、功率,并统计耗电量。</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">首次公开原创项目。</p>
<p> </p>
<p>个人原创项目,使用GPL3.0协议。</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">使用XL4016进行buck电源转换,使用TPL0401A进行电压调节;TPL0401B进行电流调节;使用0.96寸OLED单色128*64分辨率显示屏,驱动 IC为SSD1306;使用INA226进行输出电压和电流的采样。</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">软件源码:<a href="https://github.com/bitstreamcn/power" target="_blank">GitHub - bitstreamcn/power: 可调电源</a></p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">使用RA4M2开发板,资料参考 https://gitee.com/CoreMaker/RA4M2</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">软件使用e2studio进行开发,使用Azure RTOS和guix组件,用GUIX Studio进行界面编辑,大大降低了界面开发难度。</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">开发板使用的MCU型号是R7FA4M2AD3CFL,瑞萨开发环境中FSP默认不支持guix组件(勾选guix但是编译不通过),参考本项目可以让GUIX在R7FA4M2AD3CFL上使用。</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">配置GUIX步骤:</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">1、在e2 studio创建工程,创建工程的时候选择Azure RTOS</p>
<p style="line-height:1.8;">2、打开FSP配置界面,切换到Components页面,勾选Microsoft->Azure->GUIX->gx;Renesas->TES->all->dave2d</p>
<p style="line-height:1.8;">3、下载<a href="https://github.com/bitstreamcn/power" target="_blank">GitHub - bitstreamcn/power: 可调电源</a>源码,把ra->fsp->inc->instances->gx_port.h文件拷贝到相应的目录ra/fsp/inc/instances/</p>
<p style="line-height:1.8;">4、在微软应用商店下载guix studio</p>
<p style="line-height:1.8;">5、使用guix studio创建项目,导入中文字体,导入的时候要勾选Indlude character set defined by String Table,这样就可以在ui中显示中文了</p>
<p style="line-height:1.8;">6、使用guix studio设计完界面后,使用Generate All Output Files菜单生成c文件,把生成的文件拷贝到工程源码目录下</p>
<p style="line-height:1.8;">7、创建显示驱动函数</p>
<div style="background-color:#ffffff;padding:0px 0px 0px 2px;">
<div style="color:#000000;background-color:#ffffff;font-family:Consolas;font-size:12pt;white-space:pre;">
<pre><code>static void ra4_graphics_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty);
UINT ra4_graphics_driver_setup(GX_DISPLAY *display);
static void ra4_graphics_buffer_toggle(GX_CANVAS *canvas, GX_RECTANGLE *dirty)
{
uint8_t *p;
/* 防止警告 */
(void) canvas;
(void) dirty;
/*获得OLED画布的地址 */
p = (uint8_t*) display_1_canvas_memory;
(void) p;
/*将画布的内容绘制到OLED显存*/
for (u8 y = 0; y > 7);
OLED_PutPixel (x + 1, y, (p[16 * y + x / 8] & (0x40)) >> 6);
OLED_PutPixel (x + 2, y, (p[16 * y + x / 8] & (0x20)) >> 5);
OLED_PutPixel (x + 3, y, (p[16 * y + x / 8] & (0x10)) >> 4);
OLED_PutPixel (x + 4, y, (p[16 * y + x / 8] & (0x08)) >> 3);
OLED_PutPixel (x + 5, y, (p[16 * y + x / 8] & (0x04)) >> 2);
OLED_PutPixel (x + 6, y, (p[16 * y + x / 8] & (0x02)) >> 1);
OLED_PutPixel (x + 7, y, (p[16 * y + x / 8] & (0x01)) >> 0);
}
}
/*将OLED显存的内容实际绘制到OLED*/
OLED_Refresh ();
}
UINT ra4_graphics_driver_setup(GX_DISPLAY *display)
{
_gx_display_driver_monochrome_setup (display, GX_NULL, ra4_graphics_buffer_toggle);
return (GX_SUCCESS);
}</code></pre>
</div>
</div>
<p style="line-height:1.8;">8、在程序的入口处创建窗口,代码如下:</p>
<div style="background-color:#ffffff;padding:0px 0px 0px 2px;">
<div style="color:#000000;background-color:#ffffff;font-family:Consolas;font-size:12pt;white-space:pre;">
<pre><code> /* Initialize GUIX. */
gx_system_initialize ();
UINT ret = gx_studio_display_configure (DISPLAY_1, ra4_graphics_driver_setup, LANGUAGE_CHINESE, DISPLAY_1_THEME_1,
&root_window);
if (ret != GX_SUCCESS)
{
printf ("gx_studio_display_configure fail.\n");
return;
}
/* Create the screen - attached to root window. */
ret = gx_studio_named_widget_create ((char*) "main_window", (GX_WIDGET*) root_window, &main_window_widget);
if (ret != GX_SUCCESS)
{
printf ("gx_studio_named_widget_create fail.\n");
return;
}
/* Show the root window. */
ret = gx_widget_show(root_window);
if (ret != GX_SUCCESS)
{
printf ("gx_widget_show fail.\n");
return;
}
/* let GUIX run! */
ret = gx_system_start ();
if (ret != GX_SUCCESS)
{
printf ("gx_system_start fail.\n");
return;
}</code></pre>
</div>
</div>
<p style="line-height:1.8;">guix开发资料可以参考:</p>
<p style="line-height:1.8;"><span style="background-color:#ffffff;padding:0px 0px 0px 2px;"><span style="color:#000000;background-color:#ffffff;font-family:Consolas;font-size:12pt;white-space:pre;"><span style="color:#3f7f5f;">https://forum.anfulai.cn/forum.php?mod=viewthread&tid=98429</span></span></span></p>
<p style="line-height:1.8;"><span style="background-color:#ffffff;padding:0px 0px 0px 2px;"><span style="color:#000000;background-color:#ffffff;font-family:Consolas;font-size:12pt;white-space:pre;"><span style="color:#3f7f5f;text-decoration:underline;">guix</span><span style="color:#3f7f5f;">文档 https://github.com/eclipse-threadx/rtos-docs</span></span></span></p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">板子可以单独使用,作为不同插头进行连接的工具</p>
<p style="line-height:1.8;"><img src="//image.lceda.cn/pullimage/cdwd4t8dJ06lnZJiCZAcy1VpcBnVSei0GxzrY2I2.jpeg" alt="" width="1200" height="1200"></p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">也可以和控制板焊在一起,实现可调电源</p>
<p style="line-height:1.8;"><img src="//image.lceda.cn/pullimage/y22MtOUkISv7nGPXyknopOoZXYu6JxrJJfDwi25P.jpeg" alt="" width="1200" height="1200"></p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"><img src="//image.lceda.cn/pullimage/x6mqIujdw0wkJZgr1BeKXQGx9O7hhDdurAvEUNoN.jpeg" alt="" width="1200" height="1200"></p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">操作说明:</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;">1、左下角的实体开关可以上推关闭输出,下推开启输出</p>
<p style="line-height:1.8;">2、左右触摸板可以调节输出电压和电流</p>
<p style="line-height:1.8;">3、开发板K2键调节输出电压,K4键调节输出电流,K3键快捷切换输出电压</p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"> </p>
<p style="line-height:1.8;"> </p>
</div>
评论(3)