aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ossmann2012-06-04 16:41:12 -0600
committerMichael Ossmann2012-06-04 16:41:12 -0600
commit44db38301c2a6f7eefa8b7acc68eb0a5e46ec4d5 (patch)
tree66db3be343ea0f2b1b613bb9baa3f869e6487da8
parent21304c01b6ea776613cedc2976288153c5a9a152 (diff)
fixed i2cdemo to supply 1V8 for Si5351C output supply
-rw-r--r--examples/lpc43xx/hackrf-jellybean/i2c/README1
-rw-r--r--examples/lpc43xx/hackrf-jellybean/i2c/i2cdemo.c33
2 files changed, 33 insertions, 1 deletions
diff --git a/examples/lpc43xx/hackrf-jellybean/i2c/README b/examples/lpc43xx/hackrf-jellybean/i2c/README
index 14745f6..86763fe 100644
--- a/examples/lpc43xx/hackrf-jellybean/i2c/README
+++ b/examples/lpc43xx/hackrf-jellybean/i2c/README
@@ -11,4 +11,5 @@ Required Lemondrop -> Jellybean connections:
SCL: Lemondrop P7 pin 3 -> Jellybean P6 pin 3
SDA: Lemondrop P7 pin 5 -> Jellybean P6 pin 5
VCC: Lemondrop P4 pin 2, 4, or 6 -> Jellybean P17 pin 2, 4, or 6
+1V8: Lemondrop P11 pin 2, 4, or 6 -> Jellybean P16 pin 2, 4, or 6
GND: Lemondrop P5 -> Jellybean P13
diff --git a/examples/lpc43xx/hackrf-jellybean/i2c/i2cdemo.c b/examples/lpc43xx/hackrf-jellybean/i2c/i2cdemo.c
index 88bbec4..7198bb3 100644
--- a/examples/lpc43xx/hackrf-jellybean/i2c/i2cdemo.c
+++ b/examples/lpc43xx/hackrf-jellybean/i2c/i2cdemo.c
@@ -23,9 +23,38 @@
#include <libopencm3/lpc43xx/cgu.h>
#include <libopencm3/lpc43xx/i2c.h>
+#include "../jellybean_conf.h"
+
void gpio_setup(void)
{
- GPIO2_DIR |= (1 << 1); /* Configure GPIO2[1] (P4_1) as output. */
+ /* Configure SCU Pin Mux as GPIO */
+ scu_pinmux(SCU_PINMUX_LED1, SCU_GPIO_FAST);
+ scu_pinmux(SCU_PINMUX_LED2, SCU_GPIO_FAST);
+ scu_pinmux(SCU_PINMUX_LED3, SCU_GPIO_FAST);
+
+ scu_pinmux(SCU_PINMUX_EN1V8, SCU_GPIO_FAST);
+
+ scu_pinmux(SCU_PINMUX_BOOT0, SCU_GPIO_FAST);
+ scu_pinmux(SCU_PINMUX_BOOT1, SCU_GPIO_FAST);
+ scu_pinmux(SCU_PINMUX_BOOT2, SCU_GPIO_FAST);
+ scu_pinmux(SCU_PINMUX_BOOT3, SCU_GPIO_FAST);
+
+ /* Configure SCU I2C0 Peripheral */
+ SCU_SFSI2C0 = SCU_I2C0_NOMINAL;
+
+ /* Configure all GPIO as Input (safe state) */
+ GPIO0_DIR = 0;
+ GPIO1_DIR = 0;
+ GPIO2_DIR = 0;
+ GPIO3_DIR = 0;
+ GPIO4_DIR = 0;
+ GPIO5_DIR = 0;
+ GPIO6_DIR = 0;
+ GPIO7_DIR = 0;
+
+ /* Configure GPIO as Output */
+ GPIO2_DIR |= (PIN_LED1|PIN_LED2|PIN_LED3); /* Configure GPIO2[1/2/8] (P4_1/2 P6_12) as output. */
+ GPIO3_DIR |= PIN_EN1V8; /* GPIO3[6] on P6_10 as output. */
}
//FIXME generalize and move to drivers
@@ -174,6 +203,8 @@ int main(void)
gpio_setup();
i2c0_init();
+ gpio_set(PORT_EN1V8, PIN_EN1V8); /* 1V8 on */
+
while (1) {
if (si5351c_read_reg(0) == 0x10)
gpio_set(GPIO2, GPIOPIN1); /* LED on */