123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- /*
- ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
- /**
- * @file hal_pwm_lld.c
- * @brief PLATFORM PWM subsystem low level driver source.
- *
- * @addtogroup PWM
- * @{
- */
- #include "hal.h"
- #if (HAL_USE_PWM == TRUE) || defined(__DOXYGEN__)
- /*===========================================================================*/
- /* Driver local definitions. */
- /*===========================================================================*/
- /*===========================================================================*/
- /* Driver exported variables. */
- /*===========================================================================*/
- /**
- * @brief PWMD1 driver identifier.
- * @note The driver PWMD1 allocates the complex timer TIM1 when enabled.
- */
- #if (PLATFORM_PWM_USE_PWM1 == TRUE) || defined(__DOXYGEN__)
- PWMDriver PWMD1;
- #endif
- /*===========================================================================*/
- /* Driver local variables and types. */
- /*===========================================================================*/
- /*===========================================================================*/
- /* Driver local functions. */
- /*===========================================================================*/
- /*===========================================================================*/
- /* Driver interrupt handlers. */
- /*===========================================================================*/
- /*===========================================================================*/
- /* Driver exported functions. */
- /*===========================================================================*/
- /**
- * @brief Low level PWM driver initialization.
- *
- * @notapi
- */
- void pwm_lld_init(void) {
- #if PLATFORM_PWM_USE_PWM1 == TRUE
- /* Driver initialization.*/
- pwmObjectInit(&PWMD1);
- #endif
- }
- /**
- * @brief Configures and activates the PWM peripheral.
- * @note Starting a driver that is already in the @p PWM_READY state
- * disables all the active channels.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- *
- * @notapi
- */
- void pwm_lld_start(PWMDriver *pwmp) {
- if (pwmp->state == PWM_STOP) {
- /* Clock activation and timer reset.*/
- #if PLATFORM_PWM_USE_PWM1 == TRUE
- if (&PWMD1 == pwmp) {
- }
- #endif
- }
- }
- /**
- * @brief Deactivates the PWM peripheral.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- *
- * @notapi
- */
- void pwm_lld_stop(PWMDriver *pwmp) {
- /* If in ready state then disables the PWM clock.*/
- if (pwmp->state == PWM_READY) {
- #if PLATFORM_PWM_USE_PWM1 == TRUE
- if (&PWMD1 == pwmp) {
- }
- #endif
- }
- }
- /**
- * @brief Enables a PWM channel.
- * @pre The PWM unit must have been activated using @p pwmStart().
- * @post The channel is active using the specified configuration.
- * @note The function has effect at the next cycle start.
- * @note Channel notification is not enabled.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- * @param[in] channel PWM channel identifier (0...channels-1)
- * @param[in] width PWM pulse width as clock pulses number
- *
- * @notapi
- */
- void pwm_lld_enable_channel(PWMDriver *pwmp,
- pwmchannel_t channel,
- pwmcnt_t width) {
- (void)pwmp;
- (void)channel;
- (void)width;
- }
- /**
- * @brief Disables a PWM channel and its notification.
- * @pre The PWM unit must have been activated using @p pwmStart().
- * @post The channel is disabled and its output line returned to the
- * idle state.
- * @note The function has effect at the next cycle start.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- * @param[in] channel PWM channel identifier (0...channels-1)
- *
- * @notapi
- */
- void pwm_lld_disable_channel(PWMDriver *pwmp, pwmchannel_t channel) {
- (void)pwmp;
- (void)channel;
- }
- /**
- * @brief Enables the periodic activation edge notification.
- * @pre The PWM unit must have been activated using @p pwmStart().
- * @note If the notification is already enabled then the call has no effect.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- *
- * @notapi
- */
- void pwm_lld_enable_periodic_notification(PWMDriver *pwmp) {
- (void)pwmp;
- }
- /**
- * @brief Disables the periodic activation edge notification.
- * @pre The PWM unit must have been activated using @p pwmStart().
- * @note If the notification is already disabled then the call has no effect.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- *
- * @notapi
- */
- void pwm_lld_disable_periodic_notification(PWMDriver *pwmp) {
- (void)pwmp;
- }
- /**
- * @brief Enables a channel de-activation edge notification.
- * @pre The PWM unit must have been activated using @p pwmStart().
- * @pre The channel must have been activated using @p pwmEnableChannel().
- * @note If the notification is already enabled then the call has no effect.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- * @param[in] channel PWM channel identifier (0...channels-1)
- *
- * @notapi
- */
- void pwm_lld_enable_channel_notification(PWMDriver *pwmp,
- pwmchannel_t channel) {
- (void)pwmp;
- (void)channel;
- }
- /**
- * @brief Disables a channel de-activation edge notification.
- * @pre The PWM unit must have been activated using @p pwmStart().
- * @pre The channel must have been activated using @p pwmEnableChannel().
- * @note If the notification is already disabled then the call has no effect.
- *
- * @param[in] pwmp pointer to a @p PWMDriver object
- * @param[in] channel PWM channel identifier (0...channels-1)
- *
- * @notapi
- */
- void pwm_lld_disable_channel_notification(PWMDriver *pwmp,
- pwmchannel_t channel) {
- (void)pwmp;
- (void)channel;
- }
- #endif /* HAL_USE_PWM == TRUE */
- /** @} */
|