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:
- 3:997327f69b10
- Parent:
- 2:19d1dcef0c0e
- Child:
- 4:5118c5384fdd
--- a/Components/tsv734/tsv734_class.h Wed Mar 02 12:58:02 2016 +0000 +++ b/Components/tsv734/tsv734_class.h Wed Mar 16 09:20:02 2016 +0000 @@ -137,10 +137,20 @@ { return (int) TSV734_ReadID((uint8_t *) id); } + + virtual int Configure(unsigned int period_ms) + { + pwmPinName = A1; + PwmOut ledOut(pwmPinName); + period = period_ms; + ledOut.period_ms(period); + } virtual int SetDutyCycle(float dc) { - return (int) TSV734_SetDutyCycle((float) dc); + PwmOut ledOut(pwmPinName); + ledOut.pulsewidth_ms((period*dc)/100); + return (int) dc; } @@ -203,6 +213,8 @@ /* TSV734's interrupts related functions. */ Status_t TSV734_ConfigIT(void* a); Status_t TSV734_SetDutyCycle(float dutyCycle); + unsigned int period; + PinName pwmPinName; /*** Component's I/O Methods ***/ @@ -248,13 +260,14 @@ *------------------------------------------------------------------------*/ /* ACTION 12 -------------------------------------------------------------* - * Declare here identity related variables, if needed. * + * 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. *