Skip to content

Commit

Permalink
Code werkt
Browse files Browse the repository at this point in the history
Zendt tonen uit via de i2s2 module van digilent via de fpga aangestuurd vanuit de zynq PS
  • Loading branch information
MotmansS committed May 15, 2021
1 parent a50f4a6 commit 3bd7231
Show file tree
Hide file tree
Showing 141 changed files with 160,233 additions and 2,961 deletions.
10 changes: 10 additions & 0 deletions I2S_Audioplayer/AudioplayerC/.analytics
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ timestamp=[2021-05-14 16:19:17], mode=BUILD, duration=0:00:00.360, duration_ms=3
timestamp=[2021-05-14 16:22:01], mode=BUILD, duration=0:00:00.988, duration_ms=988, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-14 16:23:42], mode=BUILD, duration=0:00:02.091, duration_ms=2091, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-14 16:26:06], mode=BUILD, duration=0:00:01.074, duration_ms=1074, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 13:22:22], mode=WORKBENCH_START, duration=0:00:10.072, duration_ms=10072, data={}
timestamp=[2021-05-15 13:22:22], mode=WORKBENCH_UI_INIT, duration=0:00:00.572, duration_ms=572, data={editors_count=24, platform_editors_count=12, projects_count=4, platform_projects_count=1, active_platform_editor=false, projects=LowerFreqButtons,RemoteSystemsTempFiles,Synthesiser,Synthesiser_system}
timestamp=[2021-05-15 13:22:23], mode=PLATFORM_REPOSITORY_INIT, duration=0:00:00.655, duration_ms=655, data={}
timestamp=[2021-05-15 13:32:08], mode=BUILD, duration=0:00:00.797, duration_ms=797, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 13:32:21], mode=BUILD, duration=0:00:00.511, duration_ms=511, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 13:32:42], mode=BUILD, duration=0:00:01.097, duration_ms=1097, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 13:40:58], mode=BUILD, duration=0:00:00.466, duration_ms=466, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 14:02:30], mode=BUILD, duration=0:00:00.539, duration_ms=539, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 14:05:58], mode=BUILD, duration=0:00:00.966, duration_ms=966, data={name=Synthesiser, configuration=Debug, clean_build=false}
timestamp=[2021-05-15 14:48:23], mode=BUILD, duration=0:00:01.420, duration_ms=1420, data={name=Synthesiser, configuration=Debug, clean_build=false}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@


#include "xstatus.h"
#include "AudioPlayer.h"
#include "xparameters.h"
#include "xgpio.h"
#include "xil_printf.h"
#include "xil_types.h"

#define GPIO_BASE 0x41200000;
#define GPIO_OUTPUT_DEVICE_ID XPAR_GPIO_0_DEVICE_ID
#define GPIO_INPUT_DEVICE_ID XPAR_GPIO_0_DEVICE_ID

#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08

void GpioInputExample(u16 DeviceId, u32 *DataRead);
XGpio gpioOutput;
XGpio GpioInput;

int main(void)
{
u32 InputData = 0;
u32 InputData2 = 0;
u32 InputData3 = 0;
u32 InputData4 = 0;
int Status;

if(AudioPlayer_Init() != XST_SUCCESS)
{

return XST_FAILURE;
}
char octaveCounter = 1;
char soundType = 1;
XGpio_Initialize(&gpioOutput, GPIO_OUTPUT_DEVICE_ID);
XGpio_SetDataDirection(&gpioOutput, 2, 0x00000000);

XGpio_Initialize(&GpioInput, GPIO_OUTPUT_DEVICE_ID);
/* Set the direction for all signals to be inputs */
XGpio_SetDataDirection(&GpioInput, 1, 0xFFFFFFFF);

while(1)
{
char counter = 0;
if(counter == 0 ){

XGpio_DiscreteWrite(&gpioOutput, 2, BIT0);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData);
if (Status != XST_SUCCESS) {

}
switch(InputData)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,1); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,2); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,3); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,4); break;
default: break;
}
counter++;
}

if(counter == 1){
XGpio_DiscreteWrite(&gpioOutput, 2, BIT1);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData2);
if (Status != XST_SUCCESS) {}
switch(InputData2)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,5); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,6); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,7); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,8); break;
default: break;
}
counter++;
}



if(counter == 2){
XGpio_DiscreteWrite(&gpioOutput, 2, BIT2);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData3);
if (Status != XST_SUCCESS) {

}
switch(InputData3)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,1); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,2); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,3); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,4); break;
default: break;
}
counter++;
}

if(counter == 3){
XGpio_DiscreteWrite(&gpioOutput, 2, BIT2);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData4);
if (Status != XST_SUCCESS) {

}
switch(InputData4)
{
case 14: octaveCounter++; if (octaveCounter >2){octaveCounter = 1;} break;
case 13: octaveCounter--; if (octaveCounter <1 ){octaveCounter = 2;} break;
case 12: soundType++; if (soundType >4){soundType = 0;} break;
case 7: soundType--; if (soundType <1){soundType = 4;} break;
default: break;
}
counter++;
}

}
return XST_FAILURE;

}


void GpioInputExample(u16 DeviceId, u32 *DataRead)
{

/* Read the state of the data so that it can be verified */
*DataRead = XGpio_DiscreteRead(&GpioInput, 1);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="ASCII"?>
<sdkproject:SdkProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sdkproject="http://www.xilinx.com/sdkproject" name="Synthesiser" location="D:/GIT/SoCMyCock_Project/I2S_Audioplayer/AudioplayerC/Synthesiser" platform="D:/GIT/SoCMyCock_Project/I2S_Audioplayer/AudioplayerC/LowerFreqButtons/export/LowerFreqButtons/LowerFreqButtons.xpfm" platformUID="xilinx:minized::0.0(custom)" systemProject="Synthesiser_system" sysConfig="LowerFreqButtons" runtime="cpp" cpu="standalone_ps7_cortexa9_0" cpuInstance="ps7_cortexa9_0" os="standalone" mssSignature="4c7735b8b457fc535fc28f9c19fb1099">
<configuration name="Debug" id="xilinx.gnu.armv7.exe.debug.1758778525">
<configBuildOptions xsi:type="sdkproject:SdkOptions"/>
<lastBuildOptions xsi:type="sdkproject:SdkOptions"/>
</configuration>
<configuration name="Release" id="xilinx.gnu.armv7.exe.release.1510637539" dirty="true">
<configBuildOptions xsi:type="sdkproject:SdkOptions"/>
</configuration>
<template appTemplateName="hello_world"/>
</sdkproject:SdkProject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@


#include "xstatus.h"
#include "AudioPlayer.h"
#include "xparameters.h"
#include "xgpio.h"
#include "xil_printf.h"
#include "xil_types.h"

#define GPIO_BASE 0x41200000;
#define GPIO_OUTPUT_DEVICE_ID XPAR_GPIO_0_DEVICE_ID
#define GPIO_INPUT_DEVICE_ID XPAR_GPIO_0_DEVICE_ID

#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08

void GpioInputExample(u16 DeviceId, u32 *DataRead);
XGpio gpioOutput;
XGpio GpioInput;

int main(void)
{
u32 InputData = 0;
u32 InputData2 = 0;
u32 InputData3 = 0;
u32 InputData4 = 0;
int Status;

if(AudioPlayer_Init() != XST_SUCCESS)
{

return XST_FAILURE;
}
char octaveCounter = 1;
char soundType = 1;
XGpio_Initialize(&gpioOutput, GPIO_OUTPUT_DEVICE_ID);
XGpio_SetDataDirection(&gpioOutput, 2, 0x00000000);

XGpio_Initialize(&GpioInput, GPIO_OUTPUT_DEVICE_ID);
/* Set the direction for all signals to be inputs */
XGpio_SetDataDirection(&GpioInput, 1, 0xFFFFFFFF);

while(1)
{
if(XGpio_DiscreteWrite(&gpioOutput, 2, BIT0))
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData);
if (Status != XST_SUCCESS) {

}
switch(InputData)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,1); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,2); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,3); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,4); break;
default: break;
}

if( XGpio_DiscreteWrite(&gpioOutput, 2, BIT1)){

if (Status != XST_SUCCESS) {}
switch(InputData2)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,5); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,6); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,7); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,8); break;
default: break;
}
}
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData2);


XGpio_DiscreteWrite(&gpioOutput, 2, BIT2);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData3);
if (Status != XST_SUCCESS) {

}
switch(InputData3)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,1); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,2); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,3); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,4); break;
default: break;
}

XGpio_DiscreteWrite(&gpioOutput, 2, BIT3);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData4);
if (Status != XST_SUCCESS) {

}
switch(InputData4)
{
case 14: octaveCounter++; if (octaveCounter >2){octaveCounter = 1;} break;
case 13: octaveCounter--; if (octaveCounter <1 ){octaveCounter = 2;} break;
case 12: soundType++; if (soundType >4){soundType = 0;} break;
case 7: soundType--; if (soundType <1){soundType = 4;} break;
default: break;
}

}
return XST_FAILURE;

}


void GpioInputExample(u16 DeviceId, u32 *DataRead)
{

/* Read the state of the data so that it can be verified */
*DataRead = XGpio_DiscreteRead(&GpioInput, 1);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@


#include "xstatus.h"
#include "AudioPlayer.h"
#include "xparameters.h"
#include "xgpio.h"
#include "xil_printf.h"
#include "xil_types.h"

#define GPIO_BASE 0x41200000;
#define GPIO_OUTPUT_DEVICE_ID XPAR_GPIO_0_DEVICE_ID
#define GPIO_INPUT_DEVICE_ID XPAR_GPIO_0_DEVICE_ID

#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08

void GpioInputExample(u16 DeviceId, u32 *DataRead);
XGpio gpioOutput;
XGpio GpioInput;

int main(void)
{
u32 InputData = 0;
u32 InputData2 = 0;
u32 InputData3 = 0;
u32 InputData4 = 0;
int Status;

if(AudioPlayer_Init() != XST_SUCCESS)
{

return XST_FAILURE;
}
char octaveCounter = 1;
char soundType = 1;
XGpio_Initialize(&gpioOutput, GPIO_OUTPUT_DEVICE_ID);
XGpio_SetDataDirection(&gpioOutput, 2, 0x00000000);

XGpio_Initialize(&GpioInput, GPIO_OUTPUT_DEVICE_ID);
/* Set the direction for all signals to be inputs */
XGpio_SetDataDirection(&GpioInput, 1, 0xFFFFFFFF);

while(1)
{
for(int i = 1; i< 9; i = i*2){
if(i == 1)
{

}
}
XGpio_DiscreteWrite(&gpioOutput, 2, BIT0);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData);
if (Status != XST_SUCCESS) {

}
switch(InputData)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,1); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,2); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,3); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,4); break;
default: break;
}

XGpio_DiscreteWrite(&gpioOutput, 2, BIT1);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData2);
if (Status != XST_SUCCESS) {

}
switch(InputData2)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,5); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,6); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,7); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter,8); break;
default: break;
}

XGpio_DiscreteWrite(&gpioOutput, 2, BIT2);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData3);
if (Status != XST_SUCCESS) {

}
switch(InputData3)
{
case 14: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,1); break;
case 13: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,2); break;
case 12: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,3); break;
case 7: AudioPlayer_SendTestSignal(4000,soundType,octaveCounter+1,4); break;
default: break;
}

XGpio_DiscreteWrite(&gpioOutput, 2, BIT3);
GpioInputExample(GPIO_INPUT_DEVICE_ID, &InputData4);
if (Status != XST_SUCCESS) {

}
switch(InputData4)
{
case 14: octaveCounter++; if (octaveCounter >2){octaveCounter = 1;} break;
case 13: octaveCounter--; if (octaveCounter <1 ){octaveCounter = 2;} break;
case 12: soundType++; if (soundType >4){soundType = 0;} break;
case 7: soundType--; if (soundType <1){soundType = 4;} break;
default: break;
}

}
return XST_FAILURE;

}


void GpioInputExample(u16 DeviceId, u32 *DataRead)
{

/* Read the state of the data so that it can be verified */
*DataRead = XGpio_DiscreteRead(&GpioInput, 1);

}
Loading

0 comments on commit 3bd7231

Please sign in to comment.