audio.h 550 B

123456789101112131415161718192021222324
  1. #include <stdint.h>
  2. #include <stdbool.h>
  3. #include <avr/io.h>
  4. #include <util/delay.h>
  5. #include "musical_notes.h"
  6. typedef union {
  7. uint8_t raw;
  8. struct {
  9. bool enable :1;
  10. uint8_t level :7;
  11. };
  12. } audio_config_t;
  13. void audio_toggle(void);
  14. void audio_on(void);
  15. void audio_off(void);
  16. void play_sample(uint8_t * s, uint16_t l, bool r);
  17. void play_note(double freq, int vol);
  18. void stop_note(double freq);
  19. void stop_all_notes();
  20. void init_notes();
  21. void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest);