PWM and ICU working on the STM32F0.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4329 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
2abe2c479f
commit
fdc0555892
|
@ -175,7 +175,7 @@
|
||||||
support several new devices.
|
support several new devices.
|
||||||
- NEW: Demo for STM32F0-Discovery board.
|
- NEW: Demo for STM32F0-Discovery board.
|
||||||
- NEW: Initial support for STM32F0xx devices, added a specific ADC driver.
|
- NEW: Initial support for STM32F0xx devices, added a specific ADC driver.
|
||||||
Validated EXT, PAL, Serial, SPI drivers.
|
Validated EXT, GPT, ICU, PAL, PWM, Serial, SPI drivers.
|
||||||
- NEW: Added a common ancestor class to the SDC and MMC_SPI drivers. This
|
- NEW: Added a common ancestor class to the SDC and MMC_SPI drivers. This
|
||||||
allows to share code and definitions.
|
allows to share code and definitions.
|
||||||
- NEW: Modified the SDC driver to implement the new block devices abstract
|
- NEW: Modified the SDC driver to implement the new block devices abstract
|
||||||
|
|
|
@ -60,12 +60,17 @@ static void icuperiodcb(ICUDriver *icup) {
|
||||||
last_period = icuGetPeriod(icup);
|
last_period = icuGetPeriod(icup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void icuoverflowcb(ICUDriver *icup) {
|
||||||
|
|
||||||
|
(void)icup;
|
||||||
|
}
|
||||||
|
|
||||||
static ICUConfig icucfg = {
|
static ICUConfig icucfg = {
|
||||||
ICU_INPUT_ACTIVE_HIGH,
|
ICU_INPUT_ACTIVE_HIGH,
|
||||||
10000, /* 10kHz ICU clock frequency. */
|
10000, /* 10kHz ICU clock frequency. */
|
||||||
icuwidthcb,
|
icuwidthcb,
|
||||||
icuperiodcb,
|
icuperiodcb,
|
||||||
NULL,
|
icuoverflowcb,
|
||||||
ICU_CHANNEL_1
|
ICU_CHANNEL_1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,14 +91,14 @@ int main(void) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initializes the PWM driver 2 and ICU driver 3.
|
* Initializes the PWM driver 2 and ICU driver 3.
|
||||||
* GPIOA15 is the PWM output.
|
* GPIOA6 is the ICU input (CH1).
|
||||||
* GPIOC6 is the ICU input.
|
* GPIOA15 is the PWM output (CH1).
|
||||||
* The two pins have to be externally connected together.
|
* The two pins have to be externally connected together.
|
||||||
*/
|
*/
|
||||||
pwmStart(&PWMD2, &pwmcfg);
|
pwmStart(&PWMD2, &pwmcfg);
|
||||||
palSetPadMode(GPIOA, 15, PAL_MODE_ALTERNATE(1));
|
palSetPadMode(GPIOA, 15, PAL_MODE_ALTERNATE(2));
|
||||||
icuStart(&ICUD3, &icucfg);
|
icuStart(&ICUD3, &icucfg);
|
||||||
palSetPadMode(GPIOC, 6, PAL_MODE_ALTERNATE(2));
|
palSetPadMode(GPIOA, 6, PAL_MODE_ALTERNATE(1));
|
||||||
icuEnable(&ICUD3);
|
icuEnable(&ICUD3);
|
||||||
chThdSleepMilliseconds(2000);
|
chThdSleepMilliseconds(2000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue