mirror of
https://github.com/jscrane/r65emu.git
synced 2025-01-04 10:29:20 +00:00
rename sound -> sound_dac
This commit is contained in:
parent
9cfa09eade
commit
5355f623bd
3
r65emu.h
3
r65emu.h
@ -13,6 +13,7 @@
|
|||||||
#include "timed.h"
|
#include "timed.h"
|
||||||
#include "hardware.h"
|
#include "hardware.h"
|
||||||
#include "checkpoint.h"
|
#include "checkpoint.h"
|
||||||
#include "sound.h"
|
#include "sound_dac.h"
|
||||||
|
#include "sound_pwm.h"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <hardware.h>
|
#include <hardware.h>
|
||||||
#include "timed.h"
|
#include "timed.h"
|
||||||
#include "sound.h"
|
#include "sound_dac.h"
|
||||||
|
|
||||||
static Sound *s;
|
static DAC *s;
|
||||||
|
|
||||||
#if defined(DAC_SOUND) && defined(ESP_PLATFORM)
|
#if defined(DAC_SOUND) && defined(ESP_PLATFORM)
|
||||||
#include <driver/dac.h>
|
#include <driver/dac.h>
|
||||||
@ -15,7 +15,7 @@ void IRAM_ATTR timer_callback() {
|
|||||||
s->on_tick();
|
s->on_tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IRAM_ATTR Sound::on_tick() {
|
void IRAM_ATTR DAC::on_tick() {
|
||||||
portENTER_CRITICAL_ISR(&mux);
|
portENTER_CRITICAL_ISR(&mux);
|
||||||
|
|
||||||
if (_off < _size)
|
if (_off < _size)
|
||||||
@ -28,7 +28,7 @@ void IRAM_ATTR Sound::on_tick() {
|
|||||||
portEXIT_CRITICAL_ISR(&mux);
|
portEXIT_CRITICAL_ISR(&mux);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sound::begin(unsigned pin, unsigned freq) {
|
void DAC::begin(unsigned pin, unsigned freq) {
|
||||||
if (pin == 25)
|
if (pin == 25)
|
||||||
channel = DAC_CHANNEL_1;
|
channel = DAC_CHANNEL_1;
|
||||||
else if (pin == 26)
|
else if (pin == 26)
|
||||||
@ -38,7 +38,7 @@ void Sound::begin(unsigned pin, unsigned freq) {
|
|||||||
timer_create(freq, &timer_callback);
|
timer_create(freq, &timer_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *Sound::play(const uint8_t *bytes, unsigned size) {
|
const uint8_t *DAC::play(const uint8_t *bytes, unsigned size) {
|
||||||
portENTER_CRITICAL_ISR(&mux);
|
portENTER_CRITICAL_ISR(&mux);
|
||||||
|
|
||||||
const uint8_t *play = (const uint8_t *)_bytes;
|
const uint8_t *play = (const uint8_t *)_bytes;
|
||||||
@ -56,10 +56,10 @@ const uint8_t *Sound::play(const uint8_t *bytes, unsigned size) {
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
// does nothing by default
|
// does nothing by default
|
||||||
void Sound::begin(unsigned channel, unsigned freq) {
|
void DAC::begin(unsigned channel, unsigned freq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *Sound::play(const uint8_t *bytes, unsigned size) {
|
const uint8_t *DAC::play(const uint8_t *bytes, unsigned size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef __SOUND_H__
|
#ifndef __SOUND_DAC_H__
|
||||||
#define __SOUND_H__
|
#define __SOUND_DAC_H__
|
||||||
|
|
||||||
class Sound {
|
class DAC {
|
||||||
public:
|
public:
|
||||||
void begin(unsigned pin, unsigned freq);
|
void begin(unsigned pin, unsigned freq);
|
||||||
const uint8_t *play(const uint8_t *bytes, unsigned size);
|
const uint8_t *play(const uint8_t *bytes, unsigned size);
|
Loading…
Reference in New Issue
Block a user