works nearly

This commit is contained in:
hg
2016-01-26 22:55:49 +01:00
parent f4df422832
commit 90c568ec8d
3 changed files with 32 additions and 34 deletions

View File

@ -18,32 +18,32 @@ volatile uint16_t onTime = 500;
volatile uint16_t offTime = 200; volatile uint16_t offTime = 200;
interrupt (TIMER0_A0_VECTOR) timer0a0_isr(void) { interrupt (TIMER0_A0_VECTOR) timer0a0_isr(void) {
// static uint8_t state = 0; static uint8_t state = 0;
// static uint16_t timestamp = 0; static uint16_t timestamp = 0;
//
// timestamp++; timestamp++;
//
// switch (state) { switch (state) {
// case 0: case 0:
// if (timestamp >= onTime) { if (timestamp >= onTime) {
// timestamp = 0; timestamp = 0;
// // P1SEL &= ~BIT6; P1SEL &= ~BIT6;
// // P1OUT &= ~BIT6; P1OUT &= ~BIT6;
// state = 1; state = 1;
// } }
// break; break;
// case 1: case 1:
// if (timestamp >= offTime) { if (timestamp >= offTime) {
// timestamp = 0; timestamp = 0;
// // P1SEL |= BIT6; P1SEL |= BIT6;
// state = 0; state = 0;
// } }
// break; break;
// default: default:
// state = 0; state = 0;
// } }
//
//
} }
@ -58,7 +58,7 @@ void engineInit() {
TACCTL0 = CCIE; TACCTL0 = CCIE;
TACCTL1 = OUTMOD_7; TACCTL1 = OUTMOD_7;
//TACTL = MC_1 | ID_0 | TASSEL_2 | TACLR | TAIE; //TACTL = MC_1 | ID_0 | TASSEL_2 | TACLR | TAIE;
TACTL = MC_1 | ID_0 | TASSEL_2 | TACLR | TAIE; TACTL = MC_1 | ID_0 | TASSEL_2 | TACLR;
} }
@ -67,5 +67,5 @@ uint16_t engineMaxPwmValue() {
} }
void engineSetPwmValue(uint16_t val) { void engineSetPwmValue(uint16_t val) {
//TACCR1 = val; TACCR1 = val;
} }

View File

@ -100,8 +100,6 @@ void hmiInit() {
} }
void hmiExec() { void hmiExec() {
engineSetPwmValue(512);
if (intensitySwitch.get()) { if (intensitySwitch.get()) {
intensity += intensityStep; intensity += intensityStep;
if (intensity > maxIntensity) { if (intensity > maxIntensity) {

View File

@ -19,10 +19,10 @@ int main() {
WDTCTL = WDTPW | WDTHOLD; WDTCTL = WDTPW | WDTHOLD;
// highest possible system clock // highest possible system clock
// DCOCTL = DCO0 | DCO1 | DCO2; DCOCTL = DCO0 | DCO1 | DCO2;
// BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3; BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3;
// BCSCTL2 = 0; BCSCTL2 = 0;
// BCSCTL3 = 0; BCSCTL3 = 0;
P1DIR |= BIT7; P1DIR |= BIT7;