Integrated program of 4 different kinds of application programs for processing sound signal. 4種類のサウンド信号処理を統合したプログラム.

Dependencies:   F746_GUI F746_SAI_IO FrequencyResponseDrawer SD_PlayerSkeleton UIT_FFT_Real

Committer:
MikamiUitOpen
Date:
Thu Apr 27 23:55:53 2017 +0000
Revision:
16:d60e5187fd31
Parent:
2:fcba17e3d573
17

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:224dccbc4edd 1 /* mbed Microcontroller Library
MikamiUitOpen 0:224dccbc4edd 2 * Copyright (c) 2006-2013 ARM Limited
MikamiUitOpen 0:224dccbc4edd 3 *
MikamiUitOpen 0:224dccbc4edd 4 * Licensed under the Apache License, Version 2.0 (the "License");
MikamiUitOpen 0:224dccbc4edd 5 * you may not use this file except in compliance with the License.
MikamiUitOpen 0:224dccbc4edd 6 * You may obtain a copy of the License at
MikamiUitOpen 0:224dccbc4edd 7 *
MikamiUitOpen 0:224dccbc4edd 8 * http://www.apache.org/licenses/LICENSE-2.0
MikamiUitOpen 0:224dccbc4edd 9 *
MikamiUitOpen 0:224dccbc4edd 10 * Unless required by applicable law or agreed to in writing, software
MikamiUitOpen 0:224dccbc4edd 11 * distributed under the License is distributed on an "AS IS" BASIS,
MikamiUitOpen 0:224dccbc4edd 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MikamiUitOpen 0:224dccbc4edd 13 * See the License for the specific language governing permissions and
MikamiUitOpen 0:224dccbc4edd 14 * limitations under the License.
MikamiUitOpen 0:224dccbc4edd 15 */
MikamiUitOpen 0:224dccbc4edd 16 #include "rtc_api.h"
MikamiUitOpen 0:224dccbc4edd 17
MikamiUitOpen 0:224dccbc4edd 18 #include <time.h>
MikamiUitOpen 0:224dccbc4edd 19 #include "rtc_time.h"
MikamiUitOpen 0:224dccbc4edd 20 #include "us_ticker_api.h"
MikamiUitOpen 0:224dccbc4edd 21
MikamiUitOpen 0:224dccbc4edd 22 #if DEVICE_RTC
MikamiUitOpen 0:224dccbc4edd 23 static void (*_rtc_init)(void) = rtc_init;
MikamiUitOpen 0:224dccbc4edd 24 static int (*_rtc_isenabled)(void) = rtc_isenabled;
MikamiUitOpen 0:224dccbc4edd 25 static time_t (*_rtc_read)(void) = rtc_read;
MikamiUitOpen 0:224dccbc4edd 26 static void (*_rtc_write)(time_t t) = rtc_write;
MikamiUitOpen 0:224dccbc4edd 27 #else
MikamiUitOpen 0:224dccbc4edd 28 static void (*_rtc_init)(void) = NULL;
MikamiUitOpen 0:224dccbc4edd 29 static int (*_rtc_isenabled)(void) = NULL;
MikamiUitOpen 0:224dccbc4edd 30 static time_t (*_rtc_read)(void) = NULL;
MikamiUitOpen 0:224dccbc4edd 31 static void (*_rtc_write)(time_t t) = NULL;
MikamiUitOpen 0:224dccbc4edd 32 #endif
MikamiUitOpen 0:224dccbc4edd 33
MikamiUitOpen 0:224dccbc4edd 34 #ifdef __cplusplus
MikamiUitOpen 0:224dccbc4edd 35 extern "C" {
MikamiUitOpen 0:224dccbc4edd 36 #endif
MikamiUitOpen 0:224dccbc4edd 37 #if defined (__ICCARM__)
MikamiUitOpen 0:224dccbc4edd 38 time_t __time32(time_t *timer)
MikamiUitOpen 0:224dccbc4edd 39 #else
MikamiUitOpen 0:224dccbc4edd 40 time_t time(time_t *timer)
MikamiUitOpen 0:224dccbc4edd 41 #endif
MikamiUitOpen 0:224dccbc4edd 42
MikamiUitOpen 0:224dccbc4edd 43 {
MikamiUitOpen 0:224dccbc4edd 44 if (_rtc_isenabled != NULL) {
MikamiUitOpen 0:224dccbc4edd 45 if (!(_rtc_isenabled())) {
MikamiUitOpen 0:224dccbc4edd 46 set_time(0);
MikamiUitOpen 0:224dccbc4edd 47 }
MikamiUitOpen 0:224dccbc4edd 48 }
MikamiUitOpen 0:224dccbc4edd 49
MikamiUitOpen 0:224dccbc4edd 50 time_t t = 0;
MikamiUitOpen 0:224dccbc4edd 51 if (_rtc_read != NULL) {
MikamiUitOpen 0:224dccbc4edd 52 t = _rtc_read();
MikamiUitOpen 0:224dccbc4edd 53 }
MikamiUitOpen 0:224dccbc4edd 54
MikamiUitOpen 0:224dccbc4edd 55 if (timer != NULL) {
MikamiUitOpen 0:224dccbc4edd 56 *timer = t;
MikamiUitOpen 0:224dccbc4edd 57 }
MikamiUitOpen 0:224dccbc4edd 58 return t;
MikamiUitOpen 0:224dccbc4edd 59 }
MikamiUitOpen 0:224dccbc4edd 60
MikamiUitOpen 0:224dccbc4edd 61 void set_time(time_t t) {
MikamiUitOpen 0:224dccbc4edd 62 if (_rtc_init != NULL) {
MikamiUitOpen 0:224dccbc4edd 63 _rtc_init();
MikamiUitOpen 0:224dccbc4edd 64 }
MikamiUitOpen 0:224dccbc4edd 65 if (_rtc_write != NULL) {
MikamiUitOpen 0:224dccbc4edd 66 _rtc_write(t);
MikamiUitOpen 0:224dccbc4edd 67 }
MikamiUitOpen 0:224dccbc4edd 68 }
MikamiUitOpen 0:224dccbc4edd 69
MikamiUitOpen 0:224dccbc4edd 70 clock_t clock() {
MikamiUitOpen 0:224dccbc4edd 71 clock_t t = us_ticker_read();
MikamiUitOpen 0:224dccbc4edd 72 t /= 1000000 / CLOCKS_PER_SEC; // convert to processor time
MikamiUitOpen 0:224dccbc4edd 73 return t;
MikamiUitOpen 0:224dccbc4edd 74 }
MikamiUitOpen 0:224dccbc4edd 75
MikamiUitOpen 0:224dccbc4edd 76 void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void)) {
MikamiUitOpen 0:224dccbc4edd 77 __disable_irq();
MikamiUitOpen 0:224dccbc4edd 78 _rtc_read = read_rtc;
MikamiUitOpen 0:224dccbc4edd 79 _rtc_write = write_rtc;
MikamiUitOpen 0:224dccbc4edd 80 _rtc_init = init_rtc;
MikamiUitOpen 0:224dccbc4edd 81 _rtc_isenabled = isenabled_rtc;
MikamiUitOpen 0:224dccbc4edd 82 __enable_irq();
MikamiUitOpen 0:224dccbc4edd 83 }
MikamiUitOpen 0:224dccbc4edd 84
MikamiUitOpen 0:224dccbc4edd 85
MikamiUitOpen 0:224dccbc4edd 86
MikamiUitOpen 0:224dccbc4edd 87 #ifdef __cplusplus
MikamiUitOpen 0:224dccbc4edd 88 }
MikamiUitOpen 0:224dccbc4edd 89 #endif