inverter added
This commit is contained in:
parent
d94ac2ea48
commit
4b32cc8d39
42
src/inverter.c
Normal file
42
src/inverter.c
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* inverter.c
|
||||
*
|
||||
* Created on: 19.09.2016
|
||||
* Author: dehottgw
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <msp430g2553.h>
|
||||
#include <isr_compat.h>
|
||||
|
||||
#include "inverter.h"
|
||||
|
||||
|
||||
ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
|
||||
|
||||
}
|
||||
|
||||
//ISR(TIMER1_A1, TA1_ISR_Comp) {
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
|
||||
void inverterInit() {
|
||||
P2OUT &= ~BIT1;
|
||||
P2DIR |= BIT1;
|
||||
P2SEL |= BIT1;
|
||||
|
||||
P2OUT &= ~BIT0;
|
||||
P2DIR |= BIT0;
|
||||
P2SEL |= BIT0;
|
||||
|
||||
|
||||
TA1CTL = MC_1 | ID_3 | TASSEL_2 | TACLR;
|
||||
TA1CCTL0 = CCIE | OUTMOD_4;
|
||||
TA1CCTL1 = OUTMOD_7;
|
||||
TA1CCR0 = 200;
|
||||
TA1CCR1 = 62;
|
||||
}
|
16
src/inverter.h
Normal file
16
src/inverter.h
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* inverter.h
|
||||
*
|
||||
* Created on: 19.09.2016
|
||||
* Author: dehottgw
|
||||
*/
|
||||
|
||||
#ifndef INVERTER_H_
|
||||
#define INVERTER_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void inverterInit();
|
||||
void inverterSetFrequency(uint8_t f);
|
||||
|
||||
#endif /* INVERTER_H_ */
|
@ -12,7 +12,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "time.h"
|
||||
|
||||
#include "inverter.h"
|
||||
|
||||
|
||||
int main() {
|
||||
@ -26,6 +26,7 @@ int main() {
|
||||
|
||||
|
||||
timeInit();
|
||||
inverterInit();
|
||||
|
||||
__enable_interrupt();
|
||||
|
||||
|
10
src/time.c
10
src/time.c
@ -23,16 +23,12 @@ ISR(TIMER0_A0, TA0_ISR) {
|
||||
void timeInit() {
|
||||
timestamp = 0;
|
||||
|
||||
TACCR0 = 32;
|
||||
TACCTL0 = CCIE;
|
||||
TACTL = MC_1 | ID_3 | TASSEL_2 | TACLR;
|
||||
TA0CCR0 = 32;
|
||||
TA0CCTL0 = CCIE;
|
||||
TA0CTL = 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);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
void timeInit();
|
||||
uint32_t getMillis();
|
||||
void ms_active_delay(uint16_t delay);
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user