1
0
mirror of https://github.com/jscrane/r65emu.git synced 2024-11-15 14:08:25 +00:00

rename sound -> sound_dac

This commit is contained in:
Stephen Crane 2018-09-11 17:33:18 +01:00
parent 9cfa09eade
commit 5355f623bd
3 changed files with 12 additions and 11 deletions

View File

@ -13,6 +13,7 @@
#include "timed.h"
#include "hardware.h"
#include "checkpoint.h"
#include "sound.h"
#include "sound_dac.h"
#include "sound_pwm.h"
#endif

View File

@ -1,9 +1,9 @@
#include <Arduino.h>
#include <hardware.h>
#include "timed.h"
#include "sound.h"
#include "sound_dac.h"
static Sound *s;
static DAC *s;
#if defined(DAC_SOUND) && defined(ESP_PLATFORM)
#include <driver/dac.h>
@ -15,7 +15,7 @@ void IRAM_ATTR timer_callback() {
s->on_tick();
}
void IRAM_ATTR Sound::on_tick() {
void IRAM_ATTR DAC::on_tick() {
portENTER_CRITICAL_ISR(&mux);
if (_off < _size)
@ -28,7 +28,7 @@ void IRAM_ATTR Sound::on_tick() {
portEXIT_CRITICAL_ISR(&mux);
}
void Sound::begin(unsigned pin, unsigned freq) {
void DAC::begin(unsigned pin, unsigned freq) {
if (pin == 25)
channel = DAC_CHANNEL_1;
else if (pin == 26)
@ -38,7 +38,7 @@ void Sound::begin(unsigned pin, unsigned freq) {
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);
const uint8_t *play = (const uint8_t *)_bytes;
@ -56,10 +56,10 @@ const uint8_t *Sound::play(const uint8_t *bytes, unsigned size) {
#else
// 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;
}
#endif

View File

@ -1,7 +1,7 @@
#ifndef __SOUND_H__
#define __SOUND_H__
#ifndef __SOUND_DAC_H__
#define __SOUND_DAC_H__
class Sound {
class DAC {
public:
void begin(unsigned pin, unsigned freq);
const uint8_t *play(const uint8_t *bytes, unsigned size);