Revision 19, 1.6 kB
(checked in by phil, 15 years ago)
|
first display of button presses,
stubs for calculations,
removed calls of unused example functions
|
Line | |
---|
1 |
#include "FreeRTOS.h" |
---|
2 |
#include "semphr.h" |
---|
3 |
#include "task.h" |
---|
4 |
|
---|
5 |
extern basementGasReading; |
---|
6 |
extern xMetersSemaphore; |
---|
7 |
|
---|
8 |
/* The interrupt entry point. */ |
---|
9 |
void vP2_0_ISR_Wrapper( void ) __attribute__((naked)); |
---|
10 |
|
---|
11 |
/* The function that actually performs the interrupt processing. This must be |
---|
12 |
separate to the wrapper to ensure the correct stack frame is set up. */ |
---|
13 |
void vP2_0_ISR_Handler( void ); |
---|
14 |
|
---|
15 |
void vP2_0_ISR_Handler( void ) |
---|
16 |
{ |
---|
17 |
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; |
---|
18 |
|
---|
19 |
if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered */ |
---|
20 |
{ |
---|
21 |
basementGasReading++; |
---|
22 |
} |
---|
23 |
// else if ((IO2_INT_STAT_R & (1 << n)) != 0) /* some other interrupt triggered */ |
---|
24 |
{ |
---|
25 |
; |
---|
26 |
} |
---|
27 |
|
---|
28 |
/* Clear the interrupt. */ |
---|
29 |
IO2_INT_CLR |= (1<<10); |
---|
30 |
VICVectAddr = 0; |
---|
31 |
|
---|
32 |
/* Unblock the Meters task as data has arrived. */ |
---|
33 |
xSemaphoreGiveFromISR( xMetersSemaphore, &xHigherPriorityTaskWoken ); |
---|
34 |
|
---|
35 |
if( xHigherPriorityTaskWoken ) |
---|
36 |
{ |
---|
37 |
/* If the Meters task was unblocked then calling "Yield from ISR" here |
---|
38 |
will ensure the interrupt returns directly to the Meters task, if it |
---|
39 |
is the highest priority read task. */ |
---|
40 |
portYIELD_FROM_ISR(); |
---|
41 |
} |
---|
42 |
} |
---|
43 |
/*-----------------------------------------------------------*/ |
---|
44 |
|
---|
45 |
void vP2_0_ISR_Wrapper( void ) |
---|
46 |
{ |
---|
47 |
/* Save the context of the interrupted task. */ |
---|
48 |
portSAVE_CONTEXT(); |
---|
49 |
|
---|
50 |
/* Call the handler function. This must be separate from the wrapper |
---|
51 |
function to ensure the correct stack frame is set up. */ |
---|
52 |
vP2_0_ISR_Handler(); |
---|
53 |
|
---|
54 |
/* Restore the context of whichever task is going to run next. */ |
---|
55 |
portRESTORE_CONTEXT(); |
---|
56 |
} |
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|