#ifndef MYRADIO_PHY_TRANSMITTER_H_ #define MYRADIO_PHY_TRANSMITTER_H_ /* Lowlevel transmitter definitions. * These functions do poke with the actual TX hardware. */ #include /* Our transmitter is a trivial radio transmitter module that * will amplitude- (or frequency-) modulate any bit that is set * immediately to the wireless medium. * We have two output pins on the digital PHY, which are connected * via a trivial R2R network to the Analog part of the PHY. * One of the digital pins is the transmitter-power pin and one is * the data bit signal. * So the way the radio sees the data on its pin is: * 0V = transmitter powered off * about 4V = Logical zero * 5V = Logical one * These voltage levels are generated by the analog (R2R network) from * the two digital transmitter pins. * * An example for a possible radio hardware is this: * http://www.conrad.de/goto.php?artikel=130428 */ #define TRANSMITTER_PORT PORTC #define TRANSMITTER_DDR DDRC #define TRANSMITTER_POWERON 1 /* Power-ON bit */ #define TRANSMITTER_DATABIT 2 /* Data bit */ static inline void transmitter_data_bit_set(bool high) { if (high) TRANSMITTER_PORT |= (1 << TRANSMITTER_DATABIT); else TRANSMITTER_PORT &= ~(1 << TRANSMITTER_DATABIT); } static inline void transmitter_enable(void) { transmitter_data_bit_set(0); TRANSMITTER_PORT |= (1 << TRANSMITTER_POWERON); } static inline void transmitter_disable(void) { transmitter_data_bit_set(0); TRANSMITTER_PORT &= ~(1 << TRANSMITTER_POWERON); } static inline void transmitter_initialize(void) { transmitter_data_bit_set(0); TRANSMITTER_PORT &= ~(1 << TRANSMITTER_POWERON); TRANSMITTER_DDR |= (1 << TRANSMITTER_POWERON) | (1 << TRANSMITTER_DATABIT); } #endif /* MYRADIO_PHY_TRANSMITTER_H_ */