mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-06 15:01:35 +00:00
Replace the stubs by an actual implementation for ADC and Analog watchdog support on STM32F0xx chips. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=manually read ADC values on STM32F072B discovery. TEST=read all ADC values at once. TEST=Enable watchdog and check it fires when the voltage goes out of range. TEST=read ADC value(s) while watchdog is enabled. TEST=Disable watchdog and check it's actually disabled. Change-Id: Ie6fbd1aa95a3d76394fa47803e8cfc24bf5e4562 Reviewed-on: https://chromium-review.googlesource.com/190710 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
35 lines
884 B
C
35 lines
884 B
C
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
/* STM32-specific ADC module for Chrome EC */
|
|
|
|
#ifndef __CROS_EC_ADC_CHIP_H
|
|
#define __CROS_EC_ADC_CHIP_H
|
|
|
|
/* Data structure to define ADC channels. */
|
|
struct adc_t {
|
|
const char *name;
|
|
int factor_mul;
|
|
int factor_div;
|
|
int shift;
|
|
int channel;
|
|
};
|
|
|
|
/*
|
|
* Boards must provide this list of ADC channel definitions. This must match
|
|
* the enum adc_channel list provided by the board. Also, for STM32F0, this
|
|
* must be ordered by AIN ID.
|
|
*/
|
|
extern const struct adc_t adc_channels[];
|
|
|
|
/* Minimum and maximum values returned by adc_read_channel(). */
|
|
#define ADC_READ_MIN 0
|
|
#define ADC_READ_MAX 4095
|
|
|
|
/* Just plain id mapping for code readability */
|
|
#define STM32_AIN(x) (x)
|
|
|
|
#endif /* __CROS_EC_ADC_CHIP_H */
|