-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathrf_data_gen.c
91 lines (66 loc) · 2.43 KB
/
rf_data_gen.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
MIT License
Copyright (c) 2024 Charles Lohr "CNLohr"
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// TEST 1: 125kHz with -.028 675
// TEST 2: 500kHz with 138 kHz correction. 534??
// TEST 3: 500kHz with 0 kHz correction. FAIL
// TEST 4: 125kHz with -.028 5V 1210
//END OF RED ANTENNA
// TEST 5: 125kHz with -.027 3.3V, shorter antenna? 829
// TEST 6: 125k ESP 80 GREY antenna ???/??? 850 /
#include <stdint.h>
// Transmit a 500kHz width LoRa
//#define KHZ500
// Expects a 24MHz external clock.
//#define USE_EXTERNAL_CLOCK
#ifdef KHZ500
const double tune_mhz = -0.000;
const double center_frequency = 904.6 + tune_mhz;
const double bw = .5;
#ifdef USE_EXTERNAL_CLOCK
#define SF_NUMBER 9
#else
#define SF_NUMBER 10
#endif
#define SF_SYMBOL_TIME 0.00000025
#else // 125kHz channel
const double bw = 0.125;
#ifdef USE_EXTERNAL_CLOCK
const double tune_mhz = 0.00;
#define SF_NUMBER 7
#else
const double tune_mhz = -0.028; //XXX ??? Per device tuning? Or area the load caps just wrong?
#define SF_NUMBER 8
#endif
const double center_frequency = 904.5 + tune_mhz;
#endif
#define SPI_DIV 1
#ifdef USE_EXTERNAL_CLOCK
const double sample_rate = (24*9/2)/SPI_DIV; //216MHz PLL
#else
const double sample_rate = (72)/SPI_DIV;
#endif
#define ATTRIBUTE_FOR_DATA "__attribute__((section(\".text\")))"
#define USE_16_BITS
const uint32_t memory_offset = 0x00000;
#include "../../lib/rf_data_gen.h"
int main()
{
return gen_buffer_files();
}