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.
Dependents: LedDimming_LED61A1_mbedOS HelloWorld_LED61A1_mbedOS LedDimming_LED61A1 HelloWorld_LED61A1 ... more
Fork of X_NUCLEO_LED61A1 by
LED Control Library
Library to handle the X-NUCLEO-LED61A1 LED Control Expansion Board based on the LED6001 component.
Platform compatibility
- NUCLEO boards have been tested with the default configuration provided by the HelloWorld_LED61A1 example.
- NUCLEO-F070RB, NUCLEO-F072RB, NUCLEO-F091RC boards have been tested with the following patch:
- to connect with a wire the NUCLEO’s
D9pin to the LED61A1’sD6pin; - to initialize the pwm PinName variable with
D9rather thanD6.
- to connect with a wire the NUCLEO’s
- NUCLEO-F302R8 board has been tested with the following patch:
- to connect with a wire the NUCLEO’s
D7pin to the LED61A1’sD6pin; - to initialize the pwm PinName variable with
D7rather thanD6.
- to connect with a wire the NUCLEO’s
- LPCXpresso11U68 board has been tested with the limitation of using only the PWM Dimming, as it provides only one PWM channel, thus allowing just one between the PWM or Analog Dimming functionalities. It has been tested with the following patch:
- to connect with a wire the LPCX’s
D3pin to the LED61A1’sD4pin; - to connect with a wire the LPCX’s
D4pin to the LED61A1’sD6pin; - to initialize the xfault_irq PinName variable with
D3rather thanD4; - to initialize the pwm PinName variable with
D4rather thanD6; - to initialize the analog PinName variable with
NCrather thanD5; - to disable the use of the user button in any application example as it is not available.
- to connect with a wire the LPCX’s
- FRDM-K64F board has been tested with the following patch:
- to disable the use of the user button in any application example as it is not available.
Components/led6001/led6001_class.h
- Committer:
- Davidroid
- Date:
- 2015-12-14
- Revision:
- 1:eab47c592e8f
- Parent:
- 0:4a3d02667d9f
- Child:
- 2:a270bdb62fc8
File content as of revision 1:eab47c592e8f:
/**
******************************************************************************
* @file led6001_class.h
* @author Davide Aliprandi, STMicrolectronics
* @version V1.0.0
* @date December 9th, 2015
* @brief This file contains the class of an LED6001 component.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Generated with Stm32CubeTOO -----------------------------------------------*/
/* Revision ------------------------------------------------------------------*/
/*
Repository: http://svn.x-nucleodev.codex.cro.st.com/svnroot/X-NucleoDev
Branch/Trunk/Tag: trunk
Based on: X-CUBE-LED1/trunk/Drivers/BSP/Components/led6001/led6001.h
Revision: 0
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __LED6001_CLASS_H
#define __LED6001_CLASS_H
/* Includes ------------------------------------------------------------------*/
/* ACTION 1 ------------------------------------------------------------------*
* Include here platform specific header files. *
*----------------------------------------------------------------------------*/
#include "mbed.h"
/* ACTION 2 ------------------------------------------------------------------*
* Include here component specific header files. *
*----------------------------------------------------------------------------*/
#include "led6001.h"
/* ACTION 3 ------------------------------------------------------------------*
* Include here interface specific header files. *
* *
* Example: *
* #include "../Interfaces/Humidity_class.h" *
* #include "../Interfaces/Temperature_class.h" *
*----------------------------------------------------------------------------*/
#include "../Interfaces/Led_class.h"
/* Classes -------------------------------------------------------------------*/
/**
* @brief Class representing a LED6001 component.
*/
class LED6001 : public Led
{
public:
/*** Constructor and Destructor Methods ***/
/**
* @brief Constructor.
* @param xfault_irq pin name of the XFAULT pin of the component.
* @param current pin name of the ADC pin of the component responsible
* for sensing the current flowing through the LED.
*/
LED6001(PinName xfault_irq, PinName current) : Led(), xfault_irq(xfault_irq), current(current)
{
/* ACTION 4 ----------------------------------------------------------*
* Initialize here the component's member variables, one variable per *
* line. *
* *
* Example: *
* measure = 0; *
* instance_id = number_of_instances++; *
*--------------------------------------------------------------------*/
}
/**
* @brief Destructor.
*/
virtual ~LED6001(void) {}
/*** Public Component Related Methods ***/
/* ACTION 5 --------------------------------------------------------------*
* Implement here the component's public methods, as wrappers of the C *
* component's functions. *
* They should be: *
* + Methods with the same name of the C component's virtual table's *
* functions (1); *
* + Methods with the same name of the C component's extended virtual *
* table's functions, if any (2). *
* *
* Example: *
* virtual int GetValue(float *pData) //(1) *
* { *
* return COMPONENT_GetValue(float *pfData); *
* } *
* *
* virtual int EnableFeature(void) //(2) *
* { *
* return COMPONENT_EnableFeature(); *
* } *
*------------------------------------------------------------------------*/
/**
* @brief Initializing the component.
* @param init Configuration settings for the LED6001 component.
* @retval COMPONENT_OK in case of success, an error code otherwise.
*/
virtual int Init(void *init) {}
#if 0
{
return (int) LED6001_Init((void *) init);
}
/**
* @brief Deinitializing the component.
* @param None.
* @retval None.
*/
virtual void DeInit(void)
{
LED6001_DeInit();
}
/**
* @brief Setting PWM dim value.
* @param value PWM dim value.
* @retval None.
*/
virtual void SetPwmDim(uint8_t)
{
LED6001_SetPwmDim(() uint8_t);
}
/**
* @brief Setting analog dim value.
* @param value Analog dim value.
* @retval None.
*/
virtual void SetAnaDim(uint8_t)
{
LED6001_SetAnaDim(() uint8_t);
}
/**
* @brief Returning fault status of the component.
* @param None.
* @retval Fault status.
*/
virtual int FaultStatus(void)
{
return (int) LED6001_FaultStatus();
}
#endif
/*** Public Interrupt Related Methods ***/
/* ACTION 6 --------------------------------------------------------------*
* Implement here interrupt related methods, if any. *
* Note that interrupt handling is platform dependent, e.g.: *
* + mbed: *
* InterruptIn feature_irq(pin); //Interrupt object. *
* feature_irq.rise(callback); //Attach a callback. *
* feature_irq.mode(PullNone); //Set interrupt mode. *
* feature_irq.enable_irq(); //Enable interrupt. *
* feature_irq.disable_irq(); //Disable interrupt. *
* + Arduino: *
* attachInterrupt(pin, callback, RISING); //Attach a callback. *
* detachInterrupt(pin); //Detach a callback. *
* *
* Example (mbed): *
* void AttachFeatureIRQ(void (*fptr) (void)) *
* { *
* feature_irq.rise(fptr); *
* } *
* *
* void EnableFeatureIRQ(void) *
* { *
* feature_irq.enable_irq(); *
* } *
* *
* void DisableFeatureIRQ(void) *
* { *
* feature_irq.disable_irq(); *
* } *
*------------------------------------------------------------------------*/
/**
* @brief Attaching an interrupt handler to the XFAULT interrupt.
* @param fptr An interrupt handler.
* @retval None.
*/
void AttachXFaultIRQ(void (*fptr)(void))
{
xfault_irq.rise(fptr);
}
/**
* @brief Enabling the XFAULT interrupt handling.
* @param None.
* @retval None.
*/
void EnableXFaultIRQ(void)
{
xfault_irq.enable_irq();
}
/**
* @brief Disabling the XFAULT interrupt handling.
* @param None.
* @retval None.
*/
void DisableXFaultIRQ(void)
{
xfault_irq.disable_irq();
}
protected:
/*** Protected Component Related Methods ***/
/* ACTION 7 --------------------------------------------------------------*
* Declare here the component's specific methods. *
* They should be: *
* + Methods with the same name of the C component's virtual table's *
* functions (1); *
* + Methods with the same name of the C component's extended virtual *
* table's functions, if any (2); *
* + Helper methods, if any, like functions declared in the component's *
* source files but not pointed by the component's virtual table (3). *
* *
* Example: *
* DrvStatusTypeDef COMPONENT_GetValue(float* pfData); //(1) *
* DrvStatusTypeDef COMPONENT_EnableFeature(void); //(2) *
* DrvStatusTypeDef COMPONENT_ComputeAverage(void); //(3) *
*------------------------------------------------------------------------*/
/*** Component's I/O Methods ***/
/* ACTION 8 --------------------------------------------------------------*
* Implement here other I/O methods beyond those already implemented *
* above, which are declared extern within the component's header file. *
*------------------------------------------------------------------------*/
/*** Component's Instance Variables ***/
/* ACTION 9 --------------------------------------------------------------*
* Declare here interrupt related variables, if needed. *
* Note that interrupt handling is platform dependent, see *
* "Interrupt Related Methods" above. *
* *
* Example: *
* + mbed: *
* InterruptIn feature_irq; *
*------------------------------------------------------------------------*/
InterruptIn xfault_irq;
/* ACTION 10 -------------------------------------------------------------*
* Declare here other pin related variables, if needed. *
* *
* Example: *
* + mbed: *
* DigitalOut standby_reset; *
*------------------------------------------------------------------------*/
AnalogIn current;
/* ACTION 11 -------------------------------------------------------------*
* Declare here communication related variables, if needed. *
* *
* Example: *
* + mbed: *
* DigitalOut address; *
* DevI2C &dev_i2c; *
*------------------------------------------------------------------------*/
/* ACTION 12 -------------------------------------------------------------*
* Declare here identity related variables, if needed. *
* Note that there should be only a unique identifier for each component, *
* which should be the "who_am_i" parameter. *
*------------------------------------------------------------------------*/
/* Identity */
uint8_t who_am_i;
/* ACTION 13 -------------------------------------------------------------*
* Declare here the component's static and non-static data, one variable *
* per line. *
* *
* Example: *
* float measure; *
* int instance_id; *
* static int number_of_instances; *
*------------------------------------------------------------------------*/
};
#endif // __LED6001_CLASS_H
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

X-NUCLEO-LED61A1 LED Driver