/* Copyright © 2020 tyrolyean * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef _DAC_H #define _DAC_H #include void write_to_dac(uint8_t addr, uint8_t data); uint8_t read_from_dac(uint8_t addr); /* The operation modes of the dac used for generation of different tones */ #define DAC_MODE_SILENT 0 #define DAC_MODE_SINE 1 #define DAC_MODE_SQUARE 2 #define DAC_MODE_SAW 3 #define DAC_MODE_NOISE 4 #define DAC_MODE_TRIANGLE 5 extern uint8_t dac_mode; /* This variable is used to deviate the frequency from the baseline frequency * of around 1kHz. If this integer is positive it makes the produced waveform * longer, if it is negative the produced waveform becomes less sharp, but the * frequency goes up. 0 is the baseline */ extern int16_t dac_frequency_deviation; void feed_dac(); void routine_dac(); void update_sound(); #endif