Last active
July 20, 2019 08:22
-
-
Save pratimugale/933a1e905db39f0e42b6ff5e00939cb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <pru_cfg.h> | |
#include <math.h> | |
#include "resource_table_empty.h" | |
#define PRU_SHARED 0x00010000 | |
extern void start(void); | |
void main(void){ | |
volatile uint8_t* sram_pointer = (volatile uint8_t *)PRU_SHARED; | |
// Generate sine values in an array | |
int i; | |
uint8_t waveform[100]; | |
float gain = 50.0f; | |
float phase = 0.0f; | |
float bias = 50.0f; | |
float freq = 2.0f * 3.14159f / 100.0f; | |
for (i = 0; i < 100; i++){ | |
//waveform[i] = (uint8_t)(bias + (gain * sin((i*freq) + phase))); | |
//waveform[i] = (uint8_t)i; | |
} | |
//uint16_t* sram_pointer = (uint16_t *) PRU_SHARED; | |
uint8_t samplestep = 1; //delay factor | |
*(sram_pointer) = samplestep; | |
uint8_t numbersamples = 130; | |
*(sram_pointer+1) = numbersamples; | |
for(i = 0; i < 100; i++){ | |
//*(sram_pointer + 2 + i) = waveform[i]; | |
*(sram_pointer + 2 + i) = (uint8_t)(i); | |
__delay_cycles(10000); | |
} | |
start(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment