fixed inconsistent naming of mixer pins

This commit is contained in:
Michael Ossmann
2012-06-14 10:44:22 -06:00
parent 0075099969
commit 68f9a1c6e4
3 changed files with 31 additions and 31 deletions

View File

@ -94,8 +94,8 @@ extern "C"
/* RFFC5071 GPIO serial interface PinMux */ /* RFFC5071 GPIO serial interface PinMux */
#define SCU_MIXER_ENX (P7_0) /* GPIO3[8] on P7_0 */ #define SCU_MIXER_ENX (P7_0) /* GPIO3[8] on P7_0 */
#define SCU_MIXER_CLK (P7_1) /* GPIO3[9] on P7_1 */ #define SCU_MIXER_SCLK (P7_1) /* GPIO3[9] on P7_1 */
#define SCU_MIXER_DATA (P7_2) /* GPIO3[10] on P7_2 */ #define SCU_MIXER_SDATA (P7_2) /* GPIO3[10] on P7_2 */
/* TODO add other Pins */ /* TODO add other Pins */
@ -120,10 +120,10 @@ extern "C"
#define PIN_CS_AD (BIT7) /* GPIO2[7] on P5_7 */ #define PIN_CS_AD (BIT7) /* GPIO2[7] on P5_7 */
#define PORT_CS_AD (GPIO2) /* PORT for CS_AD */ #define PORT_CS_AD (GPIO2) /* PORT for CS_AD */
#define PIN_MIXER_ENX (BIT8) /* GPIO3[8] on P7_0 */ #define PIN_MIXER_ENX (BIT8) /* GPIO3[8] on P7_0 */
#define PIN_MIXER_CLK (BIT9) /* GPIO3[9] on P7_1 */ #define PIN_MIXER_SCLK (BIT9) /* GPIO3[9] on P7_1 */
#define PIN_MIXER_DATA (BIT10) /* GPIO3[10] on P7_2 */ #define PIN_MIXER_SDATA (BIT10) /* GPIO3[10] on P7_2 */
#define PORT_MIXER (GPIO3) /* PORT for mixer serial interface */ #define PORT_MIXER (GPIO3) /* PORT for mixer serial interface */
/* GPIO Input */ /* GPIO Input */
#define PIN_BOOT0 (BIT8) /* GPIO0[8] on P1_1 */ #define PIN_BOOT0 (BIT8) /* GPIO0[8] on P1_1 */
@ -146,7 +146,7 @@ extern "C"
#define BOOT1_STATE ((GPIO0_PIN & PIN_BOOT1)==PIN_BOOT1) #define BOOT1_STATE ((GPIO0_PIN & PIN_BOOT1)==PIN_BOOT1)
#define BOOT2_STATE ((GPIO5_PIN & PIN_BOOT2)==PIN_BOOT2) #define BOOT2_STATE ((GPIO5_PIN & PIN_BOOT2)==PIN_BOOT2)
#define BOOT3_STATE ((GPIO1_PIN & PIN_BOOT3)==PIN_BOOT3) #define BOOT3_STATE ((GPIO1_PIN & PIN_BOOT3)==PIN_BOOT3)
#define MIXER_DATA_STATE ((GPIO3_PIN & PIN_MIXER_DATA)==PIN_MIXER_DATA) #define MIXER_SDATA_STATE ((GPIO3_PIN & PIN_MIXER_SDATA)==PIN_MIXER_SDATA)
/* TODO add other Pins */ /* TODO add other Pins */
#endif #endif

View File

@ -31,15 +31,15 @@ void rffc5071_init(void)
{ {
/* Configure GPIO pins. */ /* Configure GPIO pins. */
scu_pinmux(SCU_MIXER_ENX, SCU_GPIO_FAST); scu_pinmux(SCU_MIXER_ENX, SCU_GPIO_FAST);
scu_pinmux(SCU_MIXER_CLK, SCU_GPIO_FAST); scu_pinmux(SCU_MIXER_SCLK, SCU_GPIO_FAST);
scu_pinmux(SCU_MIXER_DATA, SCU_GPIO_FAST); scu_pinmux(SCU_MIXER_SDATA, SCU_GPIO_FAST);
/* Set GPIO pins as outputs. */ /* Set GPIO pins as outputs. */
GPIO3_DIR |= (PIN_MIXER_ENX | PIN_MIXER_CLK | PIN_MIXER_DATA); GPIO3_DIR |= (PIN_MIXER_ENX | PIN_MIXER_SCLK | PIN_MIXER_SDATA);
/* set to known state */ /* set to known state */
gpio_set(PORT_MIXER, PIN_MIXER_ENX); /* active low */ gpio_set(PORT_MIXER, PIN_MIXER_ENX); /* active low */
gpio_clear(PORT_MIXER, (PIN_MIXER_CLK | PIN_MIXER_DATA)); gpio_clear(PORT_MIXER, (PIN_MIXER_SCLK | PIN_MIXER_SDATA));
//FIXME no writes until we get reads sorted: //FIXME no writes until we get reads sorted:
return; return;
@ -103,7 +103,7 @@ void rffc5071_reg_write(uint8_t reg, uint16_t val)
/* make sure everything is starting in the correct state */ /* make sure everything is starting in the correct state */
gpio_set(PORT_MIXER, PIN_MIXER_ENX); gpio_set(PORT_MIXER, PIN_MIXER_ENX);
gpio_clear(PORT_MIXER, (PIN_MIXER_CLK | PIN_MIXER_DATA)); gpio_clear(PORT_MIXER, (PIN_MIXER_SCLK | PIN_MIXER_SDATA));
serial_delay(); serial_delay();
/* start transaction by bringing ENX low */ /* start transaction by bringing ENX low */
@ -112,16 +112,16 @@ void rffc5071_reg_write(uint8_t reg, uint16_t val)
while (bits--) { while (bits--) {
if (data & msb) if (data & msb)
gpio_set(PORT_MIXER, PIN_MIXER_DATA); gpio_set(PORT_MIXER, PIN_MIXER_SDATA);
else else
gpio_clear(PORT_MIXER, PIN_MIXER_DATA); gpio_clear(PORT_MIXER, PIN_MIXER_SDATA);
data <<= 1; data <<= 1;
serial_delay(); serial_delay();
gpio_set(PORT_MIXER, PIN_MIXER_CLK); gpio_set(PORT_MIXER, PIN_MIXER_SCLK);
serial_delay(); serial_delay();
gpio_clear(PORT_MIXER, PIN_MIXER_CLK); gpio_clear(PORT_MIXER, PIN_MIXER_SCLK);
} }
serial_delay(); serial_delay();
@ -143,7 +143,7 @@ uint16_t rffc5071_reg_read(uint8_t reg)
/* make sure everything is starting in the correct state */ /* make sure everything is starting in the correct state */
gpio_set(PORT_MIXER, PIN_MIXER_ENX); gpio_set(PORT_MIXER, PIN_MIXER_ENX);
gpio_clear(PORT_MIXER, (PIN_MIXER_CLK | PIN_MIXER_DATA)); gpio_clear(PORT_MIXER, (PIN_MIXER_SCLK | PIN_MIXER_SDATA));
serial_delay(); serial_delay();
/* start transaction by bringing ENX low */ /* start transaction by bringing ENX low */
@ -152,42 +152,42 @@ uint16_t rffc5071_reg_read(uint8_t reg)
while (bits--) { while (bits--) {
if (data & msb) if (data & msb)
gpio_set(PORT_MIXER, PIN_MIXER_DATA); gpio_set(PORT_MIXER, PIN_MIXER_SDATA);
else else
gpio_clear(PORT_MIXER, PIN_MIXER_DATA); gpio_clear(PORT_MIXER, PIN_MIXER_SDATA);
data <<= 1; data <<= 1;
serial_delay(); serial_delay();
gpio_set(PORT_MIXER, PIN_MIXER_CLK); gpio_set(PORT_MIXER, PIN_MIXER_SCLK);
serial_delay(); serial_delay();
gpio_clear(PORT_MIXER, PIN_MIXER_CLK); gpio_clear(PORT_MIXER, PIN_MIXER_SCLK);
} }
serial_delay(); serial_delay();
gpio_set(PORT_MIXER, PIN_MIXER_CLK); gpio_set(PORT_MIXER, PIN_MIXER_SCLK);
serial_delay(); serial_delay();
gpio_clear(PORT_MIXER, PIN_MIXER_CLK); gpio_clear(PORT_MIXER, PIN_MIXER_SCLK);
bits = 16; bits = 16;
data = 0; data = 0;
/* set DATA line as input */ /* set SDATA line as input */
GPIO3_DIR &= ~PIN_MIXER_DATA; GPIO3_DIR &= ~PIN_MIXER_SDATA;
while (bits--) { while (bits--) {
data <<= 1; data <<= 1;
serial_delay(); serial_delay();
gpio_set(PORT_MIXER, PIN_MIXER_CLK); gpio_set(PORT_MIXER, PIN_MIXER_SCLK);
serial_delay(); serial_delay();
gpio_clear(PORT_MIXER, PIN_MIXER_CLK); gpio_clear(PORT_MIXER, PIN_MIXER_SCLK);
if (MIXER_DATA_STATE) if (MIXER_SDATA_STATE)
data |= 1; data |= 1;
} }
/* set DATA line as output */ /* set SDATA line as output */
GPIO3_DIR |= PIN_MIXER_DATA; GPIO3_DIR |= PIN_MIXER_SDATA;
serial_delay(); serial_delay();
gpio_set(PORT_MIXER, PIN_MIXER_ENX); gpio_set(PORT_MIXER, PIN_MIXER_ENX);

View File

@ -20,7 +20,7 @@ GND: Lollipop P8 pin 1, 3, or 5 -> Jellybean P17 pin 1, 3, or 5
VCC: Lollipop P8 pin 2, 4, or 6 -> Jellybean P17 pin 2, 4, or 6 VCC: Lollipop P8 pin 2, 4, or 6 -> Jellybean P17 pin 2, 4, or 6
ENX: Lollipop P4 pin 5 -> Jellybean P5 pin 1 ENX: Lollipop P4 pin 5 -> Jellybean P5 pin 1
SCLK: Lollipop P4 pin 3 -> Jellybean P5 pin 3 SCLK: Lollipop P4 pin 3 -> Jellybean P5 pin 3
DATA: Lollipop P4 pin 1 -> Jellybean P5 pin 5 SDATA: Lollipop P4 pin 1 -> Jellybean P5 pin 5
Also RF connectors, and you're on your own to get the RF switches configured Also RF connectors, and you're on your own to get the RF switches configured
properly. properly.