AVRly - AVR Development Resources
sweet_child_o_mine.c
Go to the documentation of this file.
1/******************************************************************************
2 @copyright Copyright © 2022 by Jason Duffy.
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21******************************************************************************/
22
23/**
24 * @file sweet_child_o_mine.c
25 * @ingroup am_radio
26 * @author Jason Duffy
27 * @date 10th September 2022
28 * @brief This file contains the implementation of the sequencing to reproduce
29 * the intro to Sweet Child O' Mine by Guns N Roses.
30 */
31
32#include "sweet_child_o_mine.h"
33#include "am_radio.h"
34
35// Function prototypes.
36void sweet_child_riff_part_1(void);
37void sweet_child_riff_part_2(void);
38void sweet_child_riff_part_3(void);
39
40void init_radio(void)
41{
42 // Initialisation routines
43 init_am_radio(_1000_KHZ);
44 // Set tempo in BPM
46}
47
48
49void sweet_child_riff(void)
50{
51 sweet_child_riff_part_1();
52 sweet_child_riff_part_1();
53 sweet_child_riff_part_2();
54 sweet_child_riff_part_2();
55 sweet_child_riff_part_3();
56 sweet_child_riff_part_3();
57 sweet_child_riff_part_1();
58 sweet_child_riff_part_1();
59}
60
61
62void sweet_child_riff_part_1(void)
63{
64 // Intro, Bar 1
65 am_radio_transmit_note(C2, QUAVER);
66 am_radio_transmit_note(C3, QUAVER);
67 am_radio_transmit_note(G2, QUAVER);
68 am_radio_transmit_note(F2, QUAVER);
69 am_radio_transmit_note(F3, QUAVER);
70 am_radio_transmit_note(G2, QUAVER);
71 am_radio_transmit_note(E3, QUAVER);
72 am_radio_transmit_note(G2, QUAVER);
73}
74
75
76void sweet_child_riff_part_2(void)
77{
78 // Intro, Bar 3
79 am_radio_transmit_note(D2, QUAVER);
80 am_radio_transmit_note(C3, QUAVER);
81 am_radio_transmit_note(G2, QUAVER);
82 am_radio_transmit_note(F2, QUAVER);
83 am_radio_transmit_note(F3, QUAVER);
84 am_radio_transmit_note(G2, QUAVER);
85 am_radio_transmit_note(E3, QUAVER);
86 am_radio_transmit_note(G2, QUAVER);
87}
88
89
90void sweet_child_riff_part_3(void)
91{
92 // Intro, Bar 5
93 am_radio_transmit_note(F2, QUAVER);
94 am_radio_transmit_note(C3, QUAVER);
95 am_radio_transmit_note(G2, QUAVER);
96 am_radio_transmit_note(F2, QUAVER);
97 am_radio_transmit_note(F3, QUAVER);
98 am_radio_transmit_note(G2, QUAVER);
99 am_radio_transmit_note(E3, QUAVER);
100 am_radio_transmit_note(G2, QUAVER);
101}
void am_radio_transmit_note(note_pitch_t pitch, note_duration_t note_length)
Transmits a square wave, monophonic note for the specified duration.
Definition: am_radio.c:94
void init_am_radio(frequency_khz_t carrier_freq)
Initialises timer/counter for radio transmission at a specified carrier frequency.
Definition: am_radio.c:47
void am_radio_set_tempo(uint8_t bpm)
Sets tempo for musical tones to be transmitted (in BPM).
Definition: am_radio.c:80
Driver for a small, low power AM radio transmitter, to broadcast monophonic square wave tones over a ...