-
Notifications
You must be signed in to change notification settings - Fork 439
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
stm32f7nucleo: Add ADC support #1894
stm32f7nucleo: Add ADC support #1894
Conversation
dd7040b
to
5427be8
Compare
Aligned to configuration of NuttX: GPIO_ADC1_IN3 nuttx/configs/nucleo-144/src/stm32_adc.c (nuttx-7.21-298-gc67b807f43) More pins/channels may be configured later. Change-Id: I5407e6b9b91eaa8570713d0331f786441ce0c649 Relate-to: rzr/webthing-iotjs#3 Forwarded: jerryscript-project#1894 IoT.js-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com
|
||
// ADC pin name is "ADC.(number)_(timer)". | ||
#define SET_ADC_CONSTANT(number, timer) \ | ||
number_bit = (GPIO_ADC##number##_IN##timer); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should wrap the macro contents into a do { } while (0);
block. Something like this:
#define SET_ADC_CONSTANT(number, timer) \
do { \
unsigned int number_bit = (GPIO_ADC##number##_IN##timer); \
.... \
} while (0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? because this macro is used by the other one
Code is aligned to STM32 discovery, but I can try to improve both later
return stm32_adcinitialize(number, channel_list, 1); | ||
#elif defined(TARGET_BOARD_STM32F7NUCLEO) | ||
return stm32_adc_initialize(number, channel_list, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly this function name comes from nuttx, am I correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes but it has a different naming for STM32F7, Maybe I will also try to align in nuttx codebase too but AFAIK each port is free to define its own functions.
static void iotjs_pin_initialize_adc(jerry_value_t jobj) { | ||
unsigned int number_bit; | ||
|
||
// ADC pin name is "ADC.(number)_(timer)". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment ok? Based on the property set below, the name is ADC<number>_<timer>
, there is no .
in the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I will fix this in discovery file too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5427be8
to
060e841
Compare
Aligned to configuration of NuttX: GPIO_ADC1_IN3 nuttx/configs/nucleo-144/src/stm32_adc.c (nuttx-7.21-298-gc67b807f43) More pins/channels may be configured later. Change-Id: I5407e6b9b91eaa8570713d0331f786441ce0c649 Relate-to: rzr/webthing-iotjs#3 Forwarded: jerryscript-project#1894 IoT.js-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com
Aligned to configuration of NuttX: GPIO_ADC1_IN3 nuttx/configs/nucleo-144/src/stm32_adc.c (nuttx-7.21-298-gc67b807f43) More pins/channels may be configured later. Also handle difference per processors (this could be aligned in NuttX codebase). Change-Id: I5407e6b9b91eaa8570713d0331f786441ce0c649 Relate-to: rzr/webthing-iotjs#3 Forwarded: jerryscript-project#1894 IoT.js-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com
060e841
to
f3679c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Aligned to configuration of NuttX: GPIO_ADC1_IN3
nuttx/configs/nucleo-144/src/stm32_adc.c
(nuttx-7.21-298-gc67b807f43)
More pins/channels may be configured later.
Change-Id: I5407e6b9b91eaa8570713d0331f786441ce0c649
Relate-to: rzr/webthing-iotjs#3
Forwarded: https://github.com/pando-project/iotjs/pull/
IoT.js-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com