Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Board/Board.cpp
- Committer:
- dflet
- Date:
- 2013-09-14
- Revision:
- 1:7a4efebd6e44
- Parent:
- 0:6ad60d78b315
- Child:
- 2:e6a185df9e4c
File content as of revision 1:7a4efebd6e44:
#include "mbed.h"
DigitalOut ind1(LED1);
DigitalOut ind2(LED2);
DigitalOut ind3(LED3);
DigitalOut ind4(LED4);
//*****************************************************************************
//
//! turnLedOn
//!
//! @param ledNum is the LED Number
//!
//! @return none
//!
//! @brief Turns a specific LED on
//
//*****************************************************************************
void turnLedOn(char ledNum)
{
switch(ledNum)
{
case 1:
ind1 = 1;
break;
case 2:
ind2 = 1;
break;
case 3:
ind3 = 1;
break;
case 4:
ind4 = 1;
break;
case 5:
ind1 = 1;
break;
case 6:
ind4 = 1;
break;
case 7:
break;
case 8:
break;
}
}
//*****************************************************************************
//
//! turnLedOff
//!
//! @param ledNum is the LED Number
//!
//! @return none
//!
//! @brief Turns a specific LED Off
//
//*****************************************************************************
void turnLedOff(char ledNum)
{
switch(ledNum)
{
case 1:
ind1 = 0;
break;
case 2:
ind2 = 0;
break;
case 3:
ind3 = 0;
break;
case 4:
ind4 = 0;
break;
case 5:
ind1 = 0;
break;
case 6:
ind4 = 0;
break;
case 7:
break;
case 8:
break;
}
}
//*****************************************************************************
//
//! toggleLed
//!
//! @param ledNum is the LED Number
//!
//! @return none
//!
//! @brief Toggles a board LED
//
//*****************************************************************************
void toggleLed(char ledNum)
{
switch(ledNum)
{
case 1:
ind1 = !ind1;
break;
case 2:
ind2 = !ind2;
break;
case 3:
ind3 = !ind3;
break;
case 4:
ind4 = !ind4;
break;
case 5:
ind1 = !ind1;
break;
case 6:
ind4 = !ind4;
break;
case 7:
break;
case 8:
break;
}
}
/***************************************************************************//**
* @brief GetLEDStatus
* @param none
* @return A 1 byte containing the status of LEDS
******************************************************************************/
uint8_t GetLEDStatus()
{
uint8_t status = 0;
if(ind1)
status |= (1 << 0);
if(ind2)
status |= (1 << 1);
if(ind3)
status |= ( 1<< 2);
if(ind4)
status |= (1 << 3);
//if(LED145678_PORT_OUT & BIT2)
// status |= (1 << 4);
//if(LED145678_PORT_OUT & BIT3)
// status |= (1 << 5);
//if(LED145678_PORT_OUT & BIT4)
// status |= (1 << 6);
//if(LED145678_PORT_OUT & BIT5)
// status |= (1 << 7);
return status;
}