Generic improvements to the GPT driver organization.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2854 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2011-03-31 12:35:42 +00:00
parent a58a524d4c
commit 91e4dee81e
5 changed files with 15 additions and 43 deletions

View File

@ -63,6 +63,8 @@ static const ADCConversionGroup adcgrpcfg = {
* the active state is a logic one.
*/
static PWMConfig pwmcfg = {
10000, /* 10KHz PWM clock frequency. */
10000, /* PWM period 1S (in ticks). */
pwmpcb,
{
{PWM_OUTPUT_DISABLED, NULL},
@ -71,8 +73,6 @@ static PWMConfig pwmcfg = {
{PWM_OUTPUT_ACTIVE_HIGH, NULL}
},
/* HW dependent part.*/
PWM_COMPUTE_PSC(STM32_TIMCLK1, 10000), /* 10KHz PWM clock frequency. */
PWM_COMPUTE_ARR(10000, 1000000000), /* PWM period 1S (in nS). */
0
};
@ -115,7 +115,7 @@ void adccb(ADCDriver *adcp, adcsample_t *buffer, size_t n) {
(void) buffer; (void) n;
/* Note, only in the ADC_COMPLETE state because the ADC driver fires an
intermediate callback when the buffer is half full.*/
if (adcp->ad_state == ADC_COMPLETE) {
if (adcp->state == ADC_COMPLETE) {
adcsample_t avg_ch1, avg_ch2;
/* Calculates the average values from the ADC samples.*/

View File

@ -58,6 +58,18 @@ typedef enum {
GPT_ONESHOT = 4 /**< Active in one shot mode. */
} gptstate_t;
/**
* @brief Type of a structure representing a GPT driver.
*/
typedef struct GPTDriver GPTDriver;
/**
* @brief GPT notification callback type.
*
* @param[in] gptp pointer to a @p GPTDriver object
*/
typedef void (*gptcallback_t)(GPTDriver *gptp);
#include "gpt_lld.h"
/*===========================================================================*/

View File

@ -126,18 +126,6 @@ typedef uint32_t gptfreq_t;
*/
typedef uint32_t gptcnt_t;
/**
* @brief Type of a structure representing a GPT driver.
*/
typedef struct GPTDriver GPTDriver;
/**
* @brief GPT notification callback type.
*
* @param[in] gptp pointer to a @p GPTDriver object
*/
typedef void (*gptcallback_t)(GPTDriver *gptp);
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
@ -170,10 +158,6 @@ struct GPTDriver {
*/
const GPTConfig *config;
/* End of the mandatory fields.*/
/**
* @brief Timer base clock.
*/
uint32_t clock;
/**
* @brief Pointer to the CTxxBy registers block.
*/

View File

@ -126,18 +126,6 @@ typedef uint32_t gptfreq_t;
*/
typedef uint32_t gptcnt_t;
/**
* @brief Type of a structure representing a GPT driver.
*/
typedef struct GPTDriver GPTDriver;
/**
* @brief GPT notification callback type.
*
* @param[in] gptp pointer to a @p GPTDriver object
*/
typedef void (*gptcallback_t)(GPTDriver *gptp);
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.

View File

@ -163,18 +163,6 @@ typedef uint32_t gptfreq_t;
*/
typedef uint16_t gptcnt_t;
/**
* @brief Type of a structure representing a GPT driver.
*/
typedef struct GPTDriver GPTDriver;
/**
* @brief GPT notification callback type.
*
* @param[in] gptp pointer to a @p GPTDriver object
*/
typedef void (*gptcallback_t)(GPTDriver *gptp);
/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.