Basic led control library for the onboard LEDs on the LPC1768.

Dependents:   modular_blinky 20220803GY

Committer:
BaserK
Date:
Tue Jul 21 08:24:02 2015 +0000
Revision:
1:c86dd9e1bb24
Parent:
0:428949329e53
MIT license is added

Who changed what in which revision?

UserRevisionLine numberNew contents of line
BaserK 1:c86dd9e1bb24 1 /*
BaserK 1:c86dd9e1bb24 2 * Copyright (c) 2015, Baser Kandehir, baser.kandehir@ieee.metu.edu.tr
BaserK 1:c86dd9e1bb24 3 *
BaserK 1:c86dd9e1bb24 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
BaserK 1:c86dd9e1bb24 5 * of this software and associated documentation files (the "Software"), to deal
BaserK 1:c86dd9e1bb24 6 * in the Software without restriction, including without limitation the rights
BaserK 1:c86dd9e1bb24 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
BaserK 1:c86dd9e1bb24 8 * copies of the Software, and to permit persons to whom the Software is
BaserK 1:c86dd9e1bb24 9 * furnished to do so, subject to the following conditions:
BaserK 1:c86dd9e1bb24 10 *
BaserK 1:c86dd9e1bb24 11 * The above copyright notice and this permission notice shall be included in
BaserK 1:c86dd9e1bb24 12 * all copies or substantial portions of the Software.
BaserK 1:c86dd9e1bb24 13 *
BaserK 1:c86dd9e1bb24 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
BaserK 1:c86dd9e1bb24 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
BaserK 1:c86dd9e1bb24 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
BaserK 1:c86dd9e1bb24 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
BaserK 1:c86dd9e1bb24 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
BaserK 1:c86dd9e1bb24 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
BaserK 1:c86dd9e1bb24 20 * THE SOFTWARE.
BaserK 1:c86dd9e1bb24 21 *
BaserK 1:c86dd9e1bb24 22 */
BaserK 1:c86dd9e1bb24 23
BaserK 0:428949329e53 24 #include "ledControl.h"
BaserK 0:428949329e53 25
BaserK 1:c86dd9e1bb24 26 DigitalOut led1(LED1);
BaserK 0:428949329e53 27 DigitalOut led2(LED2);
BaserK 0:428949329e53 28 DigitalOut led3(LED3);
BaserK 0:428949329e53 29 DigitalOut led4(LED4);
BaserK 0:428949329e53 30
BaserK 0:428949329e53 31 // Controls the 4 LEDs on the LPC1768
BaserK 0:428949329e53 32 void ledControl(int ledNum,int value)
BaserK 0:428949329e53 33 {
BaserK 0:428949329e53 34 switch(ledNum)
BaserK 0:428949329e53 35 {
BaserK 0:428949329e53 36 case 1: led1.write(value);
BaserK 0:428949329e53 37 break;
BaserK 0:428949329e53 38
BaserK 0:428949329e53 39 case 2: led2.write(value);
BaserK 0:428949329e53 40 break;
BaserK 0:428949329e53 41
BaserK 0:428949329e53 42 case 3: led3.write(value);
BaserK 0:428949329e53 43 break;
BaserK 0:428949329e53 44
BaserK 0:428949329e53 45 case 4: led4.write(value);
BaserK 0:428949329e53 46 break;
BaserK 0:428949329e53 47 }
BaserK 0:428949329e53 48 }