striscia led
Dependencies: X_NUCLEO_LED61A1 mbed
Fork of HelloWorld_LED61A1 by
Diff: main.cpp
- Revision:
- 16:0d6f96345c56
- Parent:
- 15:dd6dc0e07402
- Child:
- 18:bef2ec6d10ab
--- a/main.cpp Mon Mar 14 12:19:23 2016 +0000 +++ b/main.cpp Mon May 08 15:51:00 2017 +0000 @@ -43,7 +43,7 @@ #include "mbed.h" /* Component specific header files. */ -#include "led6001_class.h" +#include "Led6001.h" /* Definitions ---------------------------------------------------------------*/ @@ -66,7 +66,7 @@ static Ticker ticker; /* LED Control Component. */ -LED6001 *led; +Led6001 *led; /* Interrupt flags. */ static volatile bool ticker_irq_triggered = false; @@ -80,7 +80,7 @@ * @param None. * @retval None. */ -void LEDHandler(void) +void led_handler(void) { static int tick = 0; @@ -95,9 +95,9 @@ Writing PWM dimming values to the LED. Notes: - + Replace "SetPWMDimming()" with "SetAnalogDimming()" for an analog control. + + Replace "set_pwm_dimming()" with "set_analog_dimming()" for an analog control. */ - led->SetPWMDimming(pwm_dimming); + led->set_pwm_dimming(pwm_dimming); } /** @@ -105,7 +105,7 @@ * @param None. * @retval None. */ -void TickerIRQ(void) +void ticker_irq(void) { ticker_irq_triggered = true; } @@ -115,10 +115,10 @@ * @param None. * @retval None. */ -void XFaultIRQ(void) +void xfault_irq(void) { xfault_irq_triggered = true; - led->DisableXFaultIRQ(); + led->disable_xfault_irq(); } /** @@ -126,18 +126,18 @@ * @param None. * @retval None. */ -void XFaultHandler(void) +void xfault_handler(void) { /* Printing to the console. */ printf("XFAULT Interrupt detected! Re-initializing LED driver..."); /* Re-starting-up LED Control Component. */ - led->StartUp(); + led->start_up(); /* Printing to the console. */ printf("Done.\r\n\n"); - led->EnableXFaultIRQ(); + led->enable_xfault_irq(); } @@ -151,17 +151,17 @@ printf("LED Control Application Example\r\n\n"); /* Initializing LED Control Component. */ - led = new LED6001(D4, A3, D6, D5); - if (led->Init() != COMPONENT_OK) + led = new Led6001(D4, A3, D6, D5); + if (led->init() != COMPONENT_OK) exit(EXIT_FAILURE); /* Attaching interrupt request functions. */ - led->AttachXFaultIRQ(&XFaultIRQ); - led->EnableXFaultIRQ(); - ticker.attach_us(TickerIRQ, LOOP_PERIOD_us); + led->attach_xfault_irq(&xfault_irq); + led->enable_xfault_irq(); + ticker.attach_us(ticker_irq, LOOP_PERIOD_us); /* Starting-up LED Control Component. */ - led->StartUp(); + led->start_up(); /*----- LED Control. -----*/ @@ -172,11 +172,11 @@ if (ticker_irq_triggered) { ticker_irq_triggered = false; - LEDHandler(); + led_handler(); } else if (xfault_irq_triggered) { xfault_irq_triggered = false; - XFaultHandler(); + xfault_handler(); } else { /* It is recommended that SEVONPEND in the System Control Register is NOT set. */ __WFE();