File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -38,4 +38,6 @@ inline void LEDTX_on(void) { PORT->Group[BOARD_LEDTX_PORT].OUTCLR.reg = (1<<BOAR
38
38
inline void LEDTX_off (void ) { PORT -> Group [BOARD_LEDTX_PORT ].OUTSET .reg = (1 <<BOARD_LEDTX_PIN ); }
39
39
inline void LEDTX_toggle (void ) { PORT -> Group [BOARD_LEDTX_PORT ].OUTTGL .reg = (1 <<BOARD_LEDTX_PIN ); }
40
40
41
+ inline void LED_configure (uint32_t sampleRate ) { SysTick_Config (sampleRate ); }
42
+
41
43
#endif // _BOARD_DRIVER_LED_
Original file line number Diff line number Diff line change 18
18
*/
19
19
20
20
#include <sam.h>
21
+ #include "board_driver_led.h"
21
22
22
23
struct ConstVectors
23
24
{
@@ -140,8 +141,25 @@ void PendSV_Handler(void)
140
141
while (1 );
141
142
}
142
143
144
+ volatile uint8_t keepValue = 0 ;
145
+ volatile uint8_t targetValue = 20 ;
146
+ volatile int8_t direction = 1 ;
147
+
143
148
void SysTick_Handler (void )
144
149
{
145
- __BKPT (1 );
146
- while (1 );
147
- }
150
+ if (keepValue == 0 ) {
151
+ targetValue += direction ;
152
+ LED_toggle ();
153
+ }
154
+ keepValue ++ ;
155
+
156
+ if (targetValue > 240 || targetValue < 10 ) {
157
+ direction = - direction ;
158
+ targetValue += direction ;
159
+ }
160
+
161
+ if (keepValue == targetValue ) {
162
+ LED_toggle ();
163
+ }
164
+ //TC5->COUNT16.INTFLAG.bit.MC0 = 1; // Clear interrupt
165
+ }
Original file line number Diff line number Diff line change @@ -181,7 +181,7 @@ int main(void)
181
181
182
182
/* Initialize LEDs */
183
183
LED_init ();
184
- LED_on ( );
184
+ LED_configure ( 1000 );
185
185
LEDRX_init ();
186
186
LEDRX_off ();
187
187
LEDTX_init ();
You can’t perform that action at this time.
0 commit comments