Skip to content

Commit aa4e056

Browse files
author
CTSchorsch
committed
git trouble
1 parent 10fa9f9 commit aa4e056

File tree

7 files changed

+37
-176
lines changed

7 files changed

+37
-176
lines changed

hwconf/hw_gesc.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
#include "timeout.h"
3333
#include "stdio.h"
3434

35-
#ifdef HW_HAS_RFM95W
36-
#include "lora/rfm95w.h"
35+
#ifdef HW_HAS_LORA
36+
#include "lora/lora.h"
3737
#endif
3838

3939
// Threads
@@ -132,8 +132,8 @@ void hw_init_gpio(void) {
132132
palSetPadMode(GPIOC, 4, PAL_MODE_INPUT_ANALOG);
133133
palSetPadMode(GPIOC, 5, PAL_MODE_INPUT_ANALOG);
134134

135-
#ifdef HW_HAS_RFM95W
136-
rfm95w_init();
135+
#ifdef HW_HAS_LORA
136+
lora_init();
137137
#endif
138138
#ifndef HW_HAS_DUAL_MOTORS
139139
//register terminal callbacks

hwconf/hw_gesc.h

+16-16
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
//#define HW_HAS_PHASE_FILTERS
2929
#define INVERTED_SHUNT_POLARITY
3030
#define HW_HAS_NO_CAN
31-
#define HW_HAS_RFM95W
31+
#define HW_HAS_LORA
3232

3333
// Macros
3434
#define LED_GREEN_GPIO GPIOB
@@ -222,21 +222,21 @@
222222
#define HW_SPI_PORT_MISO GPIOA
223223
#define HW_SPI_PIN_MISO 6
224224

225-
#ifdef HW_HAS_RFM95W
226-
#define HW_RFM95W_SPI_DEV SPID1
227-
#define HW_RFM95W_SPI_GPIO_AF GPIO_AF_SPI1
228-
#define HW_RFM95W_SPI_PORT_NSS GPIOA
229-
#define HW_RFM95W_SPI_PIN_NSS 4
230-
#define HW_RFM95W_SPI_PORT_SCK GPIOA
231-
#define HW_RFM95W_SPI_PIN_SCK 5
232-
#define HW_RFM95W_SPI_PORT_MOSI GPIOA
233-
#define HW_RFM95W_SPI_PIN_MOSI 7
234-
#define HW_RFM95W_SPI_PORT_MISO GPIOA
235-
#define HW_RFM95W_SPI_PIN_MISO 6
236-
#define HW_RFM95W_SPI_PORT_DIO0 GPIOC
237-
#define HW_RFM95W_SPI_PIN_DIO0 5
238-
#define HW_RFM95W_SPI_PORT_RESET GPIOB
239-
#define HW_RFM95W_SPI_PIN_RESET 2
225+
#ifdef HW_HAS_LORA
226+
#define HW_LORA_SPI_DEV SPID1
227+
#define HW_LORA_SPI_GPIO_AF GPIO_AF_SPI1
228+
#define HW_LORA_SPI_PORT_NSS GPIOA
229+
#define HW_LORA_SPI_PIN_NSS 4
230+
#define HW_LORA_SPI_PORT_SCK GPIOA
231+
#define HW_LORA_SPI_PIN_SCK 5
232+
#define HW_LORA_SPI_PORT_MOSI GPIOA
233+
#define HW_LORA_SPI_PIN_MOSI 7
234+
#define HW_LORA_SPI_PORT_MISO GPIOA
235+
#define HW_LORA_SPI_PIN_MISO 6
236+
#define HW_LORA_SPI_PORT_DIO0 GPIOC
237+
#define HW_LORA_SPI_PIN_DIO0 5
238+
#define HW_LORA_SPI_PORT_RESET GPIOB
239+
#define HW_LORA_SPI_PIN_RESET 2
240240
#endif
241241

242242
// Measurement macros

lora.c

-124
This file was deleted.

lora.h

-15
This file was deleted.

lora/SX1278.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
#include "conf_general.h"
27-
#ifdef HW_HAS_RFM95W
27+
#ifdef HW_HAS_LORA
2828

2929
#include "SX1278.h"
3030
#include <string.h>

lora/SX1278_hw.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
#include "conf_general.h"
10-
#ifdef HW_HAS_RFM95W
10+
#ifdef HW_HAS_LORA
1111

1212
#include "SX1278_hw.h"
1313

@@ -17,18 +17,18 @@ static void spi_delay(void);
1717

1818
void SX1278_hw_init() {
1919
SX1278_hw_SetNSS(0);
20-
palSetPad(HW_RFM95W_SPI_PORT_RESET, HW_RFM95W_SPI_PIN_RESET);
20+
palSetPad(HW_LORA_SPI_PORT_RESET, HW_LORA_SPI_PIN_RESET);
2121
}
2222

2323
void SX1278_hw_SetNSS(int value) {
24-
palWritePad(HW_RFM95W_SPI_PORT_NSS, HW_RFM95W_SPI_PIN_NSS, value);
24+
palWritePad(HW_LORA_SPI_PORT_NSS, HW_LORA_SPI_PIN_NSS, value);
2525
}
2626

2727
void SX1278_hw_Reset() {
2828
SX1278_hw_SetNSS(1);
29-
palClearPad(HW_RFM95W_SPI_PORT_RESET, HW_RFM95W_SPI_PIN_RESET);
29+
palClearPad(HW_LORA_SPI_PORT_RESET, HW_LORA_SPI_PIN_RESET);
3030
SX1278_hw_DelayMs(1);
31-
palSetPad(HW_RFM95W_SPI_PORT_RESET, HW_RFM95W_SPI_PIN_RESET);
31+
palSetPad(HW_LORA_SPI_PORT_RESET, HW_LORA_SPI_PIN_RESET);
3232
SX1278_hw_DelayMs(100);
3333
}
3434

@@ -51,7 +51,7 @@ void SX1278_hw_DelayMs(uint32_t msec) {
5151
}
5252

5353
int SX1278_hw_GetDIO0() {
54-
return (palReadPad(HW_RFM95W_SPI_PORT_DIO0,HW_RFM95W_SPI_PIN_DIO0));
54+
return (palReadPad(HW_LORA_SPI_PORT_DIO0,HW_LORA_SPI_PIN_DIO0));
5555
}
5656

5757

@@ -63,27 +63,27 @@ static void spi_transfer(uint8_t *in_buf, const uint8_t *out_buf, int length) {
6363
uint8_t receive = 0;
6464

6565
for (int bit = 0;bit < 8;bit++) {
66-
palWritePad(HW_SPI_PORT_MOSI, HW_SPI_PIN_MOSI, send >> 7);
66+
palWritePad(HW_LORA_SPI_PORT_MOSI, HW_LORA_SPI_PIN_MOSI, send >> 7);
6767
send <<= 1;
6868

69-
palSetPad(HW_RFM95W_SPI_PORT_SCK, HW_RFM95W_SPI_PIN_SCK);
69+
palSetPad(HW_LORA_SPI_PORT_SCK, HW_LORA_SPI_PIN_SCK);
7070
spi_delay();
7171

7272
int samples = 0;
73-
samples += palReadPad(HW_RFM95W_SPI_PORT_MISO, HW_RFM95W_SPI_PIN_MISO);
73+
samples += palReadPad(HW_LORA_SPI_PORT_MISO, HW_LORA_SPI_PIN_MISO);
7474
__NOP();
75-
samples += palReadPad(HW_RFM95W_SPI_PORT_MISO, HW_RFM95W_SPI_PIN_MISO);
75+
samples += palReadPad(HW_LORA_SPI_PORT_MISO, HW_LORA_SPI_PIN_MISO);
7676
__NOP();
77-
samples += palReadPad(HW_RFM95W_SPI_PORT_MISO, HW_RFM95W_SPI_PIN_MISO);
77+
samples += palReadPad(HW_LORA_SPI_PORT_MISO, HW_LORA_SPI_PIN_MISO);
7878
__NOP();
79-
samples += palReadPad(HW_RFM95W_SPI_PORT_MISO, HW_RFM95W_SPI_PIN_MISO);
79+
samples += palReadPad(HW_LORA_SPI_PORT_MISO, HW_LORA_SPI_PIN_MISO);
8080
__NOP();
81-
samples += palReadPad(HW_RFM95W_SPI_PORT_MISO, HW_RFM95W_SPI_PIN_MISO);
81+
samples += palReadPad(HW_LORA_SPI_PORT_MISO, HW_LORA_SPI_PIN_MISO);
8282
receive <<= 1;
8383
if (samples > 2) {
8484
receive |= 1;
8585
}
86-
palClearPad(HW_RFM95W_SPI_PORT_SCK, HW_RFM95W_SPI_PIN_SCK);
86+
palClearPad(HW_LORA_SPI_PORT_SCK, HW_LORA_SPI_PIN_SCK);
8787
spi_delay();
8888
}
8989
if (in_buf) {

lora/lora.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
*/
2323

2424
#include "conf_general.h"
25-
#ifdef HW_HAS_RFM95W
25+
#ifdef HW_HAS_LORA
2626

2727
#include "app.h"
2828
#include "ch.h"
2929
#include "hal.h"
3030
#include "hw.h"
3131
#include "packet.h"
3232
#include "commands.h"
33-
#include "rfm95w.h"
33+
#include "lora.h"
3434
#include <string.h>
3535
#include "SX1278.h"
3636
#include "stdio.h"

0 commit comments

Comments
 (0)