Skip to content

Manage multiple instances of analog out #4529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 30, 2017

Conversation

LMESTM
Copy link
Contributor

@LMESTM LMESTM commented Jun 12, 2017

Description

This PR addresses the problem reported in #1083.
It also generalizes the fix to more targets by putting some code in common

Should solve as well:
#3970

Status

READY

Todos

  • Tests
    Non regresssion tests done:
    Analog CI tests shield tests OK

@theotherjimmy
Copy link
Contributor

@LMESTM It looks like this does not compile correctly with GCC. Travis has this error:

Executing: python tools/build.py -m NUCLEO_F207ZG -t GCC_ARM -j 4 -c --silent --dsp --usb

/home/travis/build/ARMmbed/mbed-os/targets/TARGET_STM/TARGET_STM32F2/analogout_device.c: In function 'analogout_init':

/home/travis/build/ARMmbed/mbed-os/targets/TARGET_STM/TARGET_STM32F2/analogout_device.c:73:5: error: 'Dacobj' undeclared (first use in this function)

     Dacobj->handleHandle.Instance = DAC;

     ^

/home/travis/build/ARMmbed/mbed-os/targets/TARGET_STM/TARGET_STM32F2/analogout_device.c:73:5: note: each undeclared identifier is reported only once for each function it appears in

/home/travis/build/ARMmbed/mbed-os/targets/TARGET_STM/TARGET_STM32F2/analogout_device.c:74:26: error: 'dac_t' has no member named 'handle'

     if (HAL_DAC_Init(&obj->handle) != HAL_OK ) {

                          ^

/home/travis/build/ARMmbed/mbed-os/targets/TARGET_STM/TARGET_STM32F2/analogout_device.c:81:35: error: 'dac_t' has no member named 'handle'

     if (HAL_DAC_ConfigChannel(&obj->handle, &sConfig, obj->channel) != HAL_OK) {

return (float)value * (1.0f / (float)DAC_RANGE);
}

uint16_t analogout_read_u16(dac_t *obj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fix the formatting in this file ?

void function()
{
    //body
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do

MBED_HOSTTEST_DESCRIPTION(Basic);
MBED_HOSTTEST_START("MBED_A1");
MBED_HOSTTEST_RESULT(true);
PwmOut pwm1(D4);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this test program that you have been using for testing (because this is not basic anymore) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - indeed a mistake of mine !

@LMESTM
Copy link
Contributor Author

LMESTM commented Jun 13, 2017

@theotherjimmy sorry about the failure - corrected now
@0xc0170 code formatting updated

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 20, 2017

/morph test

@mbed-bot
Copy link

Result: ABORTED

Your command has finished executing! Here's what you wrote!

/morph test

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 21, 2017

CI will be restarted once the CI for the patch release finishes

@studavekar
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 604

Build failed!

@studavekar
Copy link
Contributor

Build failed for DISCO_L475VG_IOT01A

17:32:58         [Error] common_objects.h@121,0:  #256: invalid redeclaration of type name "dac_s" (declared at line 63 of "/home/arm/mbed_jenkins/workspace/bm_wrap/651/mbed-os/targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L475xG/objects.h")

@LMESTM
Copy link
Contributor Author

LMESTM commented Jun 22, 2017

@studavekar Thanks. This board has been merged in the mean time - I will update the PR

@LMESTM
Copy link
Contributor Author

LMESTM commented Jun 22, 2017

@studavekar ok rebased and compilation issue fixed

@theotherjimmy
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 646

Build failed!

LMESTM added 5 commits June 27, 2017 09:27
This allows a proper handling of multiple instances. Also this commit
stores the channel in the HAL format so that it can be re-used more easily
and call to HAL are straightforward.
ADC1 channel2 and ADC2 of few targets only have an output switch and no
buffer. This switch needs to be enabled, and also the buffer can be enabled
in order to reduce the output impedance on output, and to drive external
loads directly without having to add an external operational amplifier.
Moving some code in common to be able to manage several ADC instances,
or several channels of an instance.

The change involves:
- moving dac_s structure definition to common_object.h
- create TARGET_STM/analogout_api.c and move fully common analog_out
functions in there
- rename analogout_api.c of each target family into analogout_device.c
to keep platform specific code
- update analogout_device.c to rely on obj->handle and obj->channel
- align analogout_init function as much as possible between families in
analogout_device.c files
Fixing conflict as STM32L475xG target has been merged after the first
version of moving dac_s structure definition to common_ojects.h.
Fixing conflict as STM32F413xH target has been merged after the first
version of moving dac_s structure definition to common_ojects.h
@LMESTM
Copy link
Contributor Author

LMESTM commented Jun 27, 2017

@studavekar @theotherjimmy there was yet another build error to fix - so rebased and new fix added.
Would be great if you can restart /morph test

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 27, 2017

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 665

Test failed!

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 29, 2017

retest uvisor

@theotherjimmy
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 693

Test failed!

@LMESTM
Copy link
Contributor Author

LMESTM commented Jun 30, 2017

@0xc0170 @theotherjimmy what is wrong with /morph test - is there something I need to fix ?

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 30, 2017

@0xc0170 @theotherjimmy what is wrong with /morph test - is there something I need to fix ?

If there is anything , we would let you know.

@mbed-bot
Copy link

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test - is there something I need to fix ?

If there is anything , we would let you know.

Output

mbed Build Number: 706

Test failed!

@studavekar
Copy link
Contributor

/morph test

@mbed-bot
Copy link

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test

Output

mbed Build Number: 710

All builds and test passed!

@theotherjimmy
Copy link
Contributor

Merging time.

@theotherjimmy theotherjimmy merged commit d382d44 into ARMmbed:master Jun 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants