@@ -7,7 +7,7 @@ typedef void (*voidFuncPtr)(void);
7
7
typedef void (*voidFuncPtrArg)(void *);
8
8
9
9
// Helper functions for Functional interrupt routines
10
- extern " C" bool __attachInterruptFunctionalArg (uint8_t pin, voidFuncPtr userFunc, void *fp, int mode, bool functional);
10
+ extern " C" void __attachInterruptFunctionalArg (uint8_t pin, voidFuncPtr userFunc, void *fp, int mode, bool functional);
11
11
12
12
13
13
void ICACHE_RAM_ATTR interruptFunctional (void * arg)
@@ -34,52 +34,32 @@ extern "C"
34
34
}
35
35
}
36
36
37
- bool attachInterrupt (uint8_t pin, std::function<void (void )> intRoutine, int mode)
37
+ void attachInterrupt (uint8_t pin, std::function<void (void )> intRoutine, int mode)
38
38
{
39
39
// use the local interrupt routine which takes the ArgStructure as argument
40
40
41
41
InterruptInfo* ii = nullptr ;
42
42
43
- FunctionInfo* fi = new (std::nothrow) FunctionInfo;
44
- if (fi == nullptr )
45
- return false ;
43
+ FunctionInfo* fi = new FunctionInfo;
46
44
fi->reqFunction = intRoutine;
47
45
48
- ArgStructure* as = new (std::nothrow) ArgStructure;
49
- if (as == nullptr )
50
- {
51
- delete (fi);
52
- return false ;
53
- }
46
+ ArgStructure* as = new ArgStructure;
54
47
as->interruptInfo = ii;
55
48
as->functionInfo = fi;
56
49
57
- return __attachInterruptFunctionalArg (pin, (voidFuncPtr)interruptFunctional, as, mode, true );
50
+ __attachInterruptFunctionalArg (pin, (voidFuncPtr)interruptFunctional, as, mode, true );
58
51
}
59
52
60
- bool attachScheduledInterrupt (uint8_t pin, std::function<void (InterruptInfo)> scheduledIntRoutine, int mode)
53
+ void attachScheduledInterrupt (uint8_t pin, std::function<void (InterruptInfo)> scheduledIntRoutine, int mode)
61
54
{
62
- InterruptInfo* ii = new (std::nothrow) InterruptInfo;
63
- if (ii == nullptr )
64
- return false ;
55
+ InterruptInfo* ii = new InterruptInfo;
65
56
66
57
FunctionInfo* fi = new FunctionInfo;
67
- if (fi == nullptr )
68
- {
69
- delete ii;
70
- return false ;
71
- }
72
58
fi->reqScheduledFunction = scheduledIntRoutine;
73
59
74
- ArgStructure* as = new (std::nothrow) ArgStructure;
75
- if (as == nullptr )
76
- {
77
- delete ii;
78
- delete fi;
79
- return false ;
80
- }
60
+ ArgStructure* as = new ArgStructure;
81
61
as->interruptInfo = ii;
82
62
as->functionInfo = fi;
83
63
84
- return __attachInterruptFunctionalArg (pin, (voidFuncPtr)interruptFunctional, as, mode, true );
64
+ __attachInterruptFunctionalArg (pin, (voidFuncPtr)interruptFunctional, as, mode, true );
85
65
}
0 commit comments