Hi everyone,
I’m using a Cobra/G120, and I’m trying to use the RLP realtime audio example to learn RLP.
https://www.ghielectronics.com/docs/151/rlp-realtime-audio-recording
The problem is when I return from the RLP function call, all the ‘captured’ data is 0.
#define ADC_DATA_BASE_ADDRESS 0xE0034010
int GHAL_AnalogIn_Read(unsigned char channel)
{
return ((*((int*)(ADC_DATA_BASE_ADDRESS) + channel)) >>8) & 0x3FF;
}
int ReadAudio(unsigned int *generalArray, void **args, unsigned int argsCount ,
unsigned int *argSize)
{
unsigned char *buffer = (unsigned char*)args[0];
int buffer_lengh = argSize[0];
unsigned char channel = *(unsigned char*)args[1];
int i=3;
buffer[0] = 3;
buffer[1] = 2;
buffer[2] = 1;
while(i<buffer_lengh)
{
buffer[i] = GHAL_AnalogIn_Read(channel);
i++;
RLPext->Delay(125);
}
return 0;
}
If you notice, I set the first 3 spots in the buffer to 3,2,1… which does come across correctly. So the problem must be with this call:
return ((*((int*)(ADC_DATA_BASE_ADDRESS) + channel)) >>8) & 0x3FF;
I suspect the ADC_DATA_BASE_ADDRESS is not correct, or I’m not setting up the pin correctly. Can anyone help me diagnose this issue?