Raspberry Pi specific PWM definitions.
More...
#include "bsp/raspberrypi.h"
#include "bsp/rpi-gpio.h"
#include "bsp/utility.h"
Go to the source code of this file.
|
| enum | raspberrypi_pwm_channel { raspberrypi_pwm0
, raspberrypi_pwm1
} |
| |
| enum | raspberrypi_pwm_master { raspberrypi_pwm_master0
, raspberrypi_pwm_master1
} |
| |
Raspberry Pi specific PWM definitions.
◆ C_CLRF
| #define C_CLRF BSP_BIT32( 6 ) |
◆ C_MODE1
| #define C_MODE1 BSP_BIT32( 1 ) |
Channel 1 serializer mode
◆ C_MODE2
| #define C_MODE2 BSP_BIT32( 9 ) |
Channel 2 serializer mode
◆ C_MSEN1
| #define C_MSEN1 BSP_BIT32( 7 ) |
Channel 1 Mark-Space enable
◆ C_MSEN2
| #define C_MSEN2 BSP_BIT32( 15 ) |
Channel 2 Mark-Space enable
◆ C_POLA1
| #define C_POLA1 BSP_BIT32( 4 ) |
Channel 1 invert polarity
◆ C_POLA2
| #define C_POLA2 BSP_BIT32( 12 ) |
Channel 2 invert polarity
◆ C_PWEN1
| #define C_PWEN1 BSP_BIT32( 0 ) |
◆ C_PWEN2
| #define C_PWEN2 BSP_BIT32( 8 ) |
◆ C_RPTL1
| #define C_RPTL1 BSP_BIT32( 2 ) |
Channel 1 repeat underrun
◆ C_RPTL2
| #define C_RPTL2 BSP_BIT32( 10 ) |
Channel 2 repeat on underrun
◆ C_SBIT1
| #define C_SBIT1 BSP_BIT32( 3 ) |
Channel 1 silence bit high
◆ C_SBIT2
| #define C_SBIT2 BSP_BIT32( 11 ) |
Channel 2 silence bit high
◆ C_USEF1
| #define C_USEF1 BSP_BIT32( 5 ) |
◆ C_USEF2
| #define C_USEF2 BSP_BIT32( 13 ) |
◆ rpi_pwm_init()
| rtems_status_code rpi_pwm_init |
( |
raspberrypi_pwm_master |
master, |
|
|
raspberrypi_pwm_channel |
channel, |
|
|
uint32_t |
range, |
|
|
uint32_t |
data |
|
) |
| |
Main PWM initialization function. This functions sets up the PWM master, channel, duty cycle and GPIO pin.
- Parameters
-
| master | Selects the hardware instance to be used (raspberrypi_pwm_master0 = PWM0, raspberrypi_pwm_master1 = PWM1) |
| channel | Selects the channel for master (raspberrypi_pwm0 = PWMx_0, raspberrypi_pwm1 = PWMx_1) |
| range | Period register value (> 0) |
| data | Initial duty count, 1 – range (0 rejected) |
◆ rpi_pwm_set_clock()
Set PWM clock divider.
- Parameters
-
| divisor | 1 – 4095; PWMCLK = 19.2 MHz / divisor. |
- Return values
-
| RTEMS_SUCCESSFUL | OK |
| RTEMS_INVALID_NUMBER | 0 or >4095 |
◆ rpi_pwm_set_data()
| rtems_status_code rpi_pwm_set_data |
( |
raspberrypi_pwm_master |
master, |
|
|
raspberrypi_pwm_channel |
channel, |
|
|
uint32_t |
data |
|
) |
| |
Update duty-cycle register.
- Parameters
-
| master | Selects the hardware instance to be used (raspberrypi_pwm_master0 = PWM0, raspberrypi_pwm_master1 = PWM1) |
| channel | Selects the channel for master (raspberrypi_pwm0 = PWMx_0, raspberrypi_pwm1 = PWMx_1) |
| data | Initial duty count, 1 – current range value.(0 rejected) |