remove unused ASF code
This commit is contained in:
@@ -1,277 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief ADC functionality declaration.
|
||||
*
|
||||
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Subject to your compliance with these terms, you may use Microchip
|
||||
* software and any derivatives exclusively with Microchip products.
|
||||
* It is your responsibility to comply with third party license terms applicable
|
||||
* to your use of third party software (including open source software) that
|
||||
* may accompany Microchip software.
|
||||
*
|
||||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
|
||||
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
|
||||
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
|
||||
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
|
||||
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
|
||||
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
|
||||
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
|
||||
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HAL_ADC_SYNC_H_INCLUDED
|
||||
#define _HAL_ADC_SYNC_H_INCLUDED
|
||||
|
||||
#include <hpl_adc_sync.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup doc_driver_hal_adc_sync
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief ADC descriptor
|
||||
*
|
||||
* The ADC descriptor forward declaration.
|
||||
*/
|
||||
struct adc_sync_descriptor;
|
||||
|
||||
/**
|
||||
* \brief ADC descriptor
|
||||
*/
|
||||
struct adc_sync_descriptor {
|
||||
/** ADC device */
|
||||
struct _adc_sync_device device;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Initialize ADC
|
||||
*
|
||||
* This function initializes the given ADC descriptor.
|
||||
* It checks if the given hardware is not initialized and if the given hardware
|
||||
* is permitted to be initialized.
|
||||
*
|
||||
* \param[out] descr An ADC descriptor to initialize
|
||||
* \param[in] hw The pointer to hardware instance
|
||||
* \param[in] func The pointer to a set of functions pointers
|
||||
*
|
||||
* \return Initialization status.
|
||||
*/
|
||||
int32_t adc_sync_init(struct adc_sync_descriptor *const descr, void *const hw, void *const func);
|
||||
|
||||
/**
|
||||
* \brief Deinitialize ADC
|
||||
*
|
||||
* This function deinitializes the given ADC descriptor.
|
||||
* It checks if the given hardware is initialized and if the given hardware is
|
||||
* permitted to be deinitialized.
|
||||
*
|
||||
* \param[in] descr An ADC descriptor to deinitialize
|
||||
*
|
||||
* \return De-initialization status.
|
||||
*/
|
||||
int32_t adc_sync_deinit(struct adc_sync_descriptor *const descr);
|
||||
|
||||
/**
|
||||
* \brief Enable ADC
|
||||
*
|
||||
* Use this function to set the ADC peripheral to enabled state.
|
||||
*
|
||||
* \param[in] descr Pointer to the ADC descriptor
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return Operation status
|
||||
*
|
||||
*/
|
||||
int32_t adc_sync_enable_channel(struct adc_sync_descriptor *const descr, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Disable ADC
|
||||
*
|
||||
* Use this function to set the ADC peripheral to disabled state.
|
||||
*
|
||||
* \param[in] descr Pointer to the ADC descriptor
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return Operation status
|
||||
*
|
||||
*/
|
||||
int32_t adc_sync_disable_channel(struct adc_sync_descriptor *const descr, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Read data from ADC
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] buf A buffer to read data to
|
||||
* \param[in] length The size of a buffer
|
||||
*
|
||||
* \return The number of bytes read.
|
||||
*/
|
||||
int32_t adc_sync_read_channel(struct adc_sync_descriptor *const descr, const uint8_t channel, uint8_t *const buffer,
|
||||
const uint16_t length);
|
||||
|
||||
/**
|
||||
* \brief Set ADC reference source
|
||||
*
|
||||
* This function sets ADC reference source.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] reference A reference source to set
|
||||
*
|
||||
* \return Status of the ADC reference source setting.
|
||||
*/
|
||||
int32_t adc_sync_set_reference(struct adc_sync_descriptor *const descr, const adc_reference_t reference);
|
||||
|
||||
/**
|
||||
* \brief Set ADC resolution
|
||||
*
|
||||
* This function sets ADC resolution.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] resolution A resolution to set
|
||||
*
|
||||
* \return Status of the ADC resolution setting.
|
||||
*/
|
||||
int32_t adc_sync_set_resolution(struct adc_sync_descriptor *const descr, const adc_resolution_t resolution);
|
||||
|
||||
/**
|
||||
* \brief Set ADC input source of a channel
|
||||
*
|
||||
* This function sets ADC positive and negative input sources.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] pos_input A positive input source to set
|
||||
* \param[in] neg_input A negative input source to set
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return Status of the ADC channels setting.
|
||||
*/
|
||||
int32_t adc_sync_set_inputs(struct adc_sync_descriptor *const descr, const adc_pos_input_t pos_input,
|
||||
const adc_neg_input_t neg_input, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Set ADC conversion mode
|
||||
*
|
||||
* This function sets ADC conversion mode.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] mode A conversion mode to set
|
||||
*
|
||||
* \return Status of the ADC conversion mode setting.
|
||||
*/
|
||||
int32_t adc_sync_set_conversion_mode(struct adc_sync_descriptor *const descr, const enum adc_conversion_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set ADC differential mode
|
||||
*
|
||||
* This function sets ADC differential mode.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] mode A differential mode to set
|
||||
*
|
||||
* \return Status of the ADC differential mode setting.
|
||||
*/
|
||||
int32_t adc_sync_set_channel_differential_mode(struct adc_sync_descriptor *const descr, const uint8_t channel,
|
||||
const enum adc_differential_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set ADC channel gain
|
||||
*
|
||||
* This function sets ADC channel gain.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] gain A gain to set
|
||||
*
|
||||
* \return Status of the ADC gain setting.
|
||||
*/
|
||||
int32_t adc_sync_set_channel_gain(struct adc_sync_descriptor *const descr, const uint8_t channel,
|
||||
const adc_gain_t gain);
|
||||
|
||||
/**
|
||||
* \brief Set ADC window mode
|
||||
*
|
||||
* This function sets ADC window mode.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] mode A window mode to set
|
||||
*
|
||||
* \return Status of the ADC window mode setting.
|
||||
*/
|
||||
int32_t adc_sync_set_window_mode(struct adc_sync_descriptor *const descr, const adc_window_mode_t mode);
|
||||
|
||||
/**
|
||||
* \brief Set ADC thresholds
|
||||
*
|
||||
* This function sets ADC positive and negative thresholds.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] low_threshold A lower thresholds to set
|
||||
* \param[in] up_threshold An upper thresholds to set
|
||||
*
|
||||
* \return Status of the ADC thresholds setting.
|
||||
*/
|
||||
int32_t adc_sync_set_thresholds(struct adc_sync_descriptor *const descr, const adc_threshold_t low_threshold,
|
||||
const adc_threshold_t up_threshold);
|
||||
|
||||
/**
|
||||
* \brief Retrieve threshold state
|
||||
*
|
||||
* This function retrieves ADC threshold state.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[out] state The threshold state
|
||||
*
|
||||
* \return The state of ADC thresholds state retrieving.
|
||||
*/
|
||||
int32_t adc_sync_get_threshold_state(const struct adc_sync_descriptor *const descr,
|
||||
adc_threshold_status_t *const state);
|
||||
|
||||
/**
|
||||
* \brief Check if conversion is complete
|
||||
*
|
||||
* This function checks if the ADC has finished the conversion.
|
||||
*
|
||||
* \param[in] descr The pointer to the ADC descriptor
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return The status of ADC conversion completion checking.
|
||||
* \retval 1 The conversion is complete
|
||||
* \retval 0 The conversion is not complete
|
||||
*/
|
||||
int32_t adc_sync_is_channel_conversion_complete(const struct adc_sync_descriptor *const descr, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Retrieve the current driver version
|
||||
*
|
||||
* \return Current driver version.
|
||||
*/
|
||||
uint32_t adc_sync_get_version(void);
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <hpl_missing_features.h>
|
||||
|
||||
#endif /* _HAL_ADC_SYNC_H_INCLUDED */
|
||||
@@ -1,153 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief PWM functionality declaration.
|
||||
*
|
||||
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Subject to your compliance with these terms, you may use Microchip
|
||||
* software and any derivatives exclusively with Microchip products.
|
||||
* It is your responsibility to comply with third party license terms applicable
|
||||
* to your use of third party software (including open source software) that
|
||||
* may accompany Microchip software.
|
||||
*
|
||||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
|
||||
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
|
||||
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
|
||||
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
|
||||
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
|
||||
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
|
||||
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
|
||||
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HAL_PWM_H_INCLUDED
|
||||
#define HAL_PWM_H_INCLUDED
|
||||
|
||||
#include <hpl_pwm.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \addtogroup doc_driver_hal_pwm_async
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief PWM descriptor
|
||||
*
|
||||
* The PWM descriptor forward declaration.
|
||||
*/
|
||||
struct pwm_descriptor;
|
||||
|
||||
/**
|
||||
* \brief PWM callback type
|
||||
*/
|
||||
typedef void (*pwm_cb_t)(const struct pwm_descriptor *const descr);
|
||||
|
||||
/**
|
||||
* \brief PWM callback types
|
||||
*/
|
||||
enum pwm_callback_type { PWM_PERIOD_CB, PWM_ERROR_CB };
|
||||
|
||||
/**
|
||||
* \brief PWM callbacks
|
||||
*/
|
||||
struct pwm_callbacks {
|
||||
pwm_cb_t period;
|
||||
pwm_cb_t error;
|
||||
};
|
||||
|
||||
/** \brief PWM descriptor
|
||||
*/
|
||||
struct pwm_descriptor {
|
||||
/** PWM device */
|
||||
struct _pwm_device device;
|
||||
/** PWM callback structure */
|
||||
struct pwm_callbacks pwm_cb;
|
||||
/** PWM HPL interface pointer */
|
||||
struct _pwm_hpl_interface *func;
|
||||
};
|
||||
|
||||
/** \brief Initialize the PWM HAL instance and hardware
|
||||
*
|
||||
* \param[in] descr Pointer to the HAL PWM descriptor
|
||||
* \param[in] hw The pointer to hardware instance
|
||||
* \param[in] func The pointer to a set of functions pointers
|
||||
*
|
||||
* \return Operation status.
|
||||
*/
|
||||
int32_t pwm_init(struct pwm_descriptor *const descr, void *const hw, struct _pwm_hpl_interface *const func);
|
||||
|
||||
/** \brief Deinitialize the PWM HAL instance and hardware
|
||||
*
|
||||
* \param[in] descr Pointer to the HAL PWM descriptor
|
||||
*
|
||||
* \return Operation status.
|
||||
*/
|
||||
int32_t pwm_deinit(struct pwm_descriptor *const descr);
|
||||
|
||||
/** \brief PWM output start
|
||||
*
|
||||
* \param[in] descr Pointer to the HAL PWM descriptor
|
||||
*
|
||||
* \return Operation status.
|
||||
*/
|
||||
int32_t pwm_enable(struct pwm_descriptor *const descr);
|
||||
|
||||
/** \brief PWM output stop
|
||||
*
|
||||
* \param[in] descr Pointer to the HAL PWM descriptor
|
||||
*
|
||||
* \return Operation status.
|
||||
*/
|
||||
int32_t pwm_disable(struct pwm_descriptor *const descr);
|
||||
|
||||
/** \brief Register PWM callback
|
||||
*
|
||||
* \param[in] descr Pointer to the HAL PWM descriptor
|
||||
* \param[in] type Callback type
|
||||
* \param[in] cb A callback function, passing NULL de-registers callback
|
||||
*
|
||||
* \return Operation status.
|
||||
* \retval 0 Success
|
||||
* \retval -1 Error
|
||||
*/
|
||||
int32_t pwm_register_callback(struct pwm_descriptor *const descr, enum pwm_callback_type type, pwm_cb_t cb);
|
||||
|
||||
/** \brief Change PWM parameter
|
||||
*
|
||||
* \param[in] descr Pointer to the HAL PWM descriptor
|
||||
* \param[in] period Total period of one PWM cycle
|
||||
* \param[in] duty_cycle Period of PWM first half during one cycle
|
||||
*
|
||||
* \return Operation status.
|
||||
*/
|
||||
int32_t pwm_set_parameters(struct pwm_descriptor *const descr, const pwm_period_t period,
|
||||
const pwm_period_t duty_cycle);
|
||||
|
||||
/** \brief Get PWM driver version
|
||||
*
|
||||
* \return Current driver version.
|
||||
*/
|
||||
uint32_t pwm_get_version(void);
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* HAL_PWM;_H_INCLUDED */
|
||||
@@ -1,264 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief ADC related functionality declaration.
|
||||
*
|
||||
* Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Subject to your compliance with these terms, you may use Microchip
|
||||
* software and any derivatives exclusively with Microchip products.
|
||||
* It is your responsibility to comply with third party license terms applicable
|
||||
* to your use of third party software (including open source software) that
|
||||
* may accompany Microchip software.
|
||||
*
|
||||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
|
||||
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
|
||||
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
|
||||
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
|
||||
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
|
||||
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
|
||||
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
|
||||
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HPL_ADC_ASYNC_H_INCLUDED
|
||||
#define _HPL_ADC_ASYNC_H_INCLUDED
|
||||
|
||||
/**
|
||||
* \addtogroup HPL ADC
|
||||
*
|
||||
* \section hpl_async_adc_rev Revision History
|
||||
* - v1.0.0 Initial Release
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include "hpl_adc_sync.h"
|
||||
#include "hpl_irq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief ADC device structure
|
||||
*
|
||||
* The ADC device structure forward declaration.
|
||||
*/
|
||||
struct _adc_async_device;
|
||||
|
||||
/**
|
||||
* \brief ADC callback types
|
||||
*/
|
||||
enum _adc_async_callback_type { ADC_ASYNC_DEVICE_CONVERT_CB, ADC_ASYNC_DEVICE_MONITOR_CB, ADC_ASYNC_DEVICE_ERROR_CB };
|
||||
|
||||
/**
|
||||
* \brief ADC interrupt callbacks
|
||||
*/
|
||||
struct _adc_async_callbacks {
|
||||
void (*window_cb)(struct _adc_async_device *device, const uint8_t channel);
|
||||
void (*error_cb)(struct _adc_async_device *device, const uint8_t channel);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief ADC channel interrupt callbacks
|
||||
*/
|
||||
struct _adc_async_ch_callbacks {
|
||||
void (*convert_done)(struct _adc_async_device *device, const uint8_t channel, const uint16_t data);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief ADC descriptor device structure
|
||||
*/
|
||||
struct _adc_async_device {
|
||||
struct _adc_async_callbacks adc_async_cb;
|
||||
struct _adc_async_ch_callbacks adc_async_ch_cb;
|
||||
struct _irq_descriptor irq;
|
||||
void * hw;
|
||||
};
|
||||
|
||||
/**
|
||||
* \name HPL functions
|
||||
*/
|
||||
//@{
|
||||
/**
|
||||
* \brief Initialize synchronous ADC
|
||||
*
|
||||
* This function does low level ADC configuration.
|
||||
*
|
||||
* param[in] device The pointer to ADC device instance
|
||||
* param[in] hw The pointer to hardware instance
|
||||
*
|
||||
* \return Initialization status
|
||||
*/
|
||||
int32_t _adc_async_init(struct _adc_async_device *const device, void *const hw);
|
||||
|
||||
/**
|
||||
* \brief Deinitialize ADC
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*/
|
||||
void _adc_async_deinit(struct _adc_async_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Enable ADC peripheral
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_async_enable_channel(struct _adc_async_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Disable ADC peripheral
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_async_disable_channel(struct _adc_async_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Retrieve ADC conversion data size
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*
|
||||
* \return The data size in bytes
|
||||
*/
|
||||
uint8_t _adc_async_get_data_size(const struct _adc_async_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Check if conversion is done
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return The status of conversion
|
||||
* \retval true The conversion is done
|
||||
* \retval false The conversion is not done
|
||||
*/
|
||||
bool _adc_async_is_channel_conversion_done(const struct _adc_async_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Make conversion
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*/
|
||||
void _adc_async_convert(struct _adc_async_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Retrieve the conversion result
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* The result value
|
||||
*/
|
||||
uint16_t _adc_async_read_channel_data(const struct _adc_async_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Set reference source
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] reference A reference source to set
|
||||
*/
|
||||
void _adc_async_set_reference_source(struct _adc_async_device *const device, const adc_reference_t reference);
|
||||
|
||||
/**
|
||||
* \brief Set resolution
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] resolution A resolution to set
|
||||
*/
|
||||
void _adc_async_set_resolution(struct _adc_async_device *const device, const adc_resolution_t resolution);
|
||||
|
||||
/**
|
||||
* \brief Set ADC input source of a channel
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] pos_input A positive input source to set
|
||||
* \param[in] neg_input A negative input source to set
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_async_set_inputs(struct _adc_async_device *const device, const adc_pos_input_t pos_input,
|
||||
const adc_neg_input_t neg_input, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Set conversion mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] mode A conversion mode to set
|
||||
*/
|
||||
void _adc_async_set_conversion_mode(struct _adc_async_device *const device, const enum adc_conversion_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set differential mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] mode A differential mode to set
|
||||
*/
|
||||
void _adc_async_set_channel_differential_mode(struct _adc_async_device *const device, const uint8_t channel,
|
||||
const enum adc_differential_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set gain
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] gain A gain to set
|
||||
*/
|
||||
void _adc_async_set_channel_gain(struct _adc_async_device *const device, const uint8_t channel, const adc_gain_t gain);
|
||||
|
||||
/**
|
||||
* \brief Set window mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] mode A mode to set
|
||||
*/
|
||||
void _adc_async_set_window_mode(struct _adc_async_device *const device, const adc_window_mode_t mode);
|
||||
|
||||
/**
|
||||
* \brief Set lower threshold
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] low_threshold A lower threshold to set
|
||||
* \param[in] up_threshold An upper thresholds to set
|
||||
*/
|
||||
void _adc_async_set_thresholds(struct _adc_async_device *const device, const adc_threshold_t low_threshold,
|
||||
const adc_threshold_t up_threshold);
|
||||
|
||||
/**
|
||||
* \brief Retrieve threshold state
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[out] state The threshold state
|
||||
*/
|
||||
void _adc_async_get_threshold_state(const struct _adc_async_device *const device, adc_threshold_status_t *const state);
|
||||
|
||||
/**
|
||||
* \brief Enable/disable ADC channel interrupt
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] type The type of interrupt to disable/enable if applicable
|
||||
* \param[in] state Enable or disable
|
||||
*/
|
||||
void _adc_async_set_irq_state(struct _adc_async_device *const device, const uint8_t channel,
|
||||
const enum _adc_async_callback_type type, const bool state);
|
||||
|
||||
//@}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**@}*/
|
||||
#endif /* _HPL_ADC_ASYNC_H_INCLUDED */
|
||||
@@ -1,243 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief ADC related functionality declaration.
|
||||
*
|
||||
* Copyright (c) 2016-2018 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Subject to your compliance with these terms, you may use Microchip
|
||||
* software and any derivatives exclusively with Microchip products.
|
||||
* It is your responsibility to comply with third party license terms applicable
|
||||
* to your use of third party software (including open source software) that
|
||||
* may accompany Microchip software.
|
||||
*
|
||||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
|
||||
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
|
||||
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
|
||||
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
|
||||
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
|
||||
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
|
||||
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
|
||||
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HPL_ADC_DMA_H_INCLUDED
|
||||
#define _HPL_ADC_DMA_H_INCLUDED
|
||||
|
||||
/**
|
||||
* \addtogroup HPL ADC
|
||||
*
|
||||
* \section hpl_dma_adc_rev Revision History
|
||||
* - v1.0.0 Initial Release
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include <hpl_adc_sync.h>
|
||||
#include <hpl_irq.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief ADC device structure
|
||||
*
|
||||
* The ADC device structure forward declaration.
|
||||
*/
|
||||
struct _adc_dma_device;
|
||||
|
||||
/**
|
||||
* \brief ADC callback types
|
||||
*/
|
||||
enum _adc_dma_callback_type { ADC_DMA_DEVICE_COMPLETE_CB, ADC_DMA_DEVICE_ERROR_CB };
|
||||
|
||||
/**
|
||||
* \brief ADC interrupt callbacks
|
||||
*/
|
||||
struct _adc_dma_callbacks {
|
||||
void (*complete)(struct _adc_dma_device *device, const uint16_t data);
|
||||
void (*error)(struct _adc_dma_device *device);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief ADC descriptor device structure
|
||||
*/
|
||||
struct _adc_dma_device {
|
||||
struct _adc_dma_callbacks adc_dma_cb;
|
||||
struct _irq_descriptor irq;
|
||||
void * hw;
|
||||
};
|
||||
|
||||
/**
|
||||
* \name HPL functions
|
||||
*/
|
||||
//@{
|
||||
/**
|
||||
* \brief Initialize synchronous ADC
|
||||
*
|
||||
* This function does low level ADC configuration.
|
||||
*
|
||||
* param[in] device The pointer to ADC device instance
|
||||
* param[in] hw The pointer to hardware instance
|
||||
*
|
||||
* \return Initialization status
|
||||
*/
|
||||
int32_t _adc_dma_init(struct _adc_dma_device *const device, void *const hw);
|
||||
|
||||
/**
|
||||
* \brief Deinitialize ADC
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*/
|
||||
void _adc_dma_deinit(struct _adc_dma_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Enable ADC peripheral
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_dma_enable_channel(struct _adc_dma_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Disable ADC peripheral
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_dma_disable_channel(struct _adc_dma_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Return address of ADC DMA source
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*
|
||||
* \return ADC DMA source address
|
||||
*/
|
||||
uint32_t _adc_get_source_for_dma(struct _adc_dma_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Retrieve ADC conversion data size
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*
|
||||
* \return The data size in bytes
|
||||
*/
|
||||
uint8_t _adc_dma_get_data_size(const struct _adc_dma_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Check if conversion is done
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*
|
||||
* \return The status of conversion
|
||||
* \retval true The conversion is done
|
||||
* \retval false The conversion is not done
|
||||
*/
|
||||
bool _adc_dma_is_conversion_done(const struct _adc_dma_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Make conversion
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*/
|
||||
void _adc_dma_convert(struct _adc_dma_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Set reference source
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] reference A reference source to set
|
||||
*/
|
||||
void _adc_dma_set_reference_source(struct _adc_dma_device *const device, const adc_reference_t reference);
|
||||
|
||||
/**
|
||||
* \brief Set resolution
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] resolution A resolution to set
|
||||
*/
|
||||
void _adc_dma_set_resolution(struct _adc_dma_device *const device, const adc_resolution_t resolution);
|
||||
|
||||
/**
|
||||
* \brief Set ADC input source of a channel
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] pos_input A positive input source to set
|
||||
* \param[in] neg_input A negative input source to set
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_dma_set_inputs(struct _adc_dma_device *const device, const adc_pos_input_t pos_input,
|
||||
const adc_neg_input_t neg_input, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Set conversion mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] mode A conversion mode to set
|
||||
*/
|
||||
void _adc_dma_set_conversion_mode(struct _adc_dma_device *const device, const enum adc_conversion_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set differential mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] mode A differential mode to set
|
||||
*/
|
||||
void _adc_dma_set_channel_differential_mode(struct _adc_dma_device *const device, const uint8_t channel,
|
||||
const enum adc_differential_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set gain
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] gain A gain to set
|
||||
*/
|
||||
void _adc_dma_set_channel_gain(struct _adc_dma_device *const device, const uint8_t channel, const adc_gain_t gain);
|
||||
|
||||
/**
|
||||
* \brief Set window mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] mode A mode to set
|
||||
*/
|
||||
void _adc_dma_set_window_mode(struct _adc_dma_device *const device, const adc_window_mode_t mode);
|
||||
|
||||
/**
|
||||
* \brief Set thresholds
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] low_threshold A lower thresholds to set
|
||||
* \param[in] up_threshold An upper thresholds to set
|
||||
*/
|
||||
void _adc_dma_set_thresholds(struct _adc_dma_device *const device, const adc_threshold_t low_threshold,
|
||||
const adc_threshold_t up_threshold);
|
||||
|
||||
/**
|
||||
* \brief Retrieve threshold state
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[out] state The threshold state
|
||||
*/
|
||||
void _adc_dma_get_threshold_state(const struct _adc_dma_device *const device, adc_threshold_status_t *const state);
|
||||
|
||||
//@}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**@}*/
|
||||
#endif /* _HPL_ADC_DMA_H_INCLUDED */
|
||||
@@ -1,271 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief ADC related functionality declaration.
|
||||
*
|
||||
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Subject to your compliance with these terms, you may use Microchip
|
||||
* software and any derivatives exclusively with Microchip products.
|
||||
* It is your responsibility to comply with third party license terms applicable
|
||||
* to your use of third party software (including open source software) that
|
||||
* may accompany Microchip software.
|
||||
*
|
||||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
|
||||
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
|
||||
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
|
||||
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
|
||||
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
|
||||
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
|
||||
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
|
||||
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _HPL_ADC_SYNC_H_INCLUDED
|
||||
#define _HPL_ADC_SYNC_H_INCLUDED
|
||||
|
||||
/**
|
||||
* \addtogroup HPL ADC
|
||||
*
|
||||
* \section hpl_adc_sync_rev Revision History
|
||||
* - v1.0.0 Initial Release
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include "compiler.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief ADC reference source
|
||||
*/
|
||||
typedef uint8_t adc_reference_t;
|
||||
|
||||
/**
|
||||
* \brief ADC resolution
|
||||
*/
|
||||
typedef uint8_t adc_resolution_t;
|
||||
|
||||
/**
|
||||
* \brief ADC positive input for channel
|
||||
*/
|
||||
typedef uint8_t adc_pos_input_t;
|
||||
|
||||
/**
|
||||
* \brief ADC negative input for channel
|
||||
*/
|
||||
typedef uint8_t adc_neg_input_t;
|
||||
|
||||
/**
|
||||
* \brief ADC threshold
|
||||
*/
|
||||
typedef uint16_t adc_threshold_t;
|
||||
|
||||
/**
|
||||
* \brief ADC gain
|
||||
*/
|
||||
typedef uint8_t adc_gain_t;
|
||||
|
||||
/**
|
||||
* \brief ADC conversion mode
|
||||
*/
|
||||
enum adc_conversion_mode { ADC_CONVERSION_MODE_SINGLE_CONVERSION = 0, ADC_CONVERSION_MODE_FREERUN };
|
||||
|
||||
/**
|
||||
* \brief ADC differential mode
|
||||
*/
|
||||
enum adc_differential_mode { ADC_DIFFERENTIAL_MODE_SINGLE_ENDED = 0, ADC_DIFFERENTIAL_MODE_DIFFERENTIAL };
|
||||
|
||||
/**
|
||||
* \brief ADC window mode
|
||||
*/
|
||||
typedef uint8_t adc_window_mode_t;
|
||||
|
||||
/**
|
||||
* \brief ADC threshold status
|
||||
*/
|
||||
typedef bool adc_threshold_status_t;
|
||||
|
||||
/**
|
||||
* \brief ADC sync descriptor device structure
|
||||
*/
|
||||
struct _adc_sync_device {
|
||||
void *hw;
|
||||
};
|
||||
|
||||
/**
|
||||
* \name HPL functions
|
||||
*/
|
||||
//@{
|
||||
/**
|
||||
* \brief Initialize synchronous ADC
|
||||
*
|
||||
* This function does low level ADC configuration.
|
||||
*
|
||||
* param[in] device The pointer to ADC device instance
|
||||
* param[in] hw The pointer to hardware instance
|
||||
*
|
||||
* \return Initialization status
|
||||
*/
|
||||
int32_t _adc_sync_init(struct _adc_sync_device *const device, void *const hw);
|
||||
|
||||
/**
|
||||
* \brief Deinitialize ADC
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*/
|
||||
void _adc_sync_deinit(struct _adc_sync_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Enable ADC
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_sync_enable_channel(struct _adc_sync_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Disable ADC
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_sync_disable_channel(struct _adc_sync_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Retrieve ADC conversion data size
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*
|
||||
* \return The data size in bytes
|
||||
*/
|
||||
uint8_t _adc_sync_get_data_size(const struct _adc_sync_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Check if conversion is done
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return The status of conversion
|
||||
* \retval true The conversion is done
|
||||
* \retval false The conversion is not done
|
||||
*/
|
||||
bool _adc_sync_is_channel_conversion_done(const struct _adc_sync_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Make conversion
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
*/
|
||||
void _adc_sync_convert(struct _adc_sync_device *const device);
|
||||
|
||||
/**
|
||||
* \brief Retrieve the conversion result
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
*
|
||||
* \return The result value of channel
|
||||
*/
|
||||
uint16_t _adc_sync_read_channel_data(const struct _adc_sync_device *const device, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Set reference source
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] reference A reference source to set
|
||||
*/
|
||||
void _adc_sync_set_reference_source(struct _adc_sync_device *const device, const adc_reference_t reference);
|
||||
|
||||
/**
|
||||
* \brief Set resolution
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] resolution A resolution to set
|
||||
*/
|
||||
void _adc_sync_set_resolution(struct _adc_sync_device *const device, const adc_resolution_t resolution);
|
||||
|
||||
/**
|
||||
* \brief Set ADC input source of a channel
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] pos_input A positive input source to set
|
||||
* \param[in] neg_input A negative input source to set
|
||||
* \param[in] channel Channel number
|
||||
*/
|
||||
void _adc_sync_set_inputs(struct _adc_sync_device *const device, const adc_pos_input_t pos_input,
|
||||
const adc_neg_input_t neg_input, const uint8_t channel);
|
||||
|
||||
/**
|
||||
* \brief Set conversion mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] mode A conversion mode to set
|
||||
*/
|
||||
void _adc_sync_set_conversion_mode(struct _adc_sync_device *const device, const enum adc_conversion_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set differential mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] mode A differential mode to set
|
||||
*/
|
||||
void _adc_sync_set_channel_differential_mode(struct _adc_sync_device *const device, const uint8_t channel,
|
||||
const enum adc_differential_mode mode);
|
||||
|
||||
/**
|
||||
* \brief Set gain
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] channel Channel number
|
||||
* \param[in] gain A gain to set
|
||||
*/
|
||||
void _adc_sync_set_channel_gain(struct _adc_sync_device *const device, const uint8_t channel, const adc_gain_t gain);
|
||||
|
||||
/**
|
||||
* \brief Set window mode
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] mode A mode to set
|
||||
*/
|
||||
void _adc_sync_set_window_mode(struct _adc_sync_device *const device, const adc_window_mode_t mode);
|
||||
|
||||
/**
|
||||
* \brief Set threshold
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[in] low_threshold A lower threshold to set
|
||||
* \param[in] up_threshold An upper thresholds to set
|
||||
*/
|
||||
void _adc_sync_set_thresholds(struct _adc_sync_device *const device, const adc_threshold_t low_threshold,
|
||||
const adc_threshold_t up_threshold);
|
||||
|
||||
/**
|
||||
* \brief Retrieve threshold state
|
||||
*
|
||||
* \param[in] device The pointer to ADC device instance
|
||||
* \param[out] state The threshold state
|
||||
*/
|
||||
void _adc_sync_get_threshold_state(const struct _adc_sync_device *const device, adc_threshold_status_t *const state);
|
||||
//@}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**@}*/
|
||||
#endif /* _HPL_ADC_SYNC_H_INCLUDED */
|
||||
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
*
|
||||
* \brief PWM related functionality declaration.
|
||||
*
|
||||
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
|
||||
*
|
||||
* \asf_license_start
|
||||
*
|
||||
* \page License
|
||||
*
|
||||
* Subject to your compliance with these terms, you may use Microchip
|
||||
* software and any derivatives exclusively with Microchip products.
|
||||
* It is your responsibility to comply with third party license terms applicable
|
||||
* to your use of third party software (including open source software) that
|
||||
* may accompany Microchip software.
|
||||
*
|
||||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
|
||||
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
|
||||
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
|
||||
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
|
||||
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
|
||||
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
|
||||
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
|
||||
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
|
||||
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
|
||||
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
|
||||
*
|
||||
* \asf_license_stop
|
||||
*
|
||||
*/
|
||||
#ifndef _HPL_PWM_H_INCLUDED
|
||||
#define _HPL_PWM_H_INCLUDED
|
||||
|
||||
/**
|
||||
* \addtogroup HPL PWM
|
||||
*
|
||||
* \section hpl_pwm_rev Revision History
|
||||
* - v1.0.0 Initial Release
|
||||
*
|
||||
*@{
|
||||
*/
|
||||
|
||||
#include <compiler.h>
|
||||
#include "hpl_irq.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief PWM callback types
|
||||
*/
|
||||
enum _pwm_callback_type { PWM_DEVICE_PERIOD_CB, PWM_DEVICE_ERROR_CB };
|
||||
|
||||
/**
|
||||
* \brief PWM pulse-width period
|
||||
*/
|
||||
typedef uint32_t pwm_period_t;
|
||||
|
||||
/**
|
||||
* \brief PWM device structure
|
||||
*
|
||||
* The PWM device structure forward declaration.
|
||||
*/
|
||||
struct _pwm_device;
|
||||
|
||||
/**
|
||||
* \brief PWM interrupt callbacks
|
||||
*/
|
||||
struct _pwm_callback {
|
||||
void (*pwm_period_cb)(struct _pwm_device *device);
|
||||
void (*pwm_error_cb)(struct _pwm_device *device);
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief PWM descriptor device structure
|
||||
*/
|
||||
struct _pwm_device {
|
||||
struct _pwm_callback callback;
|
||||
struct _irq_descriptor irq;
|
||||
void * hw;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief PWM functions, pointers to low-level functions
|
||||
*/
|
||||
struct _pwm_hpl_interface {
|
||||
int32_t (*init)(struct _pwm_device *const device, void *const hw);
|
||||
void (*deinit)(struct _pwm_device *const device);
|
||||
void (*start_pwm)(struct _pwm_device *const device);
|
||||
void (*stop_pwm)(struct _pwm_device *const device);
|
||||
void (*set_pwm_param)(struct _pwm_device *const device, const pwm_period_t period, const pwm_period_t duty_cycle);
|
||||
bool (*is_pwm_enabled)(const struct _pwm_device *const device);
|
||||
pwm_period_t (*pwm_get_period)(const struct _pwm_device *const device);
|
||||
uint32_t (*pwm_get_duty)(const struct _pwm_device *const device);
|
||||
void (*set_irq_state)(struct _pwm_device *const device, const enum _pwm_callback_type type, const bool disable);
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
/**@}*/
|
||||
#endif /* _HPL_PWM_H_INCLUDED */
|
||||
Reference in New Issue
Block a user