| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /*! \file
- * Led.c contains all interface- and low-level routines to
- * control the LED
- * Copyright STREAMIT BV 2010
- * \version 1.0
- * \date 26 september 2003
- */
- #define LOG_MODULE LOG_LED_MODULE
- #include <sys/timer.h>
- #include <sys/thread.h>
- #include <sys/event.h>
- #include "system.h"
- #include "portio.h"
- #include "led.h"
- static u_char LedStatus;
- /*-------------------------------------------------------------------------*/
- /* local variable definitions */
- /*-------------------------------------------------------------------------*/
- /*-------------------------------------------------------------------------*/
- /* local routines (prototyping) */
- /*-------------------------------------------------------------------------*/
- /*!
- * \addtogroup Led
- */
- /*@{*/
- /*-------------------------------------------------------------------------*/
- /* start of code */
- /*-------------------------------------------------------------------------*/
- /* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
- /*!
- * \brief Interface routine to control the SIR LED
- *
- * Using this routine, the LED can be set to 'ON', 'OFF" or it's state can
- * be toggeld
- *
- * \param LedMode can be eiter 'ON', 'OFF' or 'TOGGLE'
- */
- /* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
- /************************************************************/
- /* Control the LED: ON, OFF or TOGGLE */
- /* in case Lucas is 'OFF' -> return */
- /************************************************************/
- void LedControl(u_char LedMode)
- {
- switch (LedMode)
- {
- case LED_OFF:
- case LED_POWER_OFF:
- case LED_FLASH_OFF:
- cbi (LED_OUT_WRITE, LED_PIN);
- LedStatus = LedMode;
- break;
- case LED_ON:
- case LED_POWER_ON:
- case LED_FLASH_ON:
- sbi (LED_OUT_WRITE, LED_PIN);
- LedStatus = LedMode;
- break;
- case LED_TOGGLE:
- if (LedStatus == LED_ON)
- {
- cbi (LED_OUT_WRITE, LED_PIN);
- LedStatus = LED_OFF;
- }
- else
- {
- sbi (LED_OUT_WRITE, LED_PIN);
- LedStatus = LED_ON;
- }
- break;
- }
- }
- /* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
- /*!
- * \brief Initialise the Led module
- *
- * clear LED and update LedStatus
- *
- */
- /* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
- void LedInit()
- {
- cbi (LED_OUT_WRITE, LED_PIN);
- LedStatus = LED_OFF;
- }
- /*!
- * \brief Get LedStatus for external use
- *
- */
- u_char LedGetStatus()
- {
- return(LedStatus);
- }
- /* ---------- end of module ------------------------------------------------ */
- /*@}*/
|