mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-12 15:59:49 -05:00
Provide configuration of symbol unstuffing.
This commit is contained in:
parent
a00fcbaa8f
commit
e9f28f9ef3
@ -199,6 +199,8 @@ static constexpr FSKConfiguration fsk_configuration_ais = {
|
|||||||
.access_code = 0b01010101010101010101111110,
|
.access_code = 0b01010101010101010101111110,
|
||||||
.access_code_length = 26,
|
.access_code_length = 26,
|
||||||
.access_code_tolerance = 1,
|
.access_code_tolerance = 1,
|
||||||
|
.unstuffing_pattern = 0b111110,
|
||||||
|
.unstuffing_length = 6,
|
||||||
.packet_length = 256,
|
.packet_length = 256,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -207,6 +209,8 @@ static constexpr FSKConfiguration fsk_configuration_tpms_a = {
|
|||||||
.access_code = 0b0101010101010101010101010110,
|
.access_code = 0b0101010101010101010101010110,
|
||||||
.access_code_length = 28,
|
.access_code_length = 28,
|
||||||
.access_code_tolerance = 1,
|
.access_code_tolerance = 1,
|
||||||
|
.unstuffing_pattern = 0,
|
||||||
|
.unstuffing_length = 0,
|
||||||
.packet_length = 160,
|
.packet_length = 160,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,11 +21,18 @@
|
|||||||
|
|
||||||
#include "packet_builder.hpp"
|
#include "packet_builder.hpp"
|
||||||
|
|
||||||
void PacketBuilder::configure(size_t new_payload_length) {
|
void PacketBuilder::configure(
|
||||||
|
uint32_t unstuffing_pattern,
|
||||||
|
size_t unstuffing_length,
|
||||||
|
size_t new_payload_length
|
||||||
|
) {
|
||||||
|
unstuff.configure(unstuffing_pattern, unstuffing_length);
|
||||||
|
|
||||||
if( new_payload_length <= payload.size() ) {
|
if( new_payload_length <= payload.size() ) {
|
||||||
payload_length = new_payload_length;
|
payload_length = new_payload_length;
|
||||||
reset_state();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PacketBuilder::reset_state() {
|
void PacketBuilder::reset_state() {
|
||||||
|
@ -30,7 +30,11 @@
|
|||||||
|
|
||||||
class PacketBuilder {
|
class PacketBuilder {
|
||||||
public:
|
public:
|
||||||
void configure(size_t new_payload_length);
|
void configure(
|
||||||
|
uint32_t unstuffing_pattern,
|
||||||
|
size_t unstuffing_length,
|
||||||
|
size_t new_payload_length
|
||||||
|
);
|
||||||
|
|
||||||
template<typename PayloadHandler>
|
template<typename PayloadHandler>
|
||||||
void execute(
|
void execute(
|
||||||
|
@ -50,7 +50,11 @@ void FSKProcessor::configure(const FSKConfiguration new_configuration) {
|
|||||||
new_configuration.access_code_length,
|
new_configuration.access_code_length,
|
||||||
new_configuration.access_code_tolerance
|
new_configuration.access_code_tolerance
|
||||||
);
|
);
|
||||||
packet_builder.configure(new_configuration.packet_length);
|
packet_builder.configure(
|
||||||
|
new_configuration.unstuffing_pattern,
|
||||||
|
new_configuration.unstuffing_length,
|
||||||
|
new_configuration.packet_length
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSKProcessor::execute(buffer_c8_t buffer) {
|
void FSKProcessor::execute(buffer_c8_t buffer) {
|
||||||
|
@ -198,6 +198,8 @@ struct FSKConfiguration {
|
|||||||
uint32_t access_code;
|
uint32_t access_code;
|
||||||
size_t access_code_length;
|
size_t access_code_length;
|
||||||
size_t access_code_tolerance;
|
size_t access_code_tolerance;
|
||||||
|
uint32_t unstuffing_pattern;
|
||||||
|
size_t unstuffing_length;
|
||||||
size_t packet_length;
|
size_t packet_length;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user