git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6388 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
e173f78e31
commit
b45a806747
|
@ -67,7 +67,7 @@ static ICUConfig icucfg = {
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
|
||||||
/* Initialization of all the imported components in the order specified in
|
/* Initialization of all the imported components in the order specified in
|
||||||
the application wizard. The function is generated automatically.*/
|
the application wizard. The function is generated automatically.*/
|
||||||
componentsInit();
|
componentsInit();
|
||||||
|
|
||||||
palClearPad(PORT11, P11_LED4);
|
palClearPad(PORT11, P11_LED4);
|
||||||
|
@ -79,55 +79,55 @@ int main(void) {
|
||||||
* The two pins have to be externally connected together.
|
* The two pins have to be externally connected together.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Sets PIN63 alternative function.*/
|
||||||
|
SIU.PCR[179].R = 0b0000011000001100;
|
||||||
|
|
||||||
/* Sets PIN65 alternative function.*/
|
/* Sets PIN65 alternative function.*/
|
||||||
SIU.PCR[181].R = 0b0000010100001100;
|
SIU.PCR[181].R = 0b0000010100001100;
|
||||||
|
|
||||||
/* Sets PIN78 alternative function.*/
|
icuStart(&ICUD2, &icucfg);
|
||||||
SIU.PCR[193].R = 0b0000011000001100;
|
icuEnable(&ICUD2);
|
||||||
|
pwmStart(&PWMD1, &pwmcfg);
|
||||||
icuStart(&ICUD3, &icucfg);
|
|
||||||
icuEnable(&ICUD3);
|
|
||||||
pwmStart(&PWMD6, &pwmcfg);
|
|
||||||
|
|
||||||
chThdSleepMilliseconds(2000);
|
chThdSleepMilliseconds(2000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Starts the PWM channel 0 using 75% duty cycle.
|
* Starts the PWM channel 0 using 75% duty cycle.
|
||||||
*/
|
*/
|
||||||
pwmEnableChannel(&PWMD6, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD6, 7500));
|
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 7500));
|
||||||
chThdSleepMilliseconds(5000);
|
chThdSleepMilliseconds(5000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Changes the PWM channel 0 to 50% duty cycle.
|
* Changes the PWM channel 0 to 50% duty cycle.
|
||||||
*/
|
*/
|
||||||
pwmEnableChannel(&PWMD6, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD6, 5000));
|
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
|
||||||
chThdSleepMilliseconds(5000);
|
chThdSleepMilliseconds(5000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Changes the PWM channel 0 to 25% duty cycle.
|
* Changes the PWM channel 0 to 25% duty cycle.
|
||||||
*/
|
*/
|
||||||
pwmEnableChannel(&PWMD6, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD6, 2500));
|
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 2500));
|
||||||
chThdSleepMilliseconds(5000);
|
chThdSleepMilliseconds(5000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Changes PWM period and the PWM channel 0 to 50% duty cycle.
|
* Changes PWM period and the PWM channel 0 to 50% duty cycle.
|
||||||
*/
|
*/
|
||||||
pwmChangePeriod(&PWMD6, 25000);
|
pwmChangePeriod(&PWMD1, 25000);
|
||||||
pwmEnableChannel(&PWMD6, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD6, 5000));
|
pwmEnableChannel(&PWMD1, 0, PWM_PERCENTAGE_TO_WIDTH(&PWMD1, 5000));
|
||||||
chThdSleepMilliseconds(5000);
|
chThdSleepMilliseconds(5000);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disables PWM channel 0 and stops the drivers.
|
* Disables PWM channel 0 and stops the drivers.
|
||||||
*/
|
*/
|
||||||
pwmDisableChannel(&PWMD6, 0);
|
pwmDisableChannel(&PWMD1, 0);
|
||||||
pwmStop(&PWMD6);
|
pwmStop(&PWMD1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disables and stops the ICU drivers.
|
* Disables and stops the ICU drivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
icuDisable(&ICUD3);
|
icuDisable(&ICUD2);
|
||||||
icuStop(&ICUD3);
|
icuStop(&ICUD2);
|
||||||
|
|
||||||
palClearPad(PORT11, P11_LED3);
|
palClearPad(PORT11, P11_LED3);
|
||||||
palClearPad(PORT11, P11_LED4);
|
palClearPad(PORT11, P11_LED4);
|
||||||
|
|
|
@ -80,28 +80,28 @@
|
||||||
/*
|
/*
|
||||||
* ICU - PWM driver system settings.
|
* ICU - PWM driver system settings.
|
||||||
*/
|
*/
|
||||||
#define SPC5_ICU_USE_EMIOS_CH0 TRUE
|
|
||||||
#define SPC5_ICU_USE_EMIOS_CH1 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH1 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH2 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH2 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH3 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH3 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH4 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH4 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH5 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH5 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH6 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH6 TRUE
|
||||||
|
#define SPC5_ICU_USE_EMIOS_CH11 TRUE
|
||||||
|
#define SPC5_ICU_USE_EMIOS_CH13 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH7 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH7 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH8 TRUE
|
|
||||||
#define SPC5_ICU_USE_EMIOS_CH16 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH16 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH17 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH17 TRUE
|
||||||
#define SPC5_ICU_USE_EMIOS_CH18 TRUE
|
#define SPC5_ICU_USE_EMIOS_CH18 TRUE
|
||||||
|
|
||||||
|
#define SPC5_PWM_USE_EMIOS_CH0 TRUE
|
||||||
|
#define SPC5_PWM_USE_EMIOS_CH8 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH9 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH9 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH10 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH10 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH11 TRUE
|
|
||||||
#define SPC5_PWM_USE_EMIOS_CH12 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH12 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH13 TRUE
|
|
||||||
#define SPC5_PWM_USE_EMIOS_CH14 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH14 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH15 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH15 TRUE
|
||||||
|
#define SPC5_PWM_USE_EMIOS_CH23 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH19 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH19 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH20 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH20 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH21 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH21 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH22 TRUE
|
#define SPC5_PWM_USE_EMIOS_CH22 TRUE
|
||||||
#define SPC5_PWM_USE_EMIOS_CH23 TRUE
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ The application demonstrates the use of the SPC564Axx ICU and PWM drivers.
|
||||||
|
|
||||||
** Board Setup **
|
** Board Setup **
|
||||||
|
|
||||||
Connect PIN65 and PIN78 together.
|
Connect PIN65 and PIN65 together.
|
||||||
|
|
||||||
** Build Procedure **
|
** Build Procedure **
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue