altos: Mark local functions 'static'
[fw/altos] / src / drivers / ao_rn4678.c
index ba25e70dda34e27214f937a150b594ca83f6beb0..4d13decc46ec271bb9fff384ad937c6db8b79bd6 100644 (file)
@@ -100,6 +100,7 @@ static const char *status_strings[] = {
        "RFCOMM_CLOSE",
        "RFCOMM_OPEN",
        "CONNECT",
+       "LCONNECT",
        "DISCONN",
        "BONDED",
 };
@@ -115,7 +116,7 @@ static AO_TICK_TYPE ao_rn_buf_time;
  * disabled due to a firmware bug. So, this code finds those in the
  * input and strips them out.
  */
-int
+static int
 _ao_wrap_rn_pollchar(void)
 {
        int             c = AO_READ_AGAIN;
@@ -334,7 +335,7 @@ ao_rn_get_name(char *name, int len)
 static void
 ao_rn_check_link(void)
 {
-       ao_rn_connected = 1 - ao_gpio_get(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN, foo);
+       ao_rn_connected = 1 - ao_gpio_get(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN);
 }
 
 static void
@@ -367,7 +368,7 @@ static uint8_t      ao_rn_stdio;
 /*
  * Set the stdio echo for the bluetooth link
  */
-void
+static void
 ao_rn_echo(uint8_t echo)
 {
        ao_stdios[ao_rn_stdio].echo = echo;
@@ -383,17 +384,17 @@ ao_rn(void)
        ao_rn_dbg("ao_rn top\n");
 
        /* Select CMD mode after the device gets out of reset */
-       ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, foo, AO_RN_CMD_CMD);
+       ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, AO_RN_CMD_CMD);
 
        for (i = 0; i < 3; i++) {
                ao_rn_dbg("reset device\n");
 
-               ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 0);
+               ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 0);
                ao_delay(AO_MS_TO_TICKS(100));
 
                /* Reboot the RN4678 and wait for it to start talking */
                ao_rn_drain();
-               ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 1);
+               ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 1);
                status = ao_rn_wait_for(AO_RN_REBOOT_TIMEOUT, AO_RN_REBOOT_MSG);
                if (status != AO_RN_OK) {
                        ao_rn_dbg("reboot failed\n");
@@ -467,7 +468,7 @@ ao_rn(void)
        if (status != AO_RN_OK)
                ao_bt_panic(4);
 
-       ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, foo, AO_RN_CMD_DATA);
+       ao_gpio_set(AO_RN_CMD_PORT, AO_RN_CMD_PIN, AO_RN_CMD_DATA);
 
        /* Wait for the hardware to finish sending messages, then clear the queue */
        ao_delay(AO_MS_TO_TICKS(200));
@@ -529,16 +530,16 @@ ao_rn_factory(void)
         */
 
        /* Select our target output pin */
-       ao_enable_output(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, foo, v);
+       ao_enable_output(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v);
 
        /* Turn off the BT device using the SW_BTN pin */
        printf("Power down BT\n"); flush();
-       ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, foo, 0);
+       ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, 0);
        ao_delay(AO_MS_TO_TICKS(1000));
 
        /* And turn it back on */
        printf("Power up BT\n"); flush();
-       ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, foo, 1);
+       ao_gpio_set(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, 1);
 
        /* Right after power on, poke P3_1 five times to force a
         * factory reset
@@ -546,7 +547,7 @@ ao_rn_factory(void)
        for (i = 0; i < 20; i++) {
                v = 1-v;
                ao_delay(AO_MS_TO_TICKS(50));
-               ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, foo, v);
+               ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v);
                ao_led_toggle(AO_BT_LED);
        }
 
@@ -555,13 +556,27 @@ ao_rn_factory(void)
 
        printf("Reboot BT\n"); flush();
        ao_delay(AO_MS_TO_TICKS(100));
-       ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 0);
+       ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 0);
        ao_delay(AO_MS_TO_TICKS(100));
-       ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 1);
+       ao_gpio_set(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 1);
 }
 
+#if AO_RN_DEBUG
+static void
+ao_rn_send(void)
+{
+       int     c;
+
+       while ((c = getchar()) != '~')
+               ao_rn_putchar(c);
+}
+#endif
+
 static const struct ao_cmds rn_cmds[] = {
        { ao_rn_factory, "F\0Factory reset rn4678" },
+#if AO_RN_DEBUG
+       { ao_rn_send, "B\0Send data to rn4678. End with ~" },
+#endif
        { 0 },
 };
 
@@ -573,13 +588,13 @@ ao_rn4678_init(void)
        ao_serial_rn_set_speed(AO_SERIAL_SPEED_115200);
 
        /* Reset line */
-       ao_enable_output(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, foo, 0);
+       ao_enable_output(AO_RN_RST_N_PORT, AO_RN_RST_N_PIN, 0);
 
        /* SW_BTN */
-       ao_enable_output(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, foo, 1);
+       ao_enable_output(AO_RN_SW_BTN_PORT, AO_RN_SW_BTN_PIN, 1);
 
        /* P3_7 command/data selector */
-       ao_enable_output(AO_RN_CMD_PORT, AO_RN_CMD_PIN, foo, AO_RN_CMD_CMD);
+       ao_enable_output(AO_RN_CMD_PORT, AO_RN_CMD_PIN, AO_RN_CMD_CMD);
 
        ao_enable_input(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN, AO_EXTI_MODE_PULL_NONE);
        ao_exti_setup(AO_RN_CONNECTED_PORT, AO_RN_CONNECTED_PIN,