Control Windows Mobile LEDs

Source: Internet
Author: User

APIS for operating LEDs are available in coredll. dll, but are not declared in the SDK.
First, it contains the nled. h header file and two functions (obtain the led information and set the led status)
# Include <nled. h> extern "C"
{
Bool nledgetdeviceinfo (int nid, pvoid poutput );
Bool nledsetdevice (int nid, pvoid poutput );
}

 

The following function can obtain the total number of LEDs on the device. If your PPC supports vibration, the vibration motor will also be treated as an LED.

// ================================================ ======== //
// Function: obtain the total number of LEDs on the device
// Parameter: None

// Return: Total number of LEDs on the device

// Date: 2009/03/05. -- 2009/03/05.
// ================================================ ======== //
Int getledcount ()
{
Nled_count_info NCI;
Int wcount = 0;

If (nledgetdeviceinfo (nled_count_info_id, (pvoid) & NCI ))
Wcount = (INT) NCI. cleds;

Return wcount;
}

 

The following function sets the led status

// ================================================ ======== //
// Function: Set the led status on the device
// Parameter: wled, wstatus
// (Entry): wled: indicates the LED number. The first led is zero (0 ).
// (Entry): wstatus: indicates the led status 0 (off), 1 (on), 2 (flashing)
// Return: None
// Date: 2009/03/05. -- 2009/03/05.
// ================================================ ======== //
Void setledstatus (INT wled, int wstatus)
{
Nled_settings_info NSI;

NSI. lednum = (INT) wled;
NSI. offonblink = (INT) wstatus;

Nledsetdevice (nled_settings_info_id, & NSI );
}

 

 

Taking led0 as an Example
Disable: setledstatus (0, 0 );

Light up: setledstatus (0, 1 );

Blinking: setledstatus (0, 2 );

 

 

// ================================================ ========================================== //
// Function: Set Vibration
// Parameter: bstart
// (Exit) bstart: True indicates the start vibration, and false indicates the stop vibration.
// Return: None
// Date: 2009/03/26. -- 2009/03/26.
// ================================================ ========================================== //
Void startstopvibrate (bool bstart)
{
Nled_settings_info settings;

Memset (& settings, 0, sizeof (nled_settings_info ));
Settings. lednum = 1;

If (bstart)
Settings. offonblink = 1;
Else
Settings. offonblink = 0;
Nledsetdevice (nled_settings_info_id, & settings );
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.