works nearly
This commit is contained in:
parent
f4df422832
commit
90c568ec8d
@ -18,32 +18,32 @@ volatile uint16_t onTime = 500;
|
||||
volatile uint16_t offTime = 200;
|
||||
|
||||
interrupt (TIMER0_A0_VECTOR) timer0a0_isr(void) {
|
||||
// static uint8_t state = 0;
|
||||
// static uint16_t timestamp = 0;
|
||||
//
|
||||
// timestamp++;
|
||||
//
|
||||
// switch (state) {
|
||||
// case 0:
|
||||
// if (timestamp >= onTime) {
|
||||
// timestamp = 0;
|
||||
// // P1SEL &= ~BIT6;
|
||||
// // P1OUT &= ~BIT6;
|
||||
// state = 1;
|
||||
// }
|
||||
// break;
|
||||
// case 1:
|
||||
// if (timestamp >= offTime) {
|
||||
// timestamp = 0;
|
||||
// // P1SEL |= BIT6;
|
||||
// state = 0;
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// state = 0;
|
||||
// }
|
||||
//
|
||||
//
|
||||
static uint8_t state = 0;
|
||||
static uint16_t timestamp = 0;
|
||||
|
||||
timestamp++;
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
if (timestamp >= onTime) {
|
||||
timestamp = 0;
|
||||
P1SEL &= ~BIT6;
|
||||
P1OUT &= ~BIT6;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (timestamp >= offTime) {
|
||||
timestamp = 0;
|
||||
P1SEL |= BIT6;
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
state = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ void engineInit() {
|
||||
TACCTL0 = CCIE;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -67,5 +67,5 @@ uint16_t engineMaxPwmValue() {
|
||||
}
|
||||
|
||||
void engineSetPwmValue(uint16_t val) {
|
||||
//TACCR1 = val;
|
||||
TACCR1 = val;
|
||||
}
|
||||
|
@ -100,8 +100,6 @@ void hmiInit() {
|
||||
}
|
||||
|
||||
void hmiExec() {
|
||||
engineSetPwmValue(512);
|
||||
|
||||
if (intensitySwitch.get()) {
|
||||
intensity += intensityStep;
|
||||
if (intensity > maxIntensity) {
|
||||
|
@ -19,10 +19,10 @@ int main() {
|
||||
WDTCTL = WDTPW | WDTHOLD;
|
||||
|
||||
// highest possible system clock
|
||||
// DCOCTL = DCO0 | DCO1 | DCO2;
|
||||
// BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3;
|
||||
// BCSCTL2 = 0;
|
||||
// BCSCTL3 = 0;
|
||||
DCOCTL = DCO0 | DCO1 | DCO2;
|
||||
BCSCTL1 = XT2OFF | RSEL0 | RSEL1 | RSEL2 | RSEL3;
|
||||
BCSCTL2 = 0;
|
||||
BCSCTL3 = 0;
|
||||
|
||||
|
||||
P1DIR |= BIT7;
|
||||
|
Loading…
x
Reference in New Issue
Block a user