This example demonstrates how to use the msp_matrix_trans_q15 API to perform transpose of a real matrix.
#include "msp430.h"
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
#include "DSPLib.h"
#define FS 8192
#define SIGNAL_ROWS 10
#define SIGNAL_COLS 12
#define SIGNAL_FREQUENCY 200
#define SIGNAL_AMPLITUDE 0.6
#define PI 3.1415926536
_q15 inputA[SIGNAL_ROWS][SIGNAL_COLS];
_q15 result[SIGNAL_COLS][SIGNAL_ROWS];
volatile uint32_t cycleCount;
extern void initSignal(void);
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
#ifdef __MSP430_HAS_PMM__
PM5CTL0 &= ~LOCKLPM5;
#endif
initSignal();
transParams.
rows = SIGNAL_ROWS;
transParams.
cols = SIGNAL_COLS;
__no_operation();
}
void initSignal(void)
{
uint16_t i;
for (i = 0; i < SIGNAL_ROWS; i++) {
sinParams.
length = SIGNAL_COLS;
sinParams.
cosOmega =
_Q15(cosf((
float)i*2*PI*SIGNAL_FREQUENCY/FS/(
float)SIGNAL_ROWS));
sinParams.
sinOmega =
_Q15(sinf((
float)i*2*PI*SIGNAL_FREQUENCY/FS/(
float)SIGNAL_ROWS));
}
}