1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-09-02 09:41:44 +03:00

Audio library to format 1.5 rev.2

This commit is contained in:
Cristian Maglie
2013-12-27 01:30:54 +01:00
parent d930e22436
commit a80b2b1d53
3 changed files with 8 additions and 10 deletions

44
libraries/Audio/src/DAC.h Normal file
View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2012 by Cristian Maglie <c.maglie@bug.st>
* DAC library for Arduino Due.
*
* This file is free software; you can redistribute it and/or modify
* it under the terms of either the GNU General Public License version 2
* or the GNU Lesser General Public License version 2.1, both as
* published by the Free Software Foundation.
*/
#ifndef DAC_INCLUDED
#define DAC_INCLUDED
#include "Arduino.h"
typedef void (*OnTransmitEnd_CB)(void *data);
class DACClass
{
public:
DACClass(Dacc *_dac, uint32_t _dacId, IRQn_Type _isrId) :
dac(_dac), dacId(_dacId), isrId(_isrId), cb(NULL) { };
void begin(uint32_t period);
void end();
bool canQueue();
size_t queueBuffer(const uint32_t *buffer, size_t size);
uint32_t *getCurrentQueuePointer();
void setOnTransmitEnd_CB(OnTransmitEnd_CB _cb, void *data);
void onService();
void enableInterrupts() { NVIC_EnableIRQ(isrId); };
void disableInterrupts() { NVIC_DisableIRQ(isrId); };
private:
Dacc *dac;
uint32_t dacId;
IRQn_Type isrId;
OnTransmitEnd_CB cb;
void *cbData;
};
extern DACClass DAC;
#endif