Simple test application for X-NUCLEO-IKA01A1 expansion board.

Dependencies:   X_NUCLEO_IKA01A1 mbed

Fork of HelloWorld_IKA01A1 by ST Expansion SW Team

Simple test application for X-NUCLEO-IKA01A1 expansion board.

Platform compatibility issues

  • NUCLEO-F302R8: use pin D5 for LED Driver configuration
  • LPCXpresso11U68: use pin D3 as PWM for LED Driver configuration. Use a free Dx pin as Signal2 for Windows Comparator configuration.

Files at this revision

API Documentation at this revision

Comitter:
Davidroid
Date:
Wed Oct 18 17:00:11 2017 +0000
Parent:
20:7f25e4cedd1a
Commit message:
Output re-formatting.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 7f25e4cedd1a -r 3b3d7bfcf94b main.cpp
--- a/main.cpp	Thu Jul 13 15:46:19 2017 +0000
+++ b/main.cpp	Wed Oct 18 17:00:11 2017 +0000
@@ -49,51 +49,52 @@
 /* Variables -----------------------------------------------------------------*/
 
 Serial pc(USBTX, USBRX);
-//Serial pc(SERIAL_TX, SERIAL_RX);
 DigitalOut myled(LED1);
 
 
 /* Functions -----------------------------------------------------------------*/
 
 int main() {  
-    XNucleoIKA01A1 *analog_expansion_board = XNucleoIKA01A1::instance(X_NUCLEO_IKA01A1_PIN_INSTRUMENTATION_AMP,
-                                                                      X_NUCLEO_IKA01A1_PIN_CURRENT_SENSING,
-                                                                      X_NUCLEO_IKA01A1_PIN_PHOTO_SENSOR, 
-                                                                      X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_1,
-                                                                      X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_2,
-                                                                      X_NUCLEO_IKA01A1_PIN_PWM_LED_DRIVER_OUTPUT,
-                                                                      5000);
+    XNucleoIKA01A1 *analog_expansion_board = XNucleoIKA01A1::instance(
+        X_NUCLEO_IKA01A1_PIN_INSTRUMENTATION_AMP,
+        X_NUCLEO_IKA01A1_PIN_CURRENT_SENSING,
+        X_NUCLEO_IKA01A1_PIN_PHOTO_SENSOR, 
+        X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_1,
+        X_NUCLEO_IKA01A1_PIN_WINDOWS_COMP_SIGNAL_2,
+        X_NUCLEO_IKA01A1_PIN_PWM_LED_DRIVER_OUTPUT,
+        5000
+    );
+
     analog_expansion_board->init();
     TSZ124 *instr_amp = analog_expansion_board->tsz124;
     TSU104 *photo_sensor_wind_comp = analog_expansion_board->tsu104;
-    TSV734 *led_driver = analog_expansion_board->tsv734;  
-    double duty_cycle = 0;    
-    
-    while(1) {            
-        pc.printf("\nLooping...\n");
+    TSV734 *led_driver = analog_expansion_board->tsv734;
+    double duty_cycle = 0;
 
+    /* Printing to the console. */
+    pc.printf("Analog Application Example\r\n\n");
+
+    /* Looping. */
+    while(1) {
         unsigned int op_amp_voltage = instr_amp->get_voltage();
         unsigned int op_amp_current = instr_amp->get_current();
-        // pass the analog pin name on which voltage is to be read (e.g. A3 on LPCxpresso lpc11u68)
-        unsigned int photo_sensor_voltage = photo_sensor_wind_comp->get_voltage();                
-        unsigned int wind_com_pin1 = photo_sensor_wind_comp->get_signal1();               
-        unsigned int wind_com_pin2 = photo_sensor_wind_comp->get_signal2();                  
-        
-        pc.printf("\nopAmp measured voltage(mV): %u \n", op_amp_voltage);  
-        pc.printf("\nopAmp measured Current(mA): %u \n", op_amp_current); 
-        pc.printf("\nphotodiode sensor output voltage(mV): %u \n", photo_sensor_voltage); 
-        pc.printf("\nWindows comparator: signal 1 value(pin D2): %u \n", wind_com_pin1);         
-        pc.printf("\nWindows comparator: signal 1 value(pin D4): %u \n", wind_com_pin2);   
+        unsigned int photo_sensor_voltage = photo_sensor_wind_comp->get_voltage();
+        unsigned int wind_com_pin1 = photo_sensor_wind_comp->get_signal1();
+        unsigned int wind_com_pin2 = photo_sensor_wind_comp->get_signal2();
 
-        duty_cycle += 0.1; 
+        pc.printf("\r\nOpAmp measured Voltage(mV): %u", op_amp_voltage);
+        pc.printf("\r\nOpAmp measured Current(mA): %u", op_amp_current);
+        pc.printf("\r\nPhotodiode sensor output voltage(mV): %u", photo_sensor_voltage);
+        pc.printf("\r\nWindows comparator: signal 1 value(pin D2): %u", wind_com_pin1);
+        pc.printf("\r\nWindows comparator: signal 1 value(pin D4): %u", wind_com_pin2);
+        pc.printf("\r\nLED Driver: duty cycle: %.2lf %%\r\n", led_driver->set_duty_cycle(duty_cycle));
+                                          
+        duty_cycle += 0.1;
         if (duty_cycle >= 1) {
             duty_cycle = 0;
         }
-                     
-        pc.printf("\nLED Driver: duty cycle: %.2lf percent \n", led_driver->set_duty_cycle(duty_cycle));              
-                                          
+
         myled = !myled;
         wait(1);      
     }    
 }
-
diff -r 7f25e4cedd1a -r 3b3d7bfcf94b mbed.bld
--- a/mbed.bld	Thu Jul 13 15:46:19 2017 +0000
+++ b/mbed.bld	Wed Oct 18 17:00:11 2017 +0000
@@ -1,1 +1,1 @@
-https://mbed.org/users/mbed_official/code/mbed/builds/22da6e220af6
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/b484a57bc302
\ No newline at end of file