Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:03

0001 /**
0002  * @file
0003  *
0004  * @ingroup RTEMSBSPsARMLPC176X
0005  *
0006  * @brief PWM-Out controller for the mbed lpc1768 board.
0007  */
0008 
0009 /*
0010  * Copyright (c) 2014 Taller Technologies.
0011  *
0012  * @author  Diaz Marcos (marcos.diaz@tallertechnologies.com)
0013  *
0014  * The license and distribution terms for this file may be
0015  * found in the file LICENSE in this distribution or at
0016  * http://www.rtems.org/license/LICENSE.
0017  */
0018 
0019 #ifndef LPC176X_PWMOUT_H
0020 #define LPC176X_PWMOUT_H
0021 
0022 #include <bsp.h>
0023 #include <bsp/io.h>
0024 #include <bsp/lpc176x.h>
0025 
0026 #ifdef __cplusplus
0027 extern "C" {
0028 #endif /* __cplusplus */
0029 
0030 /**
0031  * @brief Initializes the PWM output device and sets an initial period
0032  *  of 20000us.
0033  *
0034  * @param pin_number The PWM output pin.
0035  * @return RTEMS_SUCCESSFULL  if the PWM initialization was OK,
0036  *  RTEMS_INVALID_NUMBER for a wrong parameter.
0037  */
0038 rtems_status_code pwm_init( const lpc176x_pin_number pin_number );
0039 
0040 /**
0041  * @brief Sets a period for the PWM output. (Note that this changes the period
0042  * for all the PWM outputs.)
0043  *
0044  * @param pin_number The pin whose period we want to change.
0045  * @param period The desired period in microseconds.
0046  *
0047  * @return RTEMS_SUCCESSFULL if the period's setting was OK,
0048  *  RTEMS_INVALID_NUMBER for a bad parameter.
0049  */
0050 rtems_status_code pwm_period(
0051   const lpc176x_pin_number    pin_number,
0052   const lpc176x_microseconds period
0053 );
0054 
0055 /**
0056  * @brief Sets a pulsewidth for the PWM output.
0057  *
0058  * @param pin_number The pin whose pulsewidth we want to change.
0059  * @param pwidth The desired pulsewidth in microseconds.
0060  *
0061  * @return RTEMS_SUCCESSFULL if the pulsewidth's setting was OK,
0062  *  RTEMS_INVALID_NUMBER for a wrong parameter.
0063  */
0064 rtems_status_code pwm_pulsewidth(
0065   const lpc176x_pin_number    pin_number,
0066   const lpc176x_microseconds pwidth
0067 );
0068 
0069 #ifdef __cplusplus
0070 }
0071 #endif /* __cplusplus */
0072 
0073 #endif