金牌会员
 
- 积分
- 1920
- 金钱
- 1920
- 注册时间
- 2013-11-18
- 在线时间
- 268 小时
|
花了几天的时间把战舰板上的LCD(两个月前就开始移LCD,期间遇到很多的问题,而且当时没有SRAM,也跑不起来MF的图形库很吃内存,),外置SRAM跟外置FLASH都移植到MF上面,MF立马更强悍起来了。移植W25Q64,在W25Q64划出4M做为C#的代码部署区,以后用VS部署的代码就会存到W25Q64上,这样就不用再占用STM32的内置Flash,有更大的空间来移植MF更多的功能。移植LCD的时候也顺便把MF的官方图形库也加了进来,查资料称MF的官方图形库为WPF,MS最新的图形界面开发库,相当C/C++的MFC跟嵌入式的UCGUI,这样说明我们就可以通过VS来进去LCD的图形界面的开发。里面有很多的函数跟功能没去实现,这里我只写是画线跟画圆个函数(没有C#开发上位机的基础,也没有这么多时间,只有先写些简单,有兴趣的坛友可以折腾下),直接上图上代码:
using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.Threading;
using MFPins;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Media;
namespace LED
{
public class Program
{
static InterruptPort key0 = new InterruptPort(MFPins.CPU.Pins.PE4, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeLow);
static OutputPort led1 = new OutputPort(MFPins.CPU.Pins.PE5, true);
public static void Main()
{
OutputPort led0 = new OutputPort(MFPins.CPU.Pins.PB5, true);
Bitmap TFT = new Bitmap(240, 320);
Color r = ColorUtility.ColorFromRGB(255, 0, 0);
Color g = ColorUtility.ColorFromRGB(0, 255, 0);
Color b = ColorUtility.ColorFromRGB(0, 0, 255);
while (true)
{
led0.Write(!led0.Read());
Thread.Sleep(500);
TFT.Flush(0, 0,240, 320);
TFT.DrawLine(r, 1, 0, 0, 240, 320);
TFT.DrawEllipse(g, 120, 160, 50, 50);
// Debug.Print(TFT.Width.ToString());
// Debug.Print(TFT.Height.ToString());
// TFT.SetPixel(100, 200, Microsoft.SPOT.Presentation.Media.Color.White);
}
}
}
}
LCD显示的MF的开机信息
|
|