This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
buzzer_api [2017/09/25 22:27] 1.241.172.144 |
buzzer_api [2017/09/25 22:31] (current) 1.241.172.144 |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Header File | + | API Application Example |
| + | |||
| + | #include "Buzzer.h" | ||
| + | ... | ||
| + | ... | ||
| + | int main() | ||
| + | { | ||
| + | uint32_t Octave; | ||
| + | ... | ||
| + | ... | ||
| + | if ( buzzer_open() < 0 ) | ||
| + | { | ||
| + | printf("Fail to buzzer_open\n"); | ||
| + | } | ||
| + | ... | ||
| + | ... | ||
| + | Octave = 4;/* 4 옥타브의 소리*/ | ||
| + | ... | ||
| + | ... | ||
| + | case KEY_1: | ||
| + | printf("Key code : KEY_1 (0x%X)\n", KeyCode); | ||
| + | if ( IsReleased == 1 ) | ||
| + | { /* Key Released */ | ||
| + | ... | ||
| + | ... | ||
| + | buzzer_off(); | ||
| + | ... | ||
| + | ... | ||
| + | } | ||
| + | else | ||
| + | { | ||
| + | ... | ||
| + | ... | ||
| + | buzzer_on_code( MUSIC_FREQUENCY_CODE_C, Octave );/*C는 도이다*/ | ||
| + | ... | ||
| + | ... | ||
| + | } | ||
| + | break; | ||
| + | ... | ||
| + | ... | ||
| + | if ( buzzer_close() < 0 ) | ||
| + | { | ||
| + | printf("Fail to buzzer_close\n"); | ||
| + | } | ||
| + | ... | ||
| + | ... | ||
| + | } | ||
| + | |||
| + | 카가 눌리는 동안 소리가 난다. | ||
| + | |||
| + | |||
| + | API Header File | ||
| #ifndef __BUZZER_H__ | #ifndef __BUZZER_H__ | ||
| Line 89: | Line 140: | ||
| #endif /* __BUZZER_H__ */ | #endif /* __BUZZER_H__ */ | ||
| - | Source File | + | API Source File |
| #include <stdio.h> | #include <stdio.h> | ||
| Line 450: | Line 501: | ||
| return device_buzzer_off( DEVICE_BUZZER ); | return device_buzzer_off( DEVICE_BUZZER ); | ||
| } | } | ||
| - | |||
| - | Application Example | ||
| - | |||
| - | #include "Buzzer.h" | ||
| - | ... | ||
| - | ... | ||
| - | int main() | ||
| - | { | ||
| - | uint32_t Octave; | ||
| - | ... | ||
| - | ... | ||
| - | if ( buzzer_open() < 0 ) | ||
| - | { | ||
| - | printf("Fail to buzzer_open\n"); | ||
| - | } | ||
| - | ... | ||
| - | ... | ||
| - | case KEY_1: | ||
| - | printf("Key code : KEY_1 (0x%X)\n", KeyCode); | ||
| - | if ( IsReleased == 1 ) | ||
| - | { /* Key Released */ | ||
| - | ... | ||
| - | ... | ||
| - | buzzer_off(); | ||
| - | ... | ||
| - | ... | ||
| - | } | ||
| - | else | ||
| - | { | ||
| - | ... | ||
| - | ... | ||
| - | buzzer_on_code( MUSIC_FREQUENCY_CODE_C, Octave ); | ||
| - | ... | ||
| - | ... | ||
| - | } | ||
| - | break; | ||
| - | ... | ||
| - | ... | ||
| - | if ( buzzer_close() < 0 ) | ||
| - | { | ||
| - | printf("Fail to buzzer_close\n"); | ||
| - | } | ||
| - | ... | ||
| - | ... | ||
| - | } | ||
| - | |||
| - | 카가 눌리는 동안 소리가 난다. | ||
| - | |||
| - | |||
| - | |||