📄 fftavr.h
字号:
/*
* fftAvr.h
*
* This Library handels the communication to an FFT calculating AVR via
* the TWI.
*
* 26/01/2005
*
* Copyright (C) 2005, Fabian Maximilian Thiele
* me@apetech.de
* http://www.apetech.de
*/
#ifndef FFT_AVR_H
#define FFT_AVR_H
// Uncomment this to use interrupt controlled transmission. A user supplied
// callback function is called, when the transmission is complete.
#define FFT_USE_INTERRUPT
typedef void (*fftAvrResultCallback)(uint8_t*);
// TWI-Address
#define FFT_AVR_TWI_ADDR 0x10
// FFT-Mode
#define FFT_HI_RES 1
#define FFT_HI_RES_PEAK 2
#define FFT_LO_RES 3
#define FFT_LO_RES_PEAK 4
#define FFT_MIXED 5
#define FFT_MIXED_PEAK 6
// Spectrum length
#define FFT_HI_RES_LEN 64
#define FFT_LO_RES_LEN 64
#define FFT_MIXED_LEN 78
// FFT-Addresses
#define FFT_HI_RES_ADDR 0x0000
#define FFT_HI_RES_PEAK_ADDR 0x0040
#define FFT_LO_RES_ADDR 0x0080
#define FFT_LO_RES_PEAK_ADDR 0x00C0
#define FFT_MIXED_ADDR 0x0100
#define FFT_MIXED_PEAK_ADDR 0x014E
/*
* This function reads the requested spectrum out of the FFT AVR. In
* non-interrupt mode the function waits until the end of the transmission,
* in interrupt mode the transmission is only initialized. A previously
* supplied callback is called out of the isr, when the transmission has
* finished. If no callback is supplied the global variable fftAvrTransComp
* will be set to one.
*/
void fftAvrReadSpectrum(uint8_t fftMode, uint8_t* buffer);
#ifdef FFT_USE_INTERRUPT
extern volatile uint8_t fftAvrTransComp;
// Sets the callback function for interrupt controlled spectrum
// transmission.
void fftAvrSetCallback(fftAvrResultCallback callback);
// Default transmission complete callback
void fftAvrTransmissionComplete(uint8_t* buffer);
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -