SRD Standelone programmation box: led.h File Reference

| SRD Standelone programmation box 2.0 (16/11/15 10:00:00) Documentation of the SRD standelone programmation box

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
Enumerations | Functions
led.h File Reference

Headerfile for led driver. More...

`#include "dsp.h"`
Include dependency graph for led.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros

#define | LED_GREEN_SHIFT (4)
| Define IO shift and mask sued by the led driver. More...
#define | LED_GREEN_MASK (1<<LED_GREEN_SHIFT)
| Define IO shift and mask sued by the led driver. More...
#define | LED_RED_SHIFT (5)
| Define IO shift and mask sued by the led driver. More...
#define | LED_RED_MASK (1<<LED_RED_SHIFT)
| Define IO shift and mask sued by the led driver. More...
#define | LedSet(ledId) (PTA->PCOR |= (ledId & (LED_GREEN | LED_RED) ) )
| Macro used to set/clear/togglet/read the led state. More...
#define | LedClear(ledId) (PTA->PSOR |= (ledId & (LED_GREEN | LED_RED) ) )
| Macro used to set/clear/togglet/read the led state. More...
#define | LedGetState() (PTA->PDOR & (LED_GREEN | LED_RED) )
| Macro used to set/clear/togglet/read the led state. More...
#define | LedToggle(ledId) (PTA->PTOR |= (ledId & (LED_GREEN | LED_RED) ) )
| Macro used to set/clear/togglet/read the led state. More...

## Enumerations

enum | tLedId { LED_GREEN = LED_GREEN_MASK, LED_RED = LED_RED_MASK }
| Define the led ID. More...
enum | tLedState { LED_ON = 0, LED_OFF = 1 }
| Define the state of the leds. More...

## Functions

void | LedInit (void)
| Function used to initialize the leds. More...

## Detailed Description

Headerfile for led driver.

Author
  Thibaut LALUQUE 3D-Ouest

Date
  26/09/2014

Version
  1.0

All Right Reserved.

Definition in file led.h.

## Macro Definition Documentation

#define LED_GREEN_MASK (1<<LED_GREEN_SHIFT)

Define IO shift and mask sued by the led driver.

Definition at line 35 of file led.h.

Referenced by LedInit().

#define LED_GREEN_SHIFT (4)

Define IO shift and mask sued by the led driver.

Definition at line 34 of file led.h.

Referenced by LedInit().

#define LED_RED_MASK (1<<LED_RED_SHIFT)

Define IO shift and mask sued by the led driver.

Definition at line 37 of file led.h.

Referenced by LedInit().

#define LED_RED_SHIFT (5)

Define IO shift and mask sued by the led driver.

Definition at line 36 of file led.h.

Referenced by LedInit().

#define LedClear | ( |  | ledId | ) | (PTA->PSOR |= (ledId & (LED_GREEN | LED_RED) ) )

Macro used to set/clear/togglet/read the led state.

Definition at line 103 of file led.h.

Referenced by ButtonManagerDealer(), and PowerManagerEnterLPM().

#define LedGetState | ( |  | ) | (PTA->PDOR & (LED_GREEN | LED_RED) )

Macro used to set/clear/togglet/read the led state.

Definition at line 104 of file led.h.

#define LedSet | ( |  | ledId | ) | (PTA->PCOR |= (ledId & (LED_GREEN | LED_RED) ) )

Macro used to set/clear/togglet/read the led state.

Definition at line 102 of file led.h.

Referenced by ButtonManagerDealer().

#define LedToggle | ( |  | ledId | ) | (PTA->PTOR |= (ledId & (LED_GREEN | LED_RED) ) )

Macro used to set/clear/togglet/read the led state.

Definition at line 105 of file led.h.

## Enumeration Type Documentation

enum tLedId

Define the led ID.

Enumerator
LED_GREEN | ID for the green led
LED_RED | ID for the red led

Definition at line 54 of file led.h.

54 {
55 LED_GREEN = LED_GREEN_MASK, /*!< ID for the green led */
56 LED_RED = LED_RED_MASK /*!< ID for the red led */
57 }tLedId;
LED_RED
Definition: led.h:56
LED_RED_MASK
#define LED_RED_MASK
Define IO shift and mask sued by the led driver.
Definition: led.h:37
tLedId
tLedId
Define the led ID.
Definition: led.h:54
LED_GREEN_MASK
#define LED_GREEN_MASK
Define IO shift and mask sued by the led driver.
Definition: led.h:35
LED_GREEN
Definition: led.h:55

enum tLedState

Define the state of the leds.

Enumerator
LED_ON | Led is ON
LED_OFF | Led is OFF

Definition at line 65 of file led.h.

65 {
66 LED_ON = 0, /*!< Led is ON */
67 LED_OFF = 1 /*!< Led is OFF */
68 }tLedState;
LED_OFF
Definition: led.h:67
LED_ON
Definition: led.h:66
tLedState
tLedState
Define the state of the leds.
Definition: led.h:65

## Function Documentation

void LedInit | ( | void |  | ) |

Function used to initialize the leds.

Definition at line 78 of file led.c.

References LED_GREEN_MASK, LED_GREEN_SHIFT, LED_RED_MASK, and LED_RED_SHIFT.

Referenced by Setup().

78 {
79
80 SIM->SCGC5 |= SIM_SCGC5_PORTA_MASK;
81
82 PTA->PDDR |= GPIO_PDDR_PDD(LED_GREEN_MASK | LED_RED_MASK); //As output
83
84 PTA->PSOR |= LED_GREEN_MASK | LED_RED_MASK; //Default state is off
85
86 PORTA->PCR[LED_GREEN_SHIFT] = PORT_PCR_MUX(0x01); //IO config
87 PORTA->PCR[LED_RED_SHIFT] = PORT_PCR_MUX(0x01);
88
89 }
LED_RED_MASK
#define LED_RED_MASK
Define IO shift and mask sued by the led driver.
Definition: led.h:37
LED_GREEN_SHIFT
#define LED_GREEN_SHIFT
Define IO shift and mask sued by the led driver.
Definition: led.h:34
LED_RED_SHIFT
#define LED_RED_SHIFT
Define IO shift and mask sued by the led driver.
Definition: led.h:36
LED_GREEN_MASK
#define LED_GREEN_MASK
Define IO shift and mask sued by the led driver.
Definition: led.h:35

Here is the caller graph for this function: