projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos/driver: Document setting for AO_ST7565_BIAS
[fw/altos]
/
src
/
drivers
/
ao_rn4678.c
diff --git
a/src/drivers/ao_rn4678.c
b/src/drivers/ao_rn4678.c
index 4ace4b78595c1a4a00743675fbe459cf670b6aa9..3c07e7216cc34b3c084bffeee28ce12eed5aa44d 100644
(file)
--- a/
src/drivers/ao_rn4678.c
+++ b/
src/drivers/ao_rn4678.c
@@
-108,7
+108,7
@@
static const char *status_strings[] = {
#define NUM_STATUS_STRING (sizeof status_strings/sizeof status_strings[0])
static char ao_rn_buffer[64];
#define NUM_STATUS_STRING (sizeof status_strings/sizeof status_strings[0])
static char ao_rn_buffer[64];
-static
int
ao_rn_buf_cnt, ao_rn_buf_ptr;
+static
size_t
ao_rn_buf_cnt, ao_rn_buf_ptr;
static int ao_rn_draining;
static AO_TICK_TYPE ao_rn_buf_time;
static int ao_rn_draining;
static AO_TICK_TYPE ao_rn_buf_time;
@@
-116,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.
*/
* 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;
_ao_wrap_rn_pollchar(void)
{
int c = AO_READ_AGAIN;
@@
-146,9
+146,9
@@
_ao_wrap_rn_pollchar(void)
/* If we filled the buffer, just give up */
ao_rn_draining = 1;
} else {
/* If we filled the buffer, just give up */
ao_rn_draining = 1;
} else {
- ao_rn_buffer[ao_rn_buf_cnt++] = c;
+ ao_rn_buffer[ao_rn_buf_cnt++] =
(char)
c;
for (i = 0; i < NUM_STATUS_STRING; i++) {
for (i = 0; i < NUM_STATUS_STRING; i++) {
-
in
t cmp = strlen(status_strings[i]);
+
size_
t cmp = strlen(status_strings[i]);
if (cmp >= ao_rn_buf_cnt)
cmp = ao_rn_buf_cnt-1;
if (memcmp(ao_rn_buffer+1, status_strings[i], cmp) == 0)
if (cmp >= ao_rn_buf_cnt)
cmp = ao_rn_buf_cnt-1;
if (memcmp(ao_rn_buffer+1, status_strings[i], cmp) == 0)
@@
-158,7
+158,7
@@
_ao_wrap_rn_pollchar(void)
ao_rn_draining = 1;
}
} else if (c == STATUS_CHAR) {
ao_rn_draining = 1;
}
} else if (c == STATUS_CHAR) {
- ao_rn_buffer[0] = c;
+ ao_rn_buffer[0] =
(char)
c;
ao_rn_buf_cnt = 1;
ao_rn_buf_ptr = 0;
ao_rn_buf_time = ao_time();
ao_rn_buf_cnt = 1;
ao_rn_buf_ptr = 0;
ao_rn_buf_time = ao_time();
@@
-227,17
+227,17
@@
ao_rn_wait_char(AO_TICK_TYPE giveup_time)
ao_arch_release_interrupts();
return AO_READ_AGAIN;
}
ao_arch_release_interrupts();
return AO_READ_AGAIN;
}
- _ao_serial_rn_sleep_for(delay);
+ _ao_serial_rn_sleep_for(
(AO_TICK_TYPE)
delay);
}
ao_arch_release_interrupts();
return c;
}
static int
}
ao_arch_release_interrupts();
return c;
}
static int
-ao_rn_wait_for(
int
timeout, char *match)
+ao_rn_wait_for(
AO_TICK_TYPE
timeout, char *match)
{
char reply[AO_RN_MAX_REPLY_LEN + 1];
{
char reply[AO_RN_MAX_REPLY_LEN + 1];
-
int
match_len = strlen(match);
+
size_t
match_len = strlen(match);
AO_TICK_TYPE giveup_time = ao_time() + timeout;
int c;
AO_TICK_TYPE giveup_time = ao_time() + timeout;
int c;
@@
-318,7
+318,7
@@
ao_rn_set_name(void)
*--s = '\0';
n = ao_serial_number;
do {
*--s = '\0';
n = ao_serial_number;
do {
- *--s =
'0' + n % 10
;
+ *--s =
(uint8_t) ('0' + n % 10)
;
} while (n /= 10);
ao_rn_send_cmd(AO_RN_SET_NAME_CMD "TeleBT-", s);
return ao_rn_wait_status();
} while (n /= 10);
ao_rn_send_cmd(AO_RN_SET_NAME_CMD "TeleBT-", s);
return ao_rn_wait_status();
@@
-350,11
+350,10
@@
ao_bt_panic(int where)
{
int i;
for (;;) {
{
int i;
for (;;) {
- for (i = 0; i <
50
; i++) {
- ao_led_
toggle(AO_BT_LED
);
+ for (i = 0; i <
25
; i++) {
+ ao_led_
for(AO_BT_LED, AO_MS_TO_TICKS(10)
);
ao_delay(AO_MS_TO_TICKS(10));
}
ao_delay(AO_MS_TO_TICKS(10));
}
- ao_led_off(AO_BT_LED);
ao_delay(AO_MS_TO_TICKS(500));
for (i = 0; i < where; i++) {
ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(200));
ao_delay(AO_MS_TO_TICKS(500));
for (i = 0; i < where; i++) {
ao_led_for(AO_BT_LED, AO_MS_TO_TICKS(200));
@@
-368,7
+367,7
@@
static uint8_t ao_rn_stdio;
/*
* Set the stdio echo for the bluetooth link
*/
/*
* Set the stdio echo for the bluetooth link
*/
-void
+
static
void
ao_rn_echo(uint8_t echo)
{
ao_stdios[ao_rn_stdio].echo = echo;
ao_rn_echo(uint8_t echo)
{
ao_stdios[ao_rn_stdio].echo = echo;
@@
-522,7
+521,7
@@
static void
ao_rn_factory(void)
{
int i;
ao_rn_factory(void)
{
int i;
-
int
v = 0;
+
uint8_t
v = 0;
/*
* Factory reset. Flip pin P3_1 5 times within the first five
/*
* Factory reset. Flip pin P3_1 5 times within the first five
@@
-548,7
+547,10
@@
ao_rn_factory(void)
v = 1-v;
ao_delay(AO_MS_TO_TICKS(50));
ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v);
v = 1-v;
ao_delay(AO_MS_TO_TICKS(50));
ao_gpio_set(AO_RN_P3_1_PORT, AO_RN_P3_1_PIN, v);
- ao_led_toggle(AO_BT_LED);
+ if (v)
+ ao_led_on(AO_BT_LED);
+ else
+ ao_led_off(AO_BT_LED);
}
/* And let P3_1 float again */
}
/* And let P3_1 float again */