initial
This commit is contained in:
commit
783e8a357e
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
*.o
|
||||
*.elf
|
||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "hottislib"]
|
||||
path = hottislib
|
||||
url = git@gitlab.com:wolutator/hottislib.git
|
1
hottislib
Submodule
1
hottislib
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit d129650a6fbc77f5b5474c2b5153fa6adbbda003
|
24
led.c
Normal file
24
led.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* led.c
|
||||
*
|
||||
* Created on: Jan 24, 2019
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#include "led.h"
|
||||
#include "PontCoopScheduler.h"
|
||||
#include <msp430g2553.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
||||
void ledExec() {
|
||||
P1OUT ^= BIT0;
|
||||
}
|
||||
|
||||
void ledInit() {
|
||||
P1DIR |= BIT0;
|
||||
P1OUT &= ~BIT0;
|
||||
|
||||
schAdd(ledExec, NULL, 0, 1000);
|
||||
}
|
15
led.h
Normal file
15
led.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* led.h
|
||||
*
|
||||
* Created on: Jan 24, 2019
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#ifndef LED_H_
|
||||
#define LED_H_
|
||||
|
||||
|
||||
void ledExec();
|
||||
void ledInit();
|
||||
|
||||
#endif /* LED_H_ */
|
35
main.c
Normal file
35
main.c
Normal file
@ -0,0 +1,35 @@
|
||||
#include <msp430g2553.h>
|
||||
#include <stdint.h>
|
||||
#include <intrinsics.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "time.h"
|
||||
#include "PontCoopScheduler.h"
|
||||
|
||||
#include "led.h"
|
||||
|
||||
|
||||
int main() {
|
||||
WDTCTL = WDTPW | WDTHOLD;
|
||||
|
||||
__disable_interrupt();
|
||||
|
||||
// highest possible system clock
|
||||
DCOCTL = DCO0 | DCO1 | DCO2;
|
||||
BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3;
|
||||
BCSCTL2 = 0;
|
||||
BCSCTL3 = 0;
|
||||
|
||||
|
||||
timeInit();
|
||||
schInit();
|
||||
|
||||
ledInit();
|
||||
|
||||
__enable_interrupt();
|
||||
|
||||
while (1) {
|
||||
schExec();
|
||||
}
|
||||
}
|
38
time.c
Normal file
38
time.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* time.c
|
||||
*
|
||||
* Created on: 20.05.2014
|
||||
* Author: wn
|
||||
*/
|
||||
|
||||
#include <msp430g2553.h>
|
||||
#include <isr_compat.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "time.h"
|
||||
#include "PontCoopScheduler.h"
|
||||
|
||||
|
||||
volatile uint32_t timestamp;
|
||||
|
||||
ISR(TIMER0_A0, TA0_ISR) {
|
||||
timestamp++;
|
||||
schUpdate();
|
||||
}
|
||||
|
||||
void timeInit() {
|
||||
timestamp = 0;
|
||||
|
||||
TACCR0 = 32;
|
||||
TACCTL0 = CCIE;
|
||||
TACTL = MC_1 | ID_0 | TASSEL_1 | TACLR;
|
||||
}
|
||||
|
||||
uint32_t getMillis() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
void ms_active_delay(uint16_t delay) {
|
||||
uint32_t start = timestamp;
|
||||
while (start + delay > timestamp);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user