mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-30 10:09:25 -04:00
Start object-ization of RSSI thread.
This commit is contained in:
parent
19c89def75
commit
d9106b6f44
1 changed files with 8 additions and 3 deletions
|
@ -121,9 +121,13 @@ static __attribute__((noreturn)) msg_t baseband_fn(void *arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct rssi_thread_data_t {
|
||||||
|
uint32_t sampling_rate;
|
||||||
|
};
|
||||||
|
|
||||||
static WORKING_AREA(rssi_thread_wa, 128);
|
static WORKING_AREA(rssi_thread_wa, 128);
|
||||||
static __attribute__((noreturn)) msg_t rssi_fn(void *arg) {
|
static __attribute__((noreturn)) msg_t rssi_fn(void *arg) {
|
||||||
(void)arg;
|
auto thread_data = static_cast<const rssi_thread_data_t*>(arg);
|
||||||
chRegSetThreadName("rssi");
|
chRegSetThreadName("rssi");
|
||||||
|
|
||||||
RSSIStatisticsCollector stats;
|
RSSIStatisticsCollector stats;
|
||||||
|
@ -132,7 +136,7 @@ static __attribute__((noreturn)) msg_t rssi_fn(void *arg) {
|
||||||
// TODO: Place correct sampling rate into buffer returned here:
|
// TODO: Place correct sampling rate into buffer returned here:
|
||||||
const auto buffer_tmp = rf::rssi::dma::wait_for_buffer();
|
const auto buffer_tmp = rf::rssi::dma::wait_for_buffer();
|
||||||
const rf::rssi::buffer_t buffer {
|
const rf::rssi::buffer_t buffer {
|
||||||
buffer_tmp.p, buffer_tmp.count, 400000
|
buffer_tmp.p, buffer_tmp.count, thread_data->sampling_rate
|
||||||
};
|
};
|
||||||
|
|
||||||
stats.process(
|
stats.process(
|
||||||
|
@ -167,6 +171,7 @@ void __late_init(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static baseband_thread_data_t baseband_thread_data;
|
static baseband_thread_data_t baseband_thread_data;
|
||||||
|
static rssi_thread_data_t rssi_thread_data { 400000 };
|
||||||
|
|
||||||
static void init() {
|
static void init() {
|
||||||
i2s::i2s0::configure(
|
i2s::i2s0::configure(
|
||||||
|
@ -195,7 +200,7 @@ static void init() {
|
||||||
|
|
||||||
const auto thread_rssi = chThdCreateStatic(rssi_thread_wa, sizeof(rssi_thread_wa),
|
const auto thread_rssi = chThdCreateStatic(rssi_thread_wa, sizeof(rssi_thread_wa),
|
||||||
rssi_thread_priority, rssi_fn,
|
rssi_thread_priority, rssi_fn,
|
||||||
nullptr
|
&rssi_thread_data
|
||||||
);
|
);
|
||||||
|
|
||||||
baseband_thread_data.thread_main = thread_main;
|
baseband_thread_data.thread_main = thread_main;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue