mbed library for STMicroelectronics' X-NUCLEO-IKA01A1 expansion board.
Dependents: HelloWorld_IKA01A1
Fork of X_NUCLEO_IKA01A1 by
Library for STMicroelectronics' X-NUCLEO-IKA01A1 multifunctional expansion board based on operational amplifiers.
Diff: Components/tsv734/tsv734_class.h
- Revision:
- 16:2f9443aedbe8
- Parent:
- 14:8277ca0ab13a
- Child:
- 17:cbdee5f7a2aa
--- a/Components/tsv734/tsv734_class.h Fri Apr 08 05:58:02 2016 +0000 +++ b/Components/tsv734/tsv734_class.h Fri Apr 08 08:00:29 2016 +0000 @@ -88,9 +88,13 @@ /** * @brief Constructor. */ - TSV734(PinName ledDriverPin) : Led_driver() + TSV734(PinName ledDriverPin, unsigned int ledDutyCycle_ms) : Led_driver() { led_driver_pin = ledDriverPin; + + period = ledDutyCycle_ms; + PwmOut ledOut(led_driver_pin); + ledOut.period_ms(period); } /** @@ -120,18 +124,6 @@ return (int) TSV734_ReadID((uint8_t *) id); } - /** - * @brief set the duty cycle of LED in LED driver configuration - * @param Configure the TSV734 operational amplifier in LED driver configuration - * @retval 0 - */ - virtual int Configure(unsigned int period_us) - { - period = period_us; - PwmOut ledOut(led_driver_pin); - ledOut.period_ms(period); - return 0; - } /** * @brief set the duty cycle of LED in LED driver configuration @@ -141,7 +133,7 @@ virtual int SetDutyCycle(float dc) { PwmOut ledOut(led_driver_pin); - ledOut.pulsewidth_us((period*dc)/100); + ledOut.pulsewidth_us(period*dc); return (int) dc; }