Fix overflows in shifts, suppress warnings for temporarily unused variables.

This commit is contained in:
Will Code
2012-09-04 20:08:30 -04:00
parent d1684a86c2
commit d7a7825f85
3 changed files with 9 additions and 5 deletions

View File

@ -119,6 +119,7 @@ void max2837_setup(void)
uint16_t max2837_spi_read(uint8_t r) {
gpio_clear(PORT_XCVR_CS, PIN_XCVR_CS);
// FIXME: Unimplemented.
r=r;
gpio_set(PORT_XCVR_CS, PIN_XCVR_CS);
return 0;
}

View File

@ -269,7 +269,7 @@ void rffc5071_spi_write(uint8_t r, uint16_t v) {
int bits = 25;
int msb = 1 << (bits -1);
uint32_t data = ((reg & 0x7f) << 16) | val;
uint32_t data = ((r & 0x7f) << 16) | v;
/* make sure everything is starting in the correct state */
gpio_set(PORT_MIXER, PIN_MIXER_ENX);
@ -458,6 +458,9 @@ uint16_t rffc5071_config_synth_int(uint16_t lo) {
uint16_t rffc5071_set_frequency(uint16_t mhz, uint32_t hz) {
uint16_t tune_freq;
// Fractional tuning unimplemented, 'hz' ignored
hz=hz;
rffc5071_disable();
tune_freq = rffc5071_config_synth_int(mhz);
rffc5071_enable();

View File

@ -39,12 +39,12 @@
* l=length (bits) */
#define __MREG__(n,r,o,l) \
static inline uint16_t get_##n(void) { \
return (rffc5071_regs[r] >> o) & ((1<<l)-1); \
return (rffc5071_regs[r] >> o) & ((1L<<l)-1); \
} \
static inline void set_##n(uint16_t v) { \
rffc5071_regs[r] &= ~(((1<<l)-1)<<o); \
rffc5071_regs[r] |= ((v&((1<<l)-1))<<o); \
RFFC5071_REG_SET_DIRTY(r); \
rffc5071_regs[r] &= (uint16_t)(~(((1L<<l)-1)<<o)); \
rffc5071_regs[r] |= (uint16_t)(((v&((1L<<l)-1))<<o)); \
RFFC5071_REG_SET_DIRTY(r); \
}
/* REG 00 (0): LF */