pattern stuff
This commit is contained in:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -2,7 +2,7 @@ CC=msp430-gcc
 | 
			
		||||
CFLAGS=-O3 -g0 -Wall -mmcu=msp430g2553 -std=gnu99 -I hottislib
 | 
			
		||||
LDFLAGS=-mmcu=msp430g2553
 | 
			
		||||
 | 
			
		||||
blinky1.elf:	main.o led.o time.o PontCoopScheduler.o
 | 
			
		||||
blinky1.elf:	main.o led.o time.o pattern.o PontCoopScheduler.o
 | 
			
		||||
	$(CC) -o $@ $(LDFLAGS) $^
 | 
			
		||||
 | 
			
		||||
PontCoopScheduler.o:	hottislib/PontCoopScheduler.c hottislib/PontCoopScheduler.h
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								led.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								led.c
									
									
									
									
									
								
							@@ -179,7 +179,7 @@ void selectCol(uint8_t column, tColor color) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
void testledExec() {
 | 
			
		||||
 | 
			
		||||
    static uint8_t rowNum = 0;
 | 
			
		||||
@@ -203,7 +203,7 @@ void testledExec() {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledExec() {
 | 
			
		||||
@@ -223,5 +223,5 @@ void ledExec() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ledInit() {
 | 
			
		||||
    schAdd(ledExec, NULL, 0, 10);
 | 
			
		||||
    // schAdd(testledExec, NULL, 0, 500);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								led.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								led.h
									
									
									
									
									
								
							@@ -16,6 +16,7 @@ typedef enum { BLUE = 0, RED = 1, OFF = 2 } tColor;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ledInit();
 | 
			
		||||
void ledExec();
 | 
			
		||||
void ledSetMatrix(uint8_t col, uint8_t row, tColor color);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.c
									
									
									
									
									
								
							@@ -8,6 +8,7 @@
 | 
			
		||||
#include "PontCoopScheduler.h"
 | 
			
		||||
 | 
			
		||||
#include "led.h"
 | 
			
		||||
#include "pattern.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int main() {
 | 
			
		||||
@@ -26,10 +27,13 @@ int main() {
 | 
			
		||||
    schInit();
 | 
			
		||||
 | 
			
		||||
    ledInit();
 | 
			
		||||
    // patternInit();
 | 
			
		||||
    ledSetMatrix(3, 1, BLUE);
 | 
			
		||||
 | 
			
		||||
    __enable_interrupt();
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
        schExec();
 | 
			
		||||
        ledExec();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								pattern.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								pattern.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
#include "pattern.h"
 | 
			
		||||
#include "led.h"
 | 
			
		||||
#include "PontCoopScheduler.h"
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void patternExec() {
 | 
			
		||||
    static uint8_t i = 0;
 | 
			
		||||
    static uint8_t j = 0;
 | 
			
		||||
 | 
			
		||||
    ledSetMatrix(i, j, BLUE);
 | 
			
		||||
 | 
			
		||||
    i++;
 | 
			
		||||
    if (i > 3) {
 | 
			
		||||
        i = 0;
 | 
			
		||||
        j++;
 | 
			
		||||
        if (j > 3) {
 | 
			
		||||
            j = 0;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    ledSetMatrix(i, j, RED);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void patternInit() {
 | 
			
		||||
    schAdd(patternExec, NULL, 0, 1000);
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user