Formatted code (#1007)

* Updated style

* Updated files

* fixed new line

* Updated spacing

* File fix WIP

* Updated to clang 13

* updated comment style

* Removed old comment code
This commit is contained in:
jLynx 2023-05-19 08:16:05 +12:00 committed by GitHub
parent 7aca7ce74d
commit 033c4e9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
599 changed files with 70746 additions and 66896 deletions

View file

@ -29,7 +29,7 @@
#include "utility.hpp"
namespace cc1101 {
// Data rate (Bauds)
// Whitening: Everything except preamble and sync word, init value = 111111111
// Packet format: preamble, sync word, (opt) length, (opt) address, payload, (opt) CRC
@ -43,70 +43,69 @@ namespace cc1101 {
// FEC: ?
class CC1101Emu {
public:
//CC1101Emu();
//~CC1101Emu();
enum packet_mode_t {
FIXED_LENGTH,
VARIABLE_LENGTH,
INFINITE_LENGTH
};
enum modulation_t {
TWO_FSK,
GFSK,
OOK,
FOUR_FSK,
MSK,
};
void set_sync_word(const uint16_t sync_word) {
sync_word_ = sync_word;
};
void set_address(const uint8_t address) {
address_ = address;
};
void set_packet_length(const uint8_t packet_length) {
packet_length_ = packet_length;
};
void set_data_config(const bool CRC, const bool manchester, const bool whitening) {
CRC_ = CRC;
manchester_ = manchester;
whitening_ = whitening;
};
void set_packet_mode(const packet_mode_t packet_mode) {
packet_mode_ = packet_mode;
};
void set_modulation(const modulation_t modulation) {
modulation_ = modulation;
}
void set_num_preamble(const uint8_t num_preamble) { // 2, 3, 4, 6, 8, 12, 16, or 24
num_preamble_ = num_preamble;
};
void set_deviation(const size_t deviation) {
deviation_ = deviation;
};
public:
// CC1101Emu();
//~CC1101Emu();
private:
uint16_t sync_word_ { 0xD391 };
uint8_t address_ { 0x00 };
uint8_t packet_length_ { 0 };
bool CRC_ { false };
bool manchester_ { false };
bool whitening_ { true };
packet_mode_t packet_mode_ { VARIABLE_LENGTH };
modulation_t modulation_ { TWO_FSK };
uint8_t num_preamble_ { 4 };
size_t deviation_ { 4000 };
uint16_t whitening_pn { 0x1FF };
void whitening_init();
uint8_t whiten_byte(uint8_t byte);
enum packet_mode_t {
FIXED_LENGTH,
VARIABLE_LENGTH,
INFINITE_LENGTH
};
enum modulation_t {
TWO_FSK,
GFSK,
OOK,
FOUR_FSK,
MSK,
};
void set_sync_word(const uint16_t sync_word) {
sync_word_ = sync_word;
};
void set_address(const uint8_t address) {
address_ = address;
};
void set_packet_length(const uint8_t packet_length) {
packet_length_ = packet_length;
};
void set_data_config(const bool CRC, const bool manchester, const bool whitening) {
CRC_ = CRC;
manchester_ = manchester;
whitening_ = whitening;
};
void set_packet_mode(const packet_mode_t packet_mode) {
packet_mode_ = packet_mode;
};
void set_modulation(const modulation_t modulation) {
modulation_ = modulation;
}
void set_num_preamble(const uint8_t num_preamble) { // 2, 3, 4, 6, 8, 12, 16, or 24
num_preamble_ = num_preamble;
};
void set_deviation(const size_t deviation) {
deviation_ = deviation;
};
private:
uint16_t sync_word_{0xD391};
uint8_t address_{0x00};
uint8_t packet_length_{0};
bool CRC_{false};
bool manchester_{false};
bool whitening_{true};
packet_mode_t packet_mode_{VARIABLE_LENGTH};
modulation_t modulation_{TWO_FSK};
uint8_t num_preamble_{4};
size_t deviation_{4000};
uint16_t whitening_pn{0x1FF};
void whitening_init();
uint8_t whiten_byte(uint8_t byte);
};
} /* namespace cc1101 */
#endif/*__EMU_CC1101_H__*/
#endif /*__EMU_CC1101_H__*/