Move MAC adress to common include header

This commit is contained in:
Rihards Skuja 2018-01-21 19:08:35 +02:00
parent d0e9806d2b
commit 88751a91d5
No known key found for this signature in database
GPG Key ID: 53FA13A3F7F8571B
7 changed files with 14 additions and 12 deletions

View File

@ -31,7 +31,7 @@ CDEFS = -DF_CPU=16000000L -D__AVR__ -D__AVR_ATmega328P__
# Place -I options here # Place -I options here
CINCS = -I /usr/avr/include -I /usr/lib/gcc/avr/7.2.0/include \ CINCS = -I /usr/avr/include -I /usr/lib/gcc/avr/7.2.0/include \
-I $(INC_DIR) -I $(COMMON_INC_DIR) -I $(COMMON_INC_DIR) -I $(INC_DIR)
CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst) #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)

View File

@ -4,9 +4,6 @@
#include <stdint.h> #include <stdint.h>
#include "common.h" #include "common.h"
uint8_t tx_address[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7};
uint8_t rx_address[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
void convert_raw_to_data(uint8_t *in, data_packet_t *out); void convert_raw_to_data(uint8_t *in, data_packet_t *out);
#endif #endif

View File

@ -26,8 +26,8 @@ int main(void)
nrf24_init(); nrf24_init();
nrf24_config(2, sizeof(data_packet_t)); // Channel #2 nrf24_config(2, sizeof(data_packet_t)); // Channel #2
nrf24_rx_address(rx_address); nrf24_tx_address(node_mac);
nrf24_rx_address(rx_address); nrf24_rx_address(base_mac);
// Use green LED as power LED // Use green LED as power LED
// TODO: need all LEDs for debugging, will use as power when UART debugger // TODO: need all LEDs for debugging, will use as power when UART debugger
@ -49,6 +49,9 @@ int main(void)
SET(LED_PORT, LED_GREEN_BIT); SET(LED_PORT, LED_GREEN_BIT);
else else
CLR(LED_PORT, LED_GREEN_BIT); CLR(LED_PORT, LED_GREEN_BIT);
} else {
CLR(LED_PORT, LED_GREEN_BIT);
CLR(LED_PORT, LED_BLUE_BIT);
} }
} }

View File

@ -23,4 +23,9 @@ typedef struct {
uint16_t distance; uint16_t distance;
} data_packet_t; } data_packet_t;
// Base station radio MAC address
static uint8_t base_mac[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
// Mobile node radio MAC address
static uint8_t node_mac[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7};
#endif /* COMMON_H */ #endif /* COMMON_H */

View File

@ -31,7 +31,7 @@ CDEFS = -DF_CPU=16000000L -D__AVR__ -D__AVR_ATmega328P__
# Place -I options here # Place -I options here
CINCS = -I /usr/avr/include -I /usr/lib/gcc/avr/7.2.0/include \ CINCS = -I /usr/avr/include -I /usr/lib/gcc/avr/7.2.0/include \
-I $(INC_DIR) -I $(COMMON_INC_DIR) -I $(COMMON_INC_DIR) -I $(INC_DIR)
CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums
#CEXTRA = -Wa,-adhlns=$(<:.c=.lst) #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)

View File

@ -4,9 +4,6 @@
#include <stdint.h> #include <stdint.h>
#include "common.h" #include "common.h"
uint8_t tx_address[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
uint8_t rx_address[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7};
void convert_data_to_raw(data_packet_t *in, uint8_t *out); void convert_data_to_raw(data_packet_t *in, uint8_t *out);
#endif #endif

View File

@ -31,8 +31,8 @@ int main(void)
nrf24_init(); nrf24_init();
nrf24_config(2, sizeof(data_packet_t)); // Channel #2 nrf24_config(2, sizeof(data_packet_t)); // Channel #2
nrf24_tx_address(tx_address); nrf24_tx_address(base_mac);
nrf24_rx_address(rx_address); nrf24_rx_address(node_mac);
// Use green LED as power LED // Use green LED as power LED
// TODO: need all LEDs for debugging, will use as power when UART debugger // TODO: need all LEDs for debugging, will use as power when UART debugger