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.
Committer:
hemddabral
Date:
Fri Apr 08 05:33:32 2016 +0000
Revision:
9:9b48d36016c3
Parent:
8:2c5c9b735d90
Child:
10:62f55b54ebdf
merged LED driver configuration to helloworld program

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hemddabral 0:0f16e14940d0 1 #include "mbed.h"
hemddabral 2:af24b3afa99d 2 #include "x_nucleo_ika01a1_class.h"
hemddabral 0:0f16e14940d0 3
hemddabral 3:5c45cb513aaf 4 Serial pc(USBTX, USBRX);
hemddabral 0:0f16e14940d0 5
hemddabral 0:0f16e14940d0 6 DigitalOut myled(LED1);
hemddabral 0:0f16e14940d0 7
hemddabral 4:6ed99ea3bf33 8 int main() {
hemddabral 8:2c5c9b735d90 9 X_NUCLEO_IKA01A1 *analog_expansion_board = X_NUCLEO_IKA01A1::Instance(A3, D2, D4, D3);
hemddabral 2:af24b3afa99d 10 analog_expansion_board->Init();
hemddabral 2:af24b3afa99d 11 TSZ124 *instrAmp = analog_expansion_board->tsz124;
hemddabral 4:6ed99ea3bf33 12 TSU104 *photoSensor_windComp = analog_expansion_board->tsu104;
hemddabral 2:af24b3afa99d 13
hemddabral 9:9b48d36016c3 14 TSV734 *led_Driver = analog_expansion_board->tsv734;
hemddabral 9:9b48d36016c3 15 led_Driver->Configure(50);
hemddabral 9:9b48d36016c3 16 float dutyCycle_us = 0;
hemddabral 9:9b48d36016c3 17
hemddabral 4:6ed99ea3bf33 18 while(1) {
hemddabral 3:5c45cb513aaf 19 pc.printf("\nwhile loop\n");
hemddabral 3:5c45cb513aaf 20
hemddabral 4:6ed99ea3bf33 21 unsigned int opAmpVoltage = instrAmp->GetVoltage();
hemddabral 4:6ed99ea3bf33 22 unsigned int opAmpCurrent = instrAmp->GetCurrent();
hemddabral 7:41935875cb26 23 // pass the analog pin name on which voltage is to be read (e.g. A3 on LPCxpresso lpc11u68)
hemddabral 8:2c5c9b735d90 24 unsigned int photoSensorVoltage = photoSensor_windComp->TSU104_PhotoSensor_GetVoltage();
hemddabral 4:6ed99ea3bf33 25 unsigned int windComPinD2 = photoSensor_windComp->TSU104_WindComp_Get_D2();
hemddabral 4:6ed99ea3bf33 26 unsigned int windComPinD4 = photoSensor_windComp->TSU104_WindComp_Get_D4();
hemddabral 4:6ed99ea3bf33 27
hemddabral 3:5c45cb513aaf 28 pc.printf("\nopAmp measured voltage(mV): %u \n", opAmpVoltage);
hemddabral 3:5c45cb513aaf 29 pc.printf("\nopAmp measured Current(mA): %u \n", opAmpCurrent);
hemddabral 3:5c45cb513aaf 30 pc.printf("\nphotodiode sensor output voltage(mV): %u \n", photoSensorVoltage);
hemddabral 3:5c45cb513aaf 31 pc.printf("\nWindows comparator: state of pin D2: %u \n", windComPinD2);
hemddabral 4:6ed99ea3bf33 32 pc.printf("\nWindows comparator: state of pin D4: %u \n", windComPinD4);
hemddabral 9:9b48d36016c3 33
hemddabral 9:9b48d36016c3 34 dutyCycle_us += 10;
hemddabral 9:9b48d36016c3 35 pc.printf("\nLED Driver: duty cycle: %u percent \n", led_Driver->SetDutyCycle(dutyCycle_us));
hemddabral 9:9b48d36016c3 36
hemddabral 9:9b48d36016c3 37 if(dutyCycle_us>=100)
hemddabral 9:9b48d36016c3 38 dutyCycle_us -= 100;
hemddabral 9:9b48d36016c3 39
hemddabral 9:9b48d36016c3 40 myled = !myled;
hemddabral 9:9b48d36016c3 41 wait(1);
hemddabral 3:5c45cb513aaf 42
hemddabral 0:0f16e14940d0 43 myled = !myled;
hemddabral 0:0f16e14940d0 44 wait(1);
hemddabral 4:6ed99ea3bf33 45 }
hemddabral 0:0f16e14940d0 46 }