The Mini2440 comes standard with 256MB NAND flash, expandable via an SD card slot, along with 2MB of NOR flash. The board has camera and LCD interfaces, and with a built-in 3.5-inch QVGA (320x240) TFT TouchScreen LCD .
The Mini2440's complement of PC-style I/O includes Ethernet, USB host and slave ports, and three serial connections. Available options include a WiFi module, and CMOS and USB camera options. The Mini2440 board offers a stable CPU power source chip and reset system.
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Ex1
{
public partial class Form1 : Form
{
// Declare Function
[DllImport("coredll.dll")]
public static extern IntPtr CreateFile(String lpFileName, UInt32 dwDesiredAccess, UInt32 dwShareMode, IntPtr lpSecurityAttributes, UInt32 dwCreationDisposition, UInt32 dwFlagsAndAttributes, IntPtr hTemplateFile);
[DllImport("coredll.dll")]
public static extern bool DeviceIoControl(IntPtr hDevice, UInt32 dwIoControlCode, Byte[] lpInBuffer, UInt32 nInBufferSize, Byte[] lpOutBuffer, UInt32 nOutBufferSize, UInt32 lpBytesReturned, IntPtr lpOverlapped);
[DllImport("coredll.dll")]
public static extern bool CloseHandle(IntPtr hDevice);
// Constant of Function
const UInt32 OPEN_EXISTING = 3;
const UInt32 GENERIC_READ = 0x80000000;
const UInt32 GENERIC_WRITE = 0x40000000;
const Int32 INVALID_HANDLE_VALUE = -1;
// Constant from LED Driver
const UInt32 LED_1_ON = 0x01;
const UInt32 LED_2_ON = 0x02;
const UInt32 LED_3_ON = 0x03;
const UInt32 LED_4_ON = 0x04;
const UInt32 LED_All_ON = 0x05;
const UInt32 LED_1_OFF = 0x06;
const UInt32 LED_2_OFF = 0x07;
const UInt32 LED_3_OFF = 0x08;
const UInt32 LED_4_OFF = 0x09;
const UInt32 LED_All_OFF = 0x0A;
// Variable of Device
private IntPtr hPort;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Open LED Device ;
hPort = CreateFile("LED1:", GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
if (hPort == (IntPtr)INVALID_HANDLE_VALUE)
{
MessageBox.Show("Open LED1 Driver Fail");
}
}
private void button1_Click(object sender, EventArgs e)
{
// Check Open Device already
if (hPort != (IntPtr)INVALID_HANDLE_VALUE)
{
// Turn ON All LED
DeviceIoControl(hPort, LED_All_ON, null, 0, null, 0, 0, IntPtr.Zero);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (hPort != (IntPtr)INVALID_HANDLE_VALUE)
{
// Turn OFF All LED
DeviceIoControl(hPort, LED_All_OFF, null, 0, null, 0, 0, IntPtr.Zero);
}
}
private void Form1_Closing(object sender, CancelEventArgs e)
{
if (hPort != (IntPtr)INVALID_HANDLE_VALUE)
{
// Close LED Device
CloseHandle(hPort);
}
}