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.
Revision 13:9cecc8d66cc1, committed 2016-04-07
- Comitter:
- hemddabral
- Date:
- Thu Apr 07 07:51:13 2016 +0000
- Parent:
- 12:ac16b9a1cad6
- Child:
- 14:8277ca0ab13a
- Commit message:
- updated doxygen style comments
Changed in this revision
--- a/Components/tsu104/tsu104_class.h Thu Apr 07 04:15:34 2016 +0000
+++ b/Components/tsu104/tsu104_class.h Thu Apr 07 07:51:13 2016 +0000
@@ -77,7 +77,9 @@
/* Classes -------------------------------------------------------------------*/
/**
- * @brief Class representing a TSU104 component.
+ * @brief Class representing a TSU104 operational amplifier component. The window comparator
+ * configuration allows the user to compare a signal to two threshold voltages. When the signal
+ * is out of the required voltage range, the output of the operational amplifier toggles
*/
class TSU104 : public Windcomp
{
@@ -108,48 +110,50 @@
/*** 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 *f) //(1) *
- * { *
- * return COMPONENT_GetValue(float *f); *
- * } *
- * *
- * virtual int EnableFeature(void) //(2) *
- * { *
- * return COMPONENT_EnableFeature(); *
- * } *
- *------------------------------------------------------------------------*/
+ /**
+ * @brief initialize the class for TSU104 operational amplifier component
+ * @retval COMPONENT_OK if initialization is successfull
+ * @retval suitable error code otherwise
+ */
virtual int Init(void *init = NULL)
{
return (int) TSU104_Init((void *) init);
}
-
+
+ /**
+ * @brief obtain component ID for TSU104 perational amplifier
+ * @retval component ID for TSU104 operational amplifier
+ */
virtual int ReadID(uint8_t *id = NULL)
{
return (int) TSU104_ReadID((uint8_t *) id);
}
-
+ /**
+ * @brief obtain digital value at arduino pin D2
+ * @retval digital value at arduino pin D2
+ */
virtual unsigned int TSU104_WindComp_Get_D2(void)
{
DigitalIn windowsCompD2(D2);
return windowsCompD2.read();
}
+ /**
+ * @brief obtain digital value at arduino pin D4
+ * @retval digital value at arduino pin D4
+ */
virtual unsigned int TSU104_WindComp_Get_D4(void)
{
DigitalIn windowsCompD4(D4);
return windowsCompD4.read();
}
-
+
+
+ /**
+ * @brief obtain the output voltage detected by photo sensor
+ * @param pin AnalogIn pin to use for detecting the voltage
+ * @retval voltage detected by photo sensor
+ */
virtual unsigned int TSU104_PhotoSensor_GetVoltage(PinName pin)
{
AnalogIn photoSensor(pin);
--- a/Components/tsv734/tsv734_class.h Thu Apr 07 04:15:34 2016 +0000
+++ b/Components/tsv734/tsv734_class.h Thu Apr 07 07:51:13 2016 +0000
@@ -77,7 +77,7 @@
/* Classes -------------------------------------------------------------------*/
/**
- * @brief Class representing a TSV734 component.
+ * @brief Class representing a TSV734 operational amplifier component.
*/
class TSV734 : public Led_driver
{
@@ -108,36 +108,30 @@
/*** 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 *f) //(1) *
- * { *
- * return COMPONENT_GetValue(float *f); *
- * } *
- * *
- * virtual int EnableFeature(void) //(2) *
- * { *
- * return COMPONENT_EnableFeature(); *
- * } *
- *------------------------------------------------------------------------*/
+ /**
+ * @brief initialize the class for TSV734 operational amplifier component
+ * @retval COMPONENT_OK if initialization is successfull
+ * @retval suitable error code otherwise
+ */
virtual int Init(void *init = NULL)
{
return (int) TSV734_Init((void *) init);
}
+ /**
+ * @brief obtain component ID for TSV734 perational amplifier
+ * @retval component ID for TSV734 operational amplifier
+ */
virtual int ReadID(uint8_t *id = NULL)
{
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(PinName pinName, unsigned int period_us)
{
pwmPinName = pinName;
@@ -147,6 +141,11 @@
return 0;
}
+ /**
+ * @brief set the duty cycle of LED in LED driver configuration
+ * @param dc duty cycle to set
+ * @retval duty cycle in LED driver configuration
+ */
virtual int SetDutyCycle(float dc)
{
PwmOut ledOut(pwmPinName);
--- a/Components/tsz124/tsz124_class.cpp Thu Apr 07 04:15:34 2016 +0000
+++ b/Components/tsz124/tsz124_class.cpp Thu Apr 07 07:51:13 2016 +0000
@@ -56,18 +56,14 @@
/* Methods -------------------------------------------------------------------*/
-//static Status_t GetVoltage(unsigned int *ptrVoltage);
-//static Status_t GetCurrent(unsigned int *ptrCurrent);
-
/* TSZ124's private functions. */
-
Status_t TSZ124::TSZ124_Init(void *init) {
return COMPONENT_OK;
}
-Status_t TSZ124::TSZ124_ReadID(void *init) {
- return COMPONENT_OK;
+unsigned int TSZ124::TSZ124_ReadID(void *init) {
+ return I_AM_TSZ124;
}
Status_t TSZ124::TSZ124_ConfigIT(void *init) {
--- a/Components/tsz124/tsz124_class.h Thu Apr 07 04:15:34 2016 +0000
+++ b/Components/tsz124/tsz124_class.h Thu Apr 07 07:51:13 2016 +0000
@@ -77,7 +77,7 @@
/* Classes -------------------------------------------------------------------*/
/**
- * @brief Class representing a TSZ124 component.
+ * @brief Class representing a TSZ124 operational amplifier component.
*/
class TSZ124 : public Instrumentation_amp
{
@@ -108,36 +108,30 @@
/*** 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 *f) //(1) *
- * { *
- * return COMPONENT_GetValue(float *f); *
- * } *
- * *
- * virtual int EnableFeature(void) //(2) *
- * { *
- * return COMPONENT_EnableFeature(); *
- * } *
- *------------------------------------------------------------------------*/
+
+ /**
+ * @brief initialize class for TSZ124 operational amplifier component
+ * @retval COMPONENT_OK if initialization is successfull
+ * @retval suitable error code otherwise
+ */
virtual int Init(void *init = NULL)
{
return (int) TSZ124_Init((void *) init);
}
+ /**
+ * @brief obtain component ID for TSZ124 perational amplifier
+ * @retval component ID for TSZ124 operational amplifier
+ */
virtual int ReadID(uint8_t *id = NULL)
{
return (int) TSZ124_ReadID((uint8_t *) id);
}
+ /**
+ * @brief obtain the amplified differential voltage in instrumentation Amplifier configuration
+ * @retval amplified differential voltage in instrumentation Amplifier configuration
+ */
virtual unsigned int GetVoltage(void)
{
const unsigned int ADC_RANGE_12_BIT = 0xFFF;
@@ -145,6 +139,10 @@
return ((double)ain.read())*805.0*ADC_RANGE_12_BIT/1000.0;
}
+ /**
+ * @brief obtain the current consumed by the application in Current sensing configuration
+ * @retval current consumed by the application in Current sensing configuration
+ */
virtual unsigned int GetCurrent(void)
{
const unsigned int ADC_RANGE_12_BIT = 0xFFF;
@@ -207,7 +205,7 @@
*------------------------------------------------------------------------*/
/* TSZ124's generic functions. */
Status_t TSZ124_Init(void *init);
- Status_t TSZ124_ReadID(void *id);
+ unsigned int TSZ124_ReadID(void *id);
/* TSZ124's interrupts related functions. */
Status_t TSZ124_ConfigIT(void* a);
--- a/x_nucleo_ika01a1_class.cpp Thu Apr 07 04:15:34 2016 +0000
+++ b/x_nucleo_ika01a1_class.cpp Thu Apr 07 07:51:13 2016 +0000
@@ -98,7 +98,8 @@
/**
* @brief Initializing the X_NUCLEO_IKA01A1 board.
- * @retval true if initialization is successful, false otherwise.
+ * @retval true if initialization is successful
+ * @retval false otherwise.
*/
bool X_NUCLEO_IKA01A1::Init(void)
{
@@ -113,38 +114,11 @@
return true;
}
-/* ACTION 5 ------------------------------------------------------------------*
- * Implement here an initialization method for each expansion board's *
- * component. *
- * *
- * Example: *
- * bool EXPANSION_BOARD::Init_COMPONENT_1(void) *
- * { *
- * // Verifying identity. *
- * uint8_t id = 0; *
- * int ret = component_1->ReadID(&id); *
- * if ((ret != COMPONENT_OK) || (id != I_AM_COMPONENT_1)) *
- * { *
- * delete component_1; *
- * component_1 = NULL; *
- * return true; *
- * } *
- * *
- * // Configuration. *
- * COMPONENT_Init_t InitStructure; *
- * InitStructure.Property_1 = COMPONENT_1_PROPERY_1_INIT; *
- * InitStructure.Property_N = COMPONENT_1_PROPERY_N_INIT; *
- * *
- * // Initialization. *
- * if (component_1->Init(&InitStructure) != COMPONENT_OK) *
- * return false; *
- * *
- * return true; *
- * } *
- *----------------------------------------------------------------------------*/
+
/**
* @brief Initialize the TSZ124 component.
- * @retval true if initialization is successful, false otherwise.
+ * @retval true if initialization is successful
+ * @retval false otherwise
*/
bool X_NUCLEO_IKA01A1::Init_TSZ124(void)
{
@@ -177,7 +151,8 @@
/**
* @brief Initialize the TSU104 component.
- * @retval true if initialization is successful, false otherwise.
+ * @retval true if initialization is successful
+ * @retval false otherwise
*/
bool X_NUCLEO_IKA01A1::Init_TSU104(void)
{
@@ -210,7 +185,8 @@
/**
* @brief Initialize the TSV734 component.
- * @retval true if initialization is successful, false otherwise.
+ * @retval true if initialization is successful
+ * @retval false otherwise
*/
bool X_NUCLEO_IKA01A1::Init_TSV734(void)
{
--- a/x_nucleo_ika01a1_class.h Thu Apr 07 04:15:34 2016 +0000
+++ b/x_nucleo_ika01a1_class.h Thu Apr 07 07:51:13 2016 +0000
@@ -69,7 +69,20 @@
/* Classes -------------------------------------------------------------------*/
-/** Class representing a X_NUCLEO_IKA01A1 board.
+/** Class X_NUCLEO_IKA01A1 represents multifunctional expansion board based on operational amplifiers.
+ * It provides an easy-to-use and affordable solution for different multifunctional use cases with your
+ * STM32 Nucleo board. For current sensing configuration and the instrumentation amplifier configuration,
+ * a highly accurate operational amplifier (TSZ124) is used. The expansion board also contains Nanopower (TSU104)
+ * and Micropower (TSV734) operational amplifiers for mobile applications.
+ * It is intentionally implemented as a singleton because only one
+ * X_NUCLEO_IKA01A1 at a time might be deployed in a HW component stack.\n
+ * In order to get the singleton instance you have to call class method `Instance()`,
+ * e.g.:
+ * @code
+ * // Inertial & Environmental expansion board singleton instance
+ * static X_NUCLEO_IKA01A1 *<TODO>_expansion_board = X_NUCLEO_IKA01A1::Instance();
+ * @endcode
+ *
*/
class X_NUCLEO_IKA01A1
{
@@ -84,8 +97,9 @@
static X_NUCLEO_IKA01A1 *Instance(void);
/**
- * @brief Initializing the X_NUCLEO_IKA01A1 board.
- * @retval true if initialization is successful, false otherwise.
+ * @brief Initialize the singleton's operational amplifiers to default settings
+ * @retval true if initialization is successful
+ * @retval false otherwise.
*/
bool Init(void);

X-NUCLEO-IKA01A1 Multifunctional board based on operational amplifiers.