diff options
author | Keith Packard <keithp@keithp.com> | 2012-07-14 02:44:17 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-07-14 02:44:17 -0700 |
commit | 0cfd22baa6af44e053428c30c1a95cf5551b68af (patch) | |
tree | a347ac877f882bb6eaef11f0a88d46fe89915514 /src/cc1111/ao_arch_funcs.h | |
parent | 37032e4b0cbac4c823e3dd18e60ad8900e9ceff1 (diff) |
src: Add explicit 'pin' argument to ao_enable_output
This lets the cc1111 use the atomic bit operation instead of a mask,
which is immune to interrupt issues as well as being a shorter code sequence.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/cc1111/ao_arch_funcs.h')
-rw-r--r-- | src/cc1111/ao_arch_funcs.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cc1111/ao_arch_funcs.h b/src/cc1111/ao_arch_funcs.h index 0a322961..0737e7ab 100644 --- a/src/cc1111/ao_arch_funcs.h +++ b/src/cc1111/ao_arch_funcs.h @@ -77,14 +77,14 @@ ao_spi_init(void); SPI_CS_SEL &= ~mask; \ } while (0) -#define cc1111_enable_output(port,dir,sel,mask,v) do { \ - port = port & ~(mask) | v; \ - dir |= mask; \ - sel &= ~mask; \ -} while (0) +#define cc1111_enable_output(port,dir,sel,pin,bit,v) do { \ + pin = v; \ + dir |= (1 << bit); \ + sel &= ~(1 << bit); \ + } while (0) #define disable_unreachable _Pragma("disable_warning 126") #define token_paster(x,y) x ## y #define token_evaluator(x,y) token_paster(x,y) -#define ao_enable_output(port,pin,v) cc1111_enable_output(port,token_evaluator(port,DIR), token_evaluator(port,SEL), 1 << pin, 1 << v) +#define ao_enable_output(port,bit,pin,v) cc1111_enable_output(port,token_evaluator(port,DIR), token_evaluator(port,SEL), pin, bit, v) |