|
|
@@ -7,18 +7,13 @@
|
|
7
|
7
|
#include <stdlib.h>
|
|
8
|
8
|
#include <string.h>
|
|
9
|
9
|
|
|
|
10
|
+#include "spi.h"
|
|
10
|
11
|
#include "nrf24l01.h"
|
|
11
|
12
|
#include "nrf24l01_definitions.h"
|
|
12
|
13
|
#include "bme280_interface.h"
|
|
13
|
14
|
#include "bme280_defs.h"
|
|
14
|
15
|
|
|
15
|
16
|
|
|
16
|
|
-/* SPI: */
|
|
17
|
|
-/* TODO: move to spi.h */
|
|
18
|
|
-#define SPI_DDR DDRB
|
|
19
|
|
-#define SPI_SCK_PIN PB5
|
|
20
|
|
-#define SPI_MOSI_PIN PB3
|
|
21
|
|
-#define SPI_MISO_PIN PB4
|
|
22
|
17
|
|
|
23
|
18
|
/* Debug LED: */
|
|
24
|
19
|
#define LED_DDR DDRD
|
|
|
@@ -36,7 +31,6 @@ volatile uint8_t interruptCounter;
|
|
36
|
31
|
volatile uint8_t executionFlag;
|
|
37
|
32
|
|
|
38
|
33
|
|
|
39
|
|
-void Initialize_SPI(void);
|
|
40
|
34
|
void Enter_Power_Save_Mode(void);
|
|
41
|
35
|
void Exit_Power_Save_Mode(void);
|
|
42
|
36
|
|
|
|
@@ -129,15 +123,6 @@ int main (void)
|
|
129
|
123
|
}
|
|
130
|
124
|
}
|
|
131
|
125
|
|
|
132
|
|
-void Initialize_SPI(void)
|
|
133
|
|
-{
|
|
134
|
|
- /* TODO: move to spi.h */
|
|
135
|
|
- /* Set MOSI and SCK output, all others input */
|
|
136
|
|
- SPI_DDR = (1<<SPI_MOSI_PIN)|(1<<SPI_SCK_PIN);
|
|
137
|
|
- /* Enable SPI, Master, set clock rate fck/16 */
|
|
138
|
|
- SPCR = (1<<SPE)|(1<<MSTR);
|
|
139
|
|
-}
|
|
140
|
|
-
|
|
141
|
126
|
void Set_Up_Power_Save_Mode(void)
|
|
142
|
127
|
{
|
|
143
|
128
|
// Disable Brown-Out-Detection by setting the BODLEVEL 2:0 Fuses to 0b111 (should be default)
|