6 uint8_t mrf_read_short_addr(uint8_t addr
);
7 uint8_t mrf_read_long_addr(uint16_t addr
);
8 void mrf_write_short_addr(uint8_t addr
, uint8_t val
);
9 void mrf_write_long_addr(uint16_t addr
, uint8_t val
);
12 // wrapper function, with constant addr parameter and optimization compiles into
13 // direct call to appropriate function
14 __attribute__ ((always_inline
)) static void
15 mrf_set_reg(uint16_t addr
, uint8_t val
)
18 mrf_write_short_addr(addr
, val
);
20 mrf_write_long_addr(addr
, val
);
23 // wrapper function, with constant addr parameter and optimization compiles into
24 // direct call to appropriate function
25 __attribute__ ((always_inline
)) static uint8_t
26 mrf_get_reg(uint16_t addr
)
29 return mrf_read_short_addr(addr
);
31 return mrf_read_long_addr(addr
);
34 // tx power, val must be: 0x0 - 0x1F, val = 0x0 is max power
35 static inline void mrf_set_small_scale_tx_power(uint8_t val
)
37 mrf_set_reg(MRF_R_RFCTRL3
, val
<<3);
40 // set channel, ch must be: 0x0 - 0xF
41 static inline void mrf_set_channel(uint8_t ch
)
43 mrf_set_reg(MRF_R_RFCTRL0
, ch
<<4);
47 static inline uint8_t mrf_get_txretry()
49 return mrf_get_reg(MRF_R_TXSR
) >> 6;