Use new ssp_transfer() function instead of ssp_write().
Implement max2837_spi_read().
This commit is contained in:
@ -121,10 +121,9 @@ void max2837_setup(void)
|
|||||||
/* SPI register read. */
|
/* SPI register read. */
|
||||||
uint16_t max2837_spi_read(uint8_t r) {
|
uint16_t max2837_spi_read(uint8_t r) {
|
||||||
gpio_clear(PORT_XCVR_CS, PIN_XCVR_CS);
|
gpio_clear(PORT_XCVR_CS, PIN_XCVR_CS);
|
||||||
// FIXME: Unimplemented.
|
const uint16_t value = ssp_transfer(SSP1_NUM, (uint16_t)((1 << 15) | (r << 10)));
|
||||||
r=r;
|
|
||||||
gpio_set(PORT_XCVR_CS, PIN_XCVR_CS);
|
gpio_set(PORT_XCVR_CS, PIN_XCVR_CS);
|
||||||
return 0;
|
return value & 0x3ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SPI register write */
|
/* SPI register write */
|
||||||
@ -137,7 +136,7 @@ void max2837_spi_write(uint8_t r, uint16_t v) {
|
|||||||
LOG("0x%03x -> reg%d\n", v, r);
|
LOG("0x%03x -> reg%d\n", v, r);
|
||||||
#else
|
#else
|
||||||
gpio_clear(PORT_XCVR_CS, PIN_XCVR_CS);
|
gpio_clear(PORT_XCVR_CS, PIN_XCVR_CS);
|
||||||
ssp_write(SSP1_NUM, (uint16_t)((r << 10) | (v & 0x3ff)));
|
ssp_transfer(SSP1_NUM, (uint16_t)((r << 10) | (v & 0x3ff)));
|
||||||
gpio_set(PORT_XCVR_CS, PIN_XCVR_CS);
|
gpio_set(PORT_XCVR_CS, PIN_XCVR_CS);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
void max5864_spi_write(uint_fast8_t value) {
|
void max5864_spi_write(uint_fast8_t value) {
|
||||||
gpio_clear(PORT_AD_CS, PIN_AD_CS);
|
gpio_clear(PORT_AD_CS, PIN_AD_CS);
|
||||||
ssp_write(SSP1_NUM, value);
|
ssp_transfer(SSP1_NUM, value);
|
||||||
gpio_set(PORT_AD_CS, PIN_AD_CS);
|
gpio_set(PORT_AD_CS, PIN_AD_CS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user