- async command void HplAdc12.setMSC(){ ADC12CTL0 |= MSC; }
- async command void HplAdc12.resetMSC(){ ADC12CTL0 &= ~MSC; }
-
- async command void HplAdc12.setRefOn(){ ADC12CTL0 |= REFON;}
- async command void HplAdc12.resetRefOn(){ ADC12CTL0 &= ~REFON;}
- async command uint8_t HplAdc12.getRefon(){ return (ADC12CTL0 & REFON) >> 5;}
- async command void HplAdc12.setRef1_5V(){ ADC12CTL0 &= ~REF2_5V;}
- async command void HplAdc12.setRef2_5V(){ ADC12CTL0 |= REF2_5V;}
- async command uint8_t HplAdc12.isRef2_5V(){ return (ADC12CTL0 & REF2_5V) >> 6;}
-
- async command void HplAdc12.setSHT(uint8_t sht){
- uint16_t ctl0 = ADC12CTL0;
- uint16_t shttemp = sht & 0x0F;
- ctl0 &= 0x00FF;
- ctl0 |= (shttemp << 8);
- ctl0 |= (shttemp << 12);
- ADC12CTL0 = ctl0;
+ async command void HplAdc12.stopConversion(){
+ // stop conversion mode immediately, conversion data is unreliable
+ uint16_t ctl1 = ADC12CTL1;
+ ADC12CTL1 &= ~(CONSEQ0 | CONSEQ1);
+ ADC12CTL0 &= ~(ADC12SC + ENC);
+ ADC12CTL0 &= ~(ADC12ON);
+ ADC12CTL1 |= (ctl1 & (CONSEQ0 | CONSEQ1));