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
3838inline void LEDTX_off (void ) { PORT -> Group [BOARD_LEDTX_PORT ].OUTSET .reg = (1 <<BOARD_LEDTX_PIN ); }
3939inline void LEDTX_toggle (void ) { PORT -> Group [BOARD_LEDTX_PORT ].OUTTGL .reg = (1 <<BOARD_LEDTX_PIN ); }
4040
41+ inline void LED_configure (uint32_t sampleRate ) { SysTick_Config (sampleRate ); }
42+
4143#endif // _BOARD_DRIVER_LED_
Original file line number Diff line number Diff line change 1818*/
1919
2020#include <sam.h>
21+ #include "board_driver_led.h"
2122
2223struct ConstVectors
2324{
@@ -140,8 +141,25 @@ void PendSV_Handler(void)
140141 while (1 );
141142}
142143
144+ volatile uint8_t keepValue = 0 ;
145+ volatile uint8_t targetValue = 20 ;
146+ volatile int8_t direction = 1 ;
147+
143148void SysTick_Handler (void )
144149{
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)
181181
182182 /* Initialize LEDs */
183183 LED_init ();
184- LED_on ( );
184+ LED_configure ( 1000 );
185185 LEDRX_init ();
186186 LEDRX_off ();
187187 LEDTX_init ();
You can’t perform that action at this time.
0 commit comments