Commit Graph

33 Commits

Author SHA1 Message Date
vollst-induktion a42a058966 stm32f1/f4: adc: Fix ADC_SMPRx_SMPy_MSK defines
Referred to obsolete definition names.
2017-08-24 21:34:28 +00:00
Karl Palsson c9c5cb7c9c style: fix some of the easier style bugs
No real changes.
2017-03-30 21:48:07 +00:00
Karl Palsson 9a0b07d4de stm32f1: adc: standardize temperature sensor API
The TSVREFE bit is defined to only be present on ADC1, so drop the
pointless adc argument.  This has the added benefit of making the
API consistent with all other STM32 adc parts.
2016-09-12 23:29:32 +00:00
Karl Palsson cda59c3855 stm32f1: adc: remove confusing "adc_on" function
This is _similar_ to adc_power_on, the common name, but has been marked
deprecated since 2012.
2016-09-12 23:29:28 +00:00
Karl Palsson d035a9cd39 stm32f1: adc: use common api for calibration routines
Use same names as adv-v2 peripheral uses. F1 is the only v1 peripheral
adc that has calibration modes at all.

Old:
	adc_calibration(ADC1);  // blocking call

New (blocking):
	adc_calibrate(ADC1);

New (asynch):
	adc_calibrate_async(ADC1);
	// do stuff
	adc_is_calibrating(ADC1);  // false when calibration finished

Old routines are preserved but marked deprecated for now.
2016-09-12 23:29:21 +00:00
Karl Palsson a22d6a8315 stm32: adc: standardize special channel names
At least temp sensor, vrefint and vbat/vlcd should have consistent names and
consistent doxygen.
Dropped channel definitions that are the same as the raw number.
2016-03-30 16:59:55 +00:00
Anatol Pomozov ae41782e1a Fix misspellings using codespell tool 2016-03-08 08:52:54 -08:00
Karl Palsson ff6cc954b7 stm32: adc: drop non-existant adc_set_single_channel
Was only in the (obviously out of date) documented example and as a
declaration.  No implementations.  Dropping immediately, but documentation
still needs further work.
2015-10-17 01:23:56 +00:00
Karl Palsson c72f3d588a Surround all macro parameters with ()
All the macro arguments that are user supplied, or potentially, wrap properly
in () as good practice.

Probably missed one or two, and a lot of them are possibly unnecessary, but
it's straightforward to just do it always.

Fixes github issue #321
2015-10-14 22:15:15 +00:00
Ken Sarkies 7816501dbc Changes to the header includes for all STM32 peripherals
to remove variations, redundancies, add missing, fix errors. All c files
refer only to the dispatch style headers in /include/stm32. Those headers
#include memorymap.h and cm3/common.h. All references to
these are removed from the family specific headers. Ethernet untouched as
it appears incomplete.

Added dummy spi.c for F0/F3. Fix some doxygen anomalies.
2014-03-11 16:40:31 +00:00
Karl Palsson 27bc12de61 stm32: unify bulk of adc convenience functions
This unifies stm32f1, l1, and f4 convenience functions for adc.  The code
should be useable for f2 and f37x as well, but that needs hardware for testing,
and there was no existing implementation. This is the reason for the
"adc_common_v1.c" name, as trying to put all the different families into the
common file name has become too cumbersome.

All of the deprecated routines have been dropped, they've been marked
deprecated for a very long time now, and porting them seemed unnecessary.

This has been tested on f1, l1 and f4 discovery boards, and is based on some
existing l1/f1 unification code from
https://github.com/karlp/libopencm3/tree/rme_l1_master
2014-02-05 10:39:00 +00:00
Karl Palsson 3eaeaf693c stm32: ADC peripheral style 1 header unification
This pulls out all the common header definitions for the F1, L1, F4 and F37x
parts.  It's verified against the datasheet for F2 as well, but we don't have
any good F2 test boards or any support for that yet.  (The F2 header would be
_exactly_ the same as the F4 header, so it's a target for a future round of
unification, not this one)

Tested with f1, f4 and l1 examples from the examples repository.
2014-02-05 10:38:45 +00:00
Piotr Esden-Tempski a909b5ca9e [Style] Global style fix run. 2014-01-03 01:07:30 +01:00
BuFran 6570f6eb07 Fix the order of ADC injected channel list
According to RM0090, page 301, paragraph 11.13.12 Note. (For F4, for F1 and F3 is it in the corresponding manuals)

The JSQR are filled always ending at SQR4 ie for those lists we must set this list:

(A)       ->                               JSQ4 = A,
(A,B)     ->                     JSQ3 = A, JSQ4 = B,
(A,B,C)   ->           JSQ2 = A, JSQ3 = B, JSQ4 = C,
(A,B,C,D) -> JSQ1 = A, JSQ2 = B, JSQ3 = C, JSQ4 = D,

The readed values are in correct order, starting from JDR1:

(A)       -> JDR1 = A,
(A,B)     -> JDR1 = A, JDR2 = B,
(A,B,C)   -> JDR1 = A, JDR2 = B, JDR3 = C,
(A,B,C,D) -> JDR1 = A, JDR2 = B, JDR3 = C, JDR4 = D,
2013-12-04 22:03:23 +00:00
Piotr Esden-Tempski fb5c86db07 Spellchecking fixes. 2013-06-16 14:06:37 -07:00
Piotr Esden-Tempski 39fa9e4c58 Stile fixes run, 80 char boundry. 2013-06-12 21:07:35 -07:00
Piotr Esden-Tempski 34de1e776e Changed to use stdint types. 2013-06-12 19:11:22 -07:00
Piotr Esden-Tempski 7df63fcae0 First coarse run to fix coding style in locm3.
Added --terse and --mailback options to the make stylecheck target. It
also does continue even if it enounters a possible error.

We decided on two exceptions from the linux kernel coding standard:
- Empty wait while loops may end with ; on the same line.
- All blocks after while, if, for have to be in brackets even if they
  only contain one statement. Otherwise it is easy to introduce an
  error.

Checkpatch needs to be adapted to reflect those changes.
2013-06-12 18:22:56 -07:00
Ben Gamari 80824ea22c stm32f1/adc: Kill redundant ADC_SMPR macros 2013-06-02 18:34:12 -07:00
Ken Sarkies f5c9bdfe61 Changes to doxygen markup to solve a few problems that upset
doxygen, and to correct minor errors.
2013-06-02 18:17:49 -07:00
Ken Sarkies e2022f5884 Repair to documentation (most documented files)
to remove errors, duplications and inconsistencies.
File lib/stm32/f1/pwr.c - all code removed as it duplicates that in common/pwr_common.c
Remaining changes do not affect code. Compiles OK.
TODO efm32 has no code so generates no modules
TODO F2 needs pwr.c
TODO L1 needs dma.h and dma.c
2013-03-07 11:14:06 +10:30
chrysn a67a070438 deprecation macro (closes #48) 2012-10-22 15:56:21 +02:00
Felix Ruess 4e4496f70d [fix] GCC < 4.5 that does not accept any argument for the deprecated attribute. 2012-10-17 11:45:52 +02:00
Ken Sarkies 7d0611609b Code changes to stm32f1 adc.c and adc.h
remove rcc_set_adc_clk - use rcc version
Added functions:
 - adc_power_on
 - adc_start_conversion_direct
 - adc_set_dual_mode
 - adc_eoc
 - adc_eoc_injected
 - adc_read_regular
 - adc_read_injected
 - adc_set_injected_offset
Tested dual mode scanned regular, but no tests of injected yet.
Changes: "discontinuous" was misspelled.
 - adc_set_discontinuous_mode_regular - added "length" parameter
 - adc_disable_discontinuous_mode_regular - name change
 - adc_enable_discontinuous_mode_injected - name change
 - adc_enable_automatic_injected_group_conversion - disable triggers
 - adc_enable_jeoc_interrupt - name change to match common usage in lib
 - adc_disable_jeoc_interrupt - ditto
 - adc_enable_external_trigger_regular - remove incorrect test on parameter
 - adc_enable_external_trigger_injected - ditto
 - adc_set_sample_time - name change to match function's purpose
 - adc_set_conversion_time_on_all_channels - ditto
 - adc_set_injected_sequence - changed order of register loading (ref Barlow's issue)
 - adc_enable_analog_watchdog_on_all_channels - flipped AWDSGL
 - adc_enable_analog_watchdog_on_selected_channel - ditto
added aliases for expected commonly used functions to avoid sudden user code breakage

In adc.h, corrected errors in SQR names
added "deprecated" compiler warnings to adc_on and to aliases defined in adc.c
2012-10-05 13:50:42 +09:30
Nicolas Schodet 7851515c5c Fix merge error
This line was removed in commit acc276a612, but it has been restored in the
merge 02ea612142.
2012-09-17 17:27:50 -07:00
Piotr Esden-Tempski 02ea612142 Merge pull request #25 "Add support for C++ and fix some comments typo"
Merge remote-tracking branch 'schodet/master'

Conflicts:
	include/libopencm3/stm32/f1/adc.h
2012-09-10 12:21:21 -07:00
Nicolas Schodet 3aab6220d8 Add C linkage declaration for C++ usage 2012-09-02 17:12:58 +02:00
Ken Sarkies 9af50d6e5c STM32F1xx Additional minor changes to adc.h and adc.c 2012-08-31 21:47:30 +09:30
Ken Sarkies acc276a612 ADC documentation added
In adc.h additional defines needed to assist documentation - lines 172-191
added, and 384,436-451 are duplicates of earlier defines to complete
parameter sets (compiler has no trouble with these).

Minor doc corrections to other files.

No code changes (apart from additional defines).
2012-08-31 09:54:31 +09:30
Piotr Esden-Tempski ec34e21ead Changed parameter size for trigger enable. 2012-03-19 20:20:05 -07:00
Piotr Esden-Tempski 451a5e227d Started some cleanup in the ADC headers and convenience code. 2012-03-19 17:38:24 -07:00
Piotr Esden-Tempski 43561de329 License change of the library to LGPL, version 3 or later.
Agreed to by all the significant contributors to the library.
2012-03-02 14:44:49 -08:00
Fergus Noble 4eff339e8c Restructuring stm32 include directories. 2011-10-12 22:13:01 -04:00