Questions and discussions about the software that runs on the TD RF module itself.
hugo
 
Posts: 23
Joined: Tue Aug 04, 2015 8:28 am

accelerometer swith between data and event

by hugo Thu Sep 24, 2015 5:42 pm

Hello,
I would like to read raw data from accelerometer, when an event is coming.

I wrote this function, which is a callback from the move:

void MoveDetected(uint8_t source)
{
tfp_printf("move detected\r\n");
TD_ACCELERO_MonitorEvent(false, // Monitoring enabled
TD_ACCELERO_1HZ, // Sampling rate 10 Hz
TD_ACCELERO_ALL_AXIS, // Axis mask: all axis
TD_ACCELERO_2G, // Scale 2 g
TD_ACCELERO_ALL_HIGH_IRQ, // Only monitor high IRQs, as low IRQs are always set in
// accelerometer registers
10, // Threshold in mg = 10 * 2 g / 127 = +- 160 mg (with scale 2 g)
1, // Duration in ms = 1 * (1 / 10 Hz) = 100 ms (with rate 10 Hz)
1, // High-pass filter enabled
MoveDetected);

TD_ACCELERO_MonitorData(true, // Monitoring enabled
false, // Low-power mode disabled
TD_ACCELERO_1HZ, // Sampling rate 1 Hz
TD_ACCELERO_ALL_AXIS, // Axis mask: all axis
TD_ACCELERO_2G, // Scale 2 g
0, // High-pass filter disabled
TD_ACCELERO_STREAM, // FIFO stream mode
ACCELERO_AVERAGE_SAMPLE, // Update watermark disabled (32 max, 0 is real-time)
DataCallback);
}


The problem is if the Datacallback gives great results if configured directly from the setup, it gives high pass filtered results on x an y axis only (?), when TD_ACCELERO_MonitorEvent is only called here.

I also don't know if both MonitorEvent and MonitorData ca work at the same time, and so if I must switch one off when I want to use the other one.
Thank you for your help.
hugo
 
Posts: 23
Joined: Tue Aug 04, 2015 8:28 am

Re: accelerometer swith between data and event

by hugo Fri Sep 25, 2015 12:09 pm

I solved the problem by adding:
TD_ACCELERO_WriteRegister(0x21,0x00);
before coming back to data polling mode.
But it's an ugly solution I think.
thomas110594
 
Posts: 6
Joined: Thu Jun 09, 2016 7:09 am

Re: accelerometer swith between data and event

by thomas110594 Mon Jun 20, 2016 2:18 pm

hi !

I'm encountering the same problem as you. Can you be more specific concerning the way to solve it?

Thanks,

thomas
Return to Firmware

Who is online

Users browsing this forum: No registered users and 33 guests