[solved] RF12.h: Why is there not definition of 315MHz

Hello,

in the file RF12.h (RF12 library) ,there is no definition of 315MHz , but the RFM12 module supports this frequency according to its datasheet-.

The lines around (l.28-30) are:

#define RF12_433MHZ     1
#define RF12_868MHZ     2
#define RF12_915MHZ     3

I want to initialize my module with 315MHz but HOW ?

Thank you

Can you just add it yourself?

#define RF12_315MHZ     1
#define RF12_433MHZ     2
#define RF12_868MHZ     3
#define RF12_915MHZ     4

That would be useless, I think.
These definitions are used in the library to help the user. So, Ican simply write "RF12_433MHZ" instead of the "1". That is more logic for the user but the program translates it into "1" that is understood by the RFM12 module.

But I want the module to understand 315MHz!

Problem solved.
It is #define RF12_315MHZ    0.

Nice going.
How'd you figure that out?

Hello.

I have read the datasheet and looked into the corresponding position in the sourcecode of "RF12.cpp".
Additionally, and the really helpful source!!!, I received great help from a electronic engineer.

More detailed:
Look the definition of "uint8_t rf12_initialize (uint8_t id, uint8_t band, uint8_t g)" in RF12.cpp, this function is used to initialize teh RFM12(B) module.
Then, I want to know what paramter has to be changed, of course it was "band" (uint8_t), it was only used once in the function rf12_initialize. That means that this position is the corresponding one to be examined:

rf12_xfer(0x80C7 | (band << 4));

(RF12.cpp, l.404)
Look here:
"|" is the logical AND operator, << is a bitshift operator (shifts 4 to the left, that means a hexadecimal unit (2^4=16))
Now consider binary:
1000 0000 1100 0111
Now I need the datasheet ( hoperf : RFM12.pdf ) , see the bottom left table on page 12.
Back to the binary code:
I said << is the bitshift operator, lets apply it on the code, e.g. we use "2" as given in the definition (#define RF12_868MHZ 2) for 868MHz band. Then it is
0000 0010 << 4 ("shift" the 10 ,which is 2 in binary, 4 bits left) = 0010 0000 .
Now do the addition:
0000 0000 0010 0000 + 1000 0000 1100 0111 = 1000 0000 1110 0111
The important binary parts were highlighted.
In the datasheet's table there is written:
315MHz band: b0=0; b1=0. That means we need a zero for both b0 and b1.
That is 1000 0000 1100 0111 .

And it is a lot of fun!

Feel free to ask if there are any questions (maybe explanation was unclear because quickly written).

Regards.