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

Manage multiple instances of analog out #4529

Merged
merged 5 commits into from Jun 30, 2017

Conversation

Projects
None yet
6 participants
@LMESTM
Contributor

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

This comment has been minimized.

Contributor

theotherjimmy commented Jun 12, 2017

@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) {
targets/TARGET_STM/analogout_api.c Outdated
return (float)value * (1.0f / (float)DAC_RANGE);
}
uint16_t analogout_read_u16(dac_t *obj) {

This comment has been minimized.

@0xc0170

0xc0170 Jun 13, 2017

Member

Can you please fix the formatting in this file ?

void function()
{
    //body
}

This comment has been minimized.

@LMESTM

LMESTM Jun 13, 2017

Contributor

will do

features/unsupported/tests/mbed/basic/main.cpp Outdated
MBED_HOSTTEST_DESCRIPTION(Basic);
MBED_HOSTTEST_START("MBED_A1");
MBED_HOSTTEST_RESULT(true);
PwmOut pwm1(D4);

This comment has been minimized.

@0xc0170

0xc0170 Jun 13, 2017

Member

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

This comment has been minimized.

@LMESTM

LMESTM Jun 13, 2017

Contributor

Thanks - indeed a mistake of mine !

@0xc0170 0xc0170 added the needs: work label Jun 13, 2017

@LMESTM LMESTM force-pushed the LMESTM:issue_1083 branch Jun 13, 2017

@LMESTM

This comment has been minimized.

Contributor

LMESTM commented Jun 13, 2017

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

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jun 20, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Jun 20, 2017

Result: ABORTED

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

/morph test

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jun 21, 2017

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

@studavekar

This comment has been minimized.

Collaborator

studavekar commented Jun 21, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Jun 21, 2017

Result: FAILURE

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

/morph test

Output

mbed Build Number: 604

Build failed!

@studavekar

This comment has been minimized.

Collaborator

studavekar commented Jun 22, 2017

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

This comment has been minimized.

Contributor

LMESTM commented Jun 22, 2017

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

@LMESTM LMESTM force-pushed the LMESTM:issue_1083 branch Jun 22, 2017

@LMESTM

This comment has been minimized.

Contributor

LMESTM commented Jun 22, 2017

@studavekar ok rebased and compilation issue fixed

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Jun 26, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Jun 27, 2017

Result: FAILURE

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

/morph test

Output

mbed Build Number: 646

Build failed!

LMESTM added some commits Jun 12, 2017

STM32: analog_out: Enable Buffer and switch
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.
STM32: analag_out: Use dynamic handle in object rather than static
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.
STM32: analog_out: generalize code for multiple instance handling
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
STM32: STM32L475xG dac_s common definition
Fixing conflict as STM32L475xG target has been merged after the first
version of moving dac_s structure definition to common_ojects.h.
STM32: STM32F413xH dac_s common definition
Fixing conflict as STM32F413xH target has been merged after the first
version of moving dac_s structure definition to common_ojects.h

@LMESTM LMESTM force-pushed the LMESTM:issue_1083 branch to 4238216 Jun 27, 2017

@LMESTM

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

0xc0170 commented Jun 27, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Jun 28, 2017

Result: FAILURE

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

/morph test

Output

mbed Build Number: 665

Test failed!

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Jun 29, 2017

retest uvisor

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Jun 29, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Jun 29, 2017

Result: FAILURE

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

/morph test

Output

mbed Build Number: 693

Test failed!

@LMESTM

This comment has been minimized.

Contributor

LMESTM commented Jun 30, 2017

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

@0xc0170

This comment has been minimized.

Member

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

This comment has been minimized.

mbed-bot commented Jun 30, 2017

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

This comment has been minimized.

Collaborator

studavekar commented Jun 30, 2017

/morph test

@mbed-bot

This comment has been minimized.

mbed-bot commented Jun 30, 2017

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

This comment has been minimized.

Contributor

theotherjimmy commented Jun 30, 2017

Merging time.

@theotherjimmy theotherjimmy merged commit d382d44 into ARMmbed:master Jun 30, 2017

4 checks passed

Cam-CI uvisor Build & Test Success
Details
ci/morph-test Job has completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment