diff options
| author | Sadeep Madurange <sadeep@asciimx.com> | 2024-11-24 20:16:23 +0800 |
|---|---|---|
| committer | Sadeep Madurange <sadeep@asciimx.com> | 2024-11-24 20:16:23 +0800 |
| commit | a5236a7ca09d634b26fd1745cbde844b0a8198e1 (patch) | |
| tree | 2b291e46bceda3eb1a48f2a6501a5b9ffed183f0 /rf_test | |
| parent | d4ff43c1793e7025a70b2e0b4afeb53c32ad9361 (diff) | |
| download | smart-home-a5236a7ca09d634b26fd1745cbde844b0a8198e1.tar.gz | |
Enable serial.
Diffstat (limited to 'rf_test')
| -rw-r--r-- | rf_test/Recv.Makefile | 1 | ||||
| -rw-r--r-- | rf_test/Send.Makefile | 3 | ||||
| -rw-r--r-- | rf_test/send.c | 14 |
3 files changed, 13 insertions, 5 deletions
diff --git a/rf_test/Recv.Makefile b/rf_test/Recv.Makefile index b1f7a8b..26cb45a 100644 --- a/rf_test/Recv.Makefile +++ b/rf_test/Recv.Makefile @@ -9,6 +9,7 @@ CFLAGS = -std=gnu99 CFLAGS += -Os CFLAGS += -Wall CFLAGS += -mmcu=$(MCU) +CFLAGS += -DF_BAUD=115200 CFLAGS += -DF_CPU=16000000UL CFLAGS += -ffunction-sections -fdata-sections diff --git a/rf_test/Send.Makefile b/rf_test/Send.Makefile index c8c6b15..3fa9329 100644 --- a/rf_test/Send.Makefile +++ b/rf_test/Send.Makefile @@ -2,13 +2,14 @@ CC = avr-gcc MCU = atmega328p TARGET = send -SRC = rfm.c send.c +SRC = rfm.c send.c serial.c OBJ = $(SRC:.c=.o) CFLAGS = -std=gnu99 CFLAGS += -Os CFLAGS += -Wall CFLAGS += -mmcu=$(MCU) +CFLAGS += -DF_BAUD=115200 CFLAGS += -DF_CPU=16000000UL CFLAGS += -ffunction-sections -fdata-sections diff --git a/rf_test/send.c b/rf_test/send.c index dafac63..daa154f 100644 --- a/rf_test/send.c +++ b/rf_test/send.c @@ -3,8 +3,9 @@ #include <util/delay.h> #include "rfm.h" +#include "serial.h" -#define LED_PIN PB1 +#define LED_PIN PC1 #define LOCK_BTN PD6 #define UNLOCK_BTN PD7 @@ -17,7 +18,9 @@ static inline void lock(void) uint8_t data[1]; data[0] = LOCK; - rfm_sendto(ADDR, data, 1); + //rfm_sendto(ADDR, data, 1); + + serial_write_line("Locked"); PORTB |= (1 << LED_PIN); _delay_ms(500); @@ -29,7 +32,9 @@ static inline void unlock(void) uint8_t data[1]; data[0] = UNLOCK; - rfm_sendto(ADDR, data, 1); + //rfm_sendto(ADDR, data, 1); + + serial_write_line("Unlocked"); PORTB |= (1 << LED_PIN); _delay_ms(500); @@ -59,7 +64,8 @@ int main(void) DDRB |= (1 << LED_PIN); - rfm_init(); + //rfm_init(); + serial_init(); pcint2_init(); sei(); |
