YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
src
drivers
rp2040
pcm_pwm
pcm_pwm_rp2040_drv.h
1
// ---------------------------------------------
2
// This file is part of
3
// _ _ __ _ _ __ __
4
// ( \/ ) /__\ ( )_( ) /__\ ( )
5
// \ / /(__)\ ) _ ( /(__)\ )(__
6
// (__)(__)(__)(_) (_)(__)(__)(____)
7
//
8
// Yet Another HW Abstraction Library
9
// Copyright (C) Andreas Terstegge
10
// BSD Licensed (see file LICENSE)
11
//
12
// ---------------------------------------------
13
//
14
#ifndef _PCM_PWM_RP2040_DRV_H_
15
#define _PCM_PWM_RP2040_DRV_H_
16
17
#include <cstdint>
18
#include "pcm_audio_interface.h"
19
#include "gpio_rp2040.h"
20
#include "timer_rp2040.h"
21
#include "
RP2040.h
"
22
23
using namespace
_PWM_;
24
25
class
pcm_pwm_rp2040_drv
:
public
pcm_audio_interface
{
26
public
:
27
pcm_pwm_rp2040_drv
(gpio_pin_t left, gpio_pin_t right);
28
29
virtual
~pcm_pwm_rp2040_drv
() =
default
;
30
31
void
enable_output(
bool
v);
32
33
void
setPcmRate(uint32_t Hz = 44100)
override
;
34
35
inline
void
timer_reset() { _pcm_timer.reset(); }
36
37
private
:
38
timer_rp2040
_pcm_timer;
39
bool
_left_is_pwm_b;
40
bool
_right_is_pwm_b;
41
CH_CSR_t * _left_pwm_csr;
42
CH_CC_t * _left_pwm_cc;
43
CH_CSR_t * _right_pwm_csr;
44
CH_CC_t * _right_pwm_cc;
45
};
46
47
#endif
// _PCM_PWM_RP2040_DRV_H_
RP2040.h
CMSIS-Core(M) Device Peripheral Access Layer Header File for Device RP2040.
pcm_audio_interface
Definition
pcm_audio_interface.h:29
pcm_pwm_rp2040_drv
Definition
pcm_pwm_rp2040_drv.h:25
timer_rp2040
Definition
timer_rp2040.h:20
Generated by
1.12.0