On Mon, 16 Jan 2012 14:11:20 +0100
Oliver Neukum [off-list ref] wrote:
Am Montag, 16. Januar 2012, 14:02:05 schrieb Hans Verkuil:
quoted
quoted
quoted
+/* Set frequency (if non-0), PA, mute and turn on/off the FM
transmitter. */ +static int keene_cmd_main(struct keene_device *radio,
unsigned freq, bool play) +{
+ unsigned short freq_send = freq ? (freq - 76 * 16000) / 800 : 0;
+ int ret;
+
+ radio->buffer[0] = 0x00;
+ radio->buffer[1] = 0x50;
+ radio->buffer[2] = (freq_send >> 8) & 0xff;
+ radio->buffer[3] = freq_send & 0xff;
Please use the endianness macro appropriate here
I don't see any endianness issues here, but perhaps I missed something.
You are doing the endianness conversion by hand. We have a nice macro
No - it's packing bytes into a buffer from a u16. That doesn't have a
macro.
Alan