mirror of
https://github.com/DashyFox/StackSport.git
synced 2025-06-27 20:59:36 +00:00
sound fine
This commit is contained in:
@ -14,6 +14,8 @@
|
||||
#define SOUND_TIMER TIM4
|
||||
#define SOUND_TIMER_RCC RCC_APB1ENR_TIM4EN
|
||||
|
||||
extern uint32_t bpm;
|
||||
|
||||
// Define the Note structure
|
||||
typedef struct {
|
||||
uint32_t frequency; // Frequency in Hz
|
||||
@ -158,7 +160,13 @@ void sound_init(void);
|
||||
void sound_set_bpm(uint32_t bpm);
|
||||
void sound_play_note(Note_t note, uint8_t channel);
|
||||
void sound_play_melody(Note_t* melody, uint32_t size, uint8_t channel, uint32_t repeat_count);
|
||||
void sound_play_melody(Note_t* melody, uint32_t size, uint8_t channel, uint32_t repeat_count);
|
||||
void sound_tick(void);
|
||||
|
||||
uint16_t get_array_size(Note_t *array);
|
||||
|
||||
Note_t sound_create_note(MusicalNote_t note, NoteDuration_t duration, uint8_t duty_cycle);
|
||||
#define CREATE_NOTE(note, dur, duty) \
|
||||
((Note_t){ .frequency = note, .duration = dur, .duty_cycle = duty })
|
||||
|
||||
#endif /* INC_SOUND_H_ */
|
||||
|
28
Core/Inc/SoundMelody.h
Normal file
28
Core/Inc/SoundMelody.h
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* SoundMelody.h
|
||||
*
|
||||
* Created on: Oct 2, 2024
|
||||
* Author: DashyFox
|
||||
*/
|
||||
|
||||
#ifndef INC_SOUNDMELODY_H_
|
||||
#define INC_SOUNDMELODY_H_
|
||||
|
||||
#include "Sound.h"
|
||||
|
||||
#define melody(melodyName) sound_play_melody(melodyName, sizeof(melodyName)/sizeof(Note_t), 3, 0)
|
||||
extern Note_t melody_buttonClick[1];
|
||||
extern Note_t melody_buttonClickHold[1];
|
||||
extern Note_t melody_timerClick[1];
|
||||
extern Note_t melody_start[12];
|
||||
extern Note_t melody_NoBall[14];
|
||||
extern Note_t melody_Error[3];
|
||||
|
||||
extern Note_t melody_Ball_1[3];
|
||||
|
||||
extern Note_t melody_Done[9];
|
||||
|
||||
extern Note_t melody_OK[3];
|
||||
|
||||
|
||||
#endif /* INC_SOUNDMELODY_H_ */
|
Reference in New Issue
Block a user