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/core | |
| 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/core')
| -rw-r--r-- | src/core/ao_ignite.c | 4 | ||||
| -rw-r--r-- | src/core/ao_pyro.c | 41 | 
2 files changed, 23 insertions, 22 deletions
| diff --git a/src/core/ao_ignite.c b/src/core/ao_ignite.c index e82de355..c7829fc3 100644 --- a/src/core/ao_ignite.c +++ b/src/core/ao_ignite.c @@ -195,8 +195,8 @@ __xdata struct ao_task ao_igniter_task;  void  ao_ignite_set_pins(void)  { -	ao_enable_output(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, 0); -	ao_enable_output(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, 0); +	ao_enable_output(AO_IGNITER_DROGUE_PORT, AO_IGNITER_DROGUE_PIN, AO_IGNITER_DROGUE, 0); +	ao_enable_output(AO_IGNITER_MAIN_PORT, AO_IGNITER_MAIN_PIN, AO_IGNITER_MAIN, 0);  }  void diff --git a/src/core/ao_pyro.c b/src/core/ao_pyro.c index c060a866..943413e6 100644 --- a/src/core/ao_pyro.c +++ b/src/core/ao_pyro.c @@ -102,16 +102,18 @@ ao_pyro_ready(struct ao_pyro *pyro)  			/* handled separately */  			continue; +		case ao_pyro_none: +			break;  		}  		return FALSE;  	}  	return TRUE;  } -#define ao_pyro_fire_port(port, pin) do {		\ -		ao_gpio_set(port, pin, 1);	\ +#define ao_pyro_fire_port(port, bit, pin) do {	\ +		ao_gpio_set(port, bit, pin, 1);	\  		ao_delay(AO_MS_TO_TICKS(50));	\ -		ao_gpio_set(port, pin, 0);	\ +		ao_gpio_set(port, bit, pin, 0);	\  	} while (0) @@ -120,28 +122,28 @@ ao_pyro_fire(uint8_t p)  {  	switch (p) {  #if AO_PYRO_NUM > 0 -	case 0: ao_pyro_fire_port(AO_PYRO_PORT_0, AO_PYRO_PIN_0); break; +	case 0: ao_pyro_fire_port(AO_PYRO_PORT_0, AO_PYRO_PIN_0, AO_PYRO_0); break;  #endif  #if AO_PYRO_NUM > 1 -	case 1: ao_pyro_fire_port(AO_PYRO_PORT_1, AO_PYRO_PIN_1); break; +	case 1: ao_pyro_fire_port(AO_PYRO_PORT_1, AO_PYRO_PIN_1, AO_PYRO_1); break;  #endif  #if AO_PYRO_NUM > 2 -	case 2: ao_pyro_fire_port(AO_PYRO_PORT_2, AO_PYRO_PIN_2); break; +	case 2: ao_pyro_fire_port(AO_PYRO_PORT_2, AO_PYRO_PIN_2, AO_PYRO_2); break;  #endif  #if AO_PYRO_NUM > 3 -	case 3: ao_pyro_fire_port(AO_PYRO_PORT_3, AO_PYRO_PIN_3); break; +	case 3: ao_pyro_fire_port(AO_PYRO_PORT_3, AO_PYRO_PIN_3, AO_PYRO_3); break;  #endif  #if AO_PYRO_NUM > 4 -	case 4: ao_pyro_fire_port(AO_PYRO_PORT_4, AO_PYRO_PIN_4); break; +	case 4: ao_pyro_fire_port(AO_PYRO_PORT_4, AO_PYRO_PIN_4, AO_PYRO_4); break;  #endif  #if AO_PYRO_NUM > 5 -	case 5: ao_pyro_fire_port(AO_PYRO_PORT_5, AO_PYRO_PIN_5); break; +	case 5: ao_pyro_fire_port(AO_PYRO_PORT_5, AO_PYRO_PIN_5, AO_PYRO_5); break;  #endif  #if AO_PYRO_NUM > 6 -	case 6: ao_pyro_fire_port(AO_PYRO_PORT_6, AO_PYRO_PIN_6); break; +	case 6: ao_pyro_fire_port(AO_PYRO_PORT_6, AO_PYRO_PIN_6, AO_PYRO_6); break;  #endif  #if AO_PYRO_NUM > 7 -	case 7: ao_pyro_fire_port(AO_PYRO_PORT_7, AO_PYRO_PIN_7); break; +	case 7: ao_pyro_fire_port(AO_PYRO_PORT_7, AO_PYRO_PIN_7, AO_PYRO_7); break;  #endif  	default: break;  	} @@ -291,7 +293,6 @@ void  ao_pyro_set(void)  {  	uint8_t	p; -	struct ao_pyro *pyro;  	struct ao_pyro pyro_tmp;  	char	name[AO_PYRO_NAME_LEN];  	uint8_t	c; @@ -351,28 +352,28 @@ void  ao_pyro_init(void)  {  #if AO_PYRO_NUM > 0 -	ao_enable_output(AO_PYRO_PORT_0, AO_PYRO_PIN_0, 0); +	ao_enable_output(AO_PYRO_PORT_0, AO_PYRO_PIN_0, AO_PYRO_0, 0);  #endif  #if AO_PYRO_NUM > 1 -	ao_enable_output(AO_PYRO_PORT_1, AO_PYRO_PIN_1, 0); +	ao_enable_output(AO_PYRO_PORT_1, AO_PYRO_PIN_1, AO_PYRO_1, 0);  #endif  #if AO_PYRO_NUM > 2 -	ao_enable_output(AO_PYRO_PORT_2, AO_PYRO_PIN_2, 0); +	ao_enable_output(AO_PYRO_PORT_2, AO_PYRO_PIN_2, AO_PYRO_2, 0);  #endif  #if AO_PYRO_NUM > 3 -	ao_enable_output(AO_PYRO_PORT_3, AO_PYRO_PIN_3, 0); +	ao_enable_output(AO_PYRO_PORT_3, AO_PYRO_PIN_3, AO_PYRO_3, 0);  #endif  #if AO_PYRO_NUM > 4 -	ao_enable_output(AO_PYRO_PORT_4, AO_PYRO_PIN_4, 0); +	ao_enable_output(AO_PYRO_PORT_4, AO_PYRO_PIN_4, AO_PYRO_4, 0);  #endif  #if AO_PYRO_NUM > 5 -	ao_enable_output(AO_PYRO_PORT_5, AO_PYRO_PIN_5, 0); +	ao_enable_output(AO_PYRO_PORT_5, AO_PYRO_PIN_5, AO_PYRO_5, 0);  #endif  #if AO_PYRO_NUM > 6 -	ao_enable_output(AO_PYRO_PORT_6, AO_PYRO_PIN_6, 0); +	ao_enable_output(AO_PYRO_PORT_6, AO_PYRO_PIN_6, AO_PYRO_6, 0);  #endif  #if AO_PYRO_NUM > 7 -	ao_enable_output(AO_PYRO_PORT_7, AO_PYRO_PIN_7, 0); +	ao_enable_output(AO_PYRO_PORT_7, AO_PYRO_PIN_7, AO_PYRO_7, 0);  #endif  	ao_add_task(&ao_pyro_task, ao_pyro, "pyro");  } | 
