OneWay  3.0-3-ge9d4fa4
Functions
receive.c File Reference

the receiver code. More...

#include <stdlib.h>
#include <string.h>
#include <avr/io.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#include "receive.h"
Include dependency graph for receive.c:

Functions

void start_rx (void)
 enable the RX module and related serial port. More...
 
void stop_rx (void)
 shutdown the receiver. More...
 
char get_char_echo (void)
 get a char from the RX and echo it on the console. More...
 
void set_cmd (const uint8_t pin, const uint8_t cmd, struct debug_t *debug)
 execute command on a pin. More...
 
void set_pin (struct htv_t *htv, struct debug_t *debug)
 enable the IO and led based on the received command. More...
 
void look_for_cmd (struct htv_t *htv, struct debug_t *debug)
 receive the AAAAPPC:RR string More...
 
void slave (struct debug_t *debug)
 the main RX program
 

Detailed Description

the receiver code.

Function Documentation

◆ get_char_echo()

char get_char_echo ( void  )

get a char from the RX and echo it on the console.

Returns
the received char.
Note
only char from ascii 32 to 128 are printed back.

◆ look_for_cmd()

void look_for_cmd ( struct htv_t htv,
struct debug_t debug 
)

receive the AAAAPPC:RR string

Bug:
in case of error 4 the struct htv is mostly void, and printing it's content will be a memory leak crash.

◆ set_cmd()

void set_cmd ( const uint8_t  pin,
const uint8_t  cmd,
struct debug_t debug 
)

execute command on a pin.

Parameters
pinwhich pin to enable or disable.
cmd1 - enable, 0 - disable
debugthe debug_t struct.

◆ set_pin()

void set_pin ( struct htv_t htv,
struct debug_t debug 
)

enable the IO and led based on the received command.

Note
the address check is done by comparing the received address with the ee_address stored in htv_t.

◆ start_rx()

void start_rx ( void  )

enable the RX module and related serial port.

Note
if RTX moduled is used, then a more complicated init sequence must be used.

◆ stop_rx()

void stop_rx ( void  )

shutdown the receiver.

Todo:
implement the pin sequence for rtx module.