From: Fabrice Desclaux Date: Sun, 26 Feb 2012 21:52:40 +0000 (+0100) Subject: rc_servos: revert use of registers for global variables X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=90919fb720235d8f3551cbc31b81e70078498f20;p=protos%2Frc_servos.git rc_servos: revert use of registers for global variables --- diff --git a/main.c b/main.c index df8fb93..d390554 100644 --- a/main.c +++ b/main.c @@ -21,10 +21,11 @@ static struct servo servo_table[] = { }; #define NB_SERVO (sizeof(servo_table)/sizeof(*servo_table)) -register uint8_t bypass asm("r2"); -register uint8_t done asm("r3"); -register uint8_t portval asm("r4"); -register uint8_t rxidx asm("r5"); +static volatile uint8_t bypass; +static volatile uint8_t done; +static volatile uint8_t portval; +static volatile uint8_t rxidx; + #define BYPASS_ENABLE 14 #define BYPASS_DISABLE 15 @@ -39,22 +40,22 @@ register uint8_t rxidx asm("r5"); * Command 14 is to enable bypass mode. * Command 15 is to disable bypass mode. */ -register union { +static volatile union { uint8_t u8; struct { uint8_t zero:1; uint8_t cmd_num:4; uint8_t val_msb:3; }; -} byte0 asm("r6"); +} byte0; -register union { +static volatile union { uint8_t u8; struct { uint8_t one:1; uint8_t val_lsb:7; }; -} byte1 asm("r7"); +} byte1; SIGNAL(TIMER1_COMPA_vect) {