Intel® Quark™ Microcontroller Software Interface
1.4.0
Intel® Quark™ Microcontroller BSP
|
Pulse width modulation and Timer driver. More...
Data Structures | |
struct | qm_pwm_config_t |
QM PWM / Timer configuration type. More... | |
Enumerations | |
enum | qm_pwm_mode_t { QM_PWM_MODE_TIMER_FREE_RUNNING = QM_PWM_MODE_TIMER_FREE_RUNNING_VALUE, QM_PWM_MODE_TIMER_COUNT = QM_PWM_MODE_TIMER_COUNT_VALUE } |
QM PWM mode type. More... | |
Functions | |
int | qm_pwm_set_config (const qm_pwm_t pwm, const qm_pwm_id_t id, const qm_pwm_config_t *const cfg) |
Change the configuration of a PWM channel. More... | |
int | qm_pwm_set (const qm_pwm_t pwm, const qm_pwm_id_t id, const uint32_t lo_count, const uint32_t hi_count) |
Set the next period values of a PWM channel. More... | |
int | qm_pwm_get (const qm_pwm_t pwm, const qm_pwm_id_t id, uint32_t *const lo_count, uint32_t *const hi_count) |
Get the current period values of a PWM channel. More... | |
int | qm_pwm_start (const qm_pwm_t pwm, const qm_pwm_id_t id) |
Start a PWM/timer channel. More... | |
int | qm_pwm_stop (const qm_pwm_t pwm, const qm_pwm_id_t id) |
Stop a PWM/timer channel. More... | |
int | qm_pwm_save_context (const qm_pwm_t pwm, qm_pwm_context_t *const ctx) |
Save PWM peripheral's context. More... | |
int | qm_pwm_restore_context (const qm_pwm_t pwm, const qm_pwm_context_t *const ctx) |
Restore PWM peripheral's context. More... | |
Pulse width modulation and Timer driver.
enum qm_pwm_mode_t |
int qm_pwm_get | ( | const qm_pwm_t | pwm, |
const qm_pwm_id_t | id, | ||
uint32_t *const | lo_count, | ||
uint32_t *const | hi_count | ||
) |
Get the current period values of a PWM channel.
[in] | pwm | Which PWM module to get the count of. |
[in] | id | PWM channel id to read the values of. |
[out] | lo_count | Num of cycles the output is driven low. This must not be NULL. |
[out] | hi_count | Num of cycles the output is driven high. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 151 of file qm_pwm.c.
References qm_pwm_channel_t::loadcount, qm_pwm_reg_t::timer, and qm_pwm_reg_t::timer_loadcount2.
int qm_pwm_restore_context | ( | const qm_pwm_t | pwm, |
const qm_pwm_context_t *const | ctx | ||
) |
Restore PWM peripheral's context.
Restore the configuration of the specified PWM peripheral after exiting sleep.
[in] | pwm | PWM device. |
[in] | ctx | PWM context structure. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 210 of file qm_pwm.c.
References qm_pwm_channel_t::controlreg, qm_pwm_context_t::controlreg, qm_pwm_channel_t::loadcount, qm_pwm_context_t::loadcount, qm_pwm_context_t::loadcount2, qm_pwm_reg_t::timer, and qm_pwm_reg_t::timer_loadcount2.
int qm_pwm_save_context | ( | const qm_pwm_t | pwm, |
qm_pwm_context_t *const | ctx | ||
) |
Save PWM peripheral's context.
Saves the configuration of the specified PWM peripheral before entering sleep.
[in] | pwm | PWM device. |
[out] | ctx | PWM context structure. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 202 of file qm_pwm.c.
References qm_pwm_channel_t::controlreg, qm_pwm_context_t::controlreg, qm_pwm_channel_t::loadcount, qm_pwm_context_t::loadcount, qm_pwm_context_t::loadcount2, qm_pwm_reg_t::timer, and qm_pwm_reg_t::timer_loadcount2.
int qm_pwm_set | ( | const qm_pwm_t | pwm, |
const qm_pwm_id_t | id, | ||
const uint32_t | lo_count, | ||
const uint32_t | hi_count | ||
) |
Set the next period values of a PWM channel.
This includes low period count and high period count. When operating in PWM mode, 0% and 100% duty cycle is not available on Quark SE or Quark D2000. When operating in PWM mode, hi_count must be > 0. In timer mode, the value of high count is ignored.
Set PWM period counts.
[in] | pwm | Which PWM module to set the counts of. |
[in] | id | PWM channel id to set. |
[in] | lo_count | Num of cycles the output is driven low. |
[in] | hi_count | Num of cycles the output is driven high. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 131 of file qm_pwm.c.
References qm_pwm_channel_t::loadcount, qm_pwm_reg_t::timer, and qm_pwm_reg_t::timer_loadcount2.
int qm_pwm_set_config | ( | const qm_pwm_t | pwm, |
const qm_pwm_id_t | id, | ||
const qm_pwm_config_t *const | cfg | ||
) |
Change the configuration of a PWM channel.
This includes low period load value, high period load value, interrupt enable/disable. If interrupts are enabled, registers an ISR with the given user callback function. When operating in PWM mode, 0% and 100% duty cycle is not available on Quark SE or Quark D2000. When setting the mode to PWM mode, hi_count must be > 0. In timer mode, the value of high count is ignored.
Set PWM channel configuration.
[in] | pwm | Which PWM module to configure. |
[in] | id | PWM channel id to configure. |
[in] | cfg | New configuration for PWM. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 106 of file qm_pwm.c.
References qm_pwm_config_t::callback, qm_pwm_config_t::callback_data, qm_pwm_channel_t::controlreg, qm_pwm_config_t::hi_count, qm_pwm_config_t::lo_count, qm_pwm_channel_t::loadcount, qm_pwm_config_t::mask_interrupt, qm_pwm_config_t::mode, qm_pwm_reg_t::timer, and qm_pwm_reg_t::timer_loadcount2.
int qm_pwm_start | ( | const qm_pwm_t | pwm, |
const qm_pwm_id_t | id | ||
) |
Start a PWM/timer channel.
[in] | pwm | Which PWM block the PWM is in. |
[in] | id | PWM channel id to start. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 83 of file qm_pwm.c.
References qm_pwm_channel_t::controlreg, and qm_pwm_reg_t::timer.
int qm_pwm_stop | ( | const qm_pwm_t | pwm, |
const qm_pwm_id_t | id | ||
) |
Stop a PWM/timer channel.
[in] | pwm | Which PWM block the PWM is in. |
[in] | id | PWM channel id to stop. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 94 of file qm_pwm.c.
References qm_pwm_channel_t::controlreg, and qm_pwm_reg_t::timer.