/****************************************************************************** Function: void DRV_NVM_SST25VF064_ReadStatusRegister( void ) Summary: Reads the status register of the device. Description: This function reads the status register of the device. Parameters: None Returns: The current value of the status register. ******************************************************************************/ uint8_t DRV_NVM_SST25VF064_ReadStatusRegister(void) { uint8_t temp; while(!SPILOCK(spiInitData.channel)); SPIINITIALIZE((DRV_SPI_INIT_DATA *)&spiInitData); temp = ReadStatusRegister(); SPIUNLOCK(spiInitData.channel); return temp; }
__interrupt void Port_1(void) { ADC10CTL0 = ADC10ON | SREF_0 | ADC10SHT_2; ADC10CTL1 = INCH_0 | SHS_0 | ADC10SSEL_0 | ADC10DIV_0 | CONSEQ_0; ADC10CTL0 |= ENC; ADC10AE0 = BIT0; ADC10CTL0 |= ADC10SC; // start conversion while (converting()); if (ADC10MEM < 340) // 340 Vss 3.0v, 360 Vss 3.6v { int j; for (j=0; j<40; j++) { volatile unsigned int i; P1OUT ^= BIT2; i = 2000; do i--; while(i != 0); P1OUT ^= BIT2; i = 3000; do i--; while(i != 0); P1OUT ^= BIT4; i = 2000; do i--; while(i != 0); P1OUT ^= BIT4; i = 3000; do i--; while(i != 0); /* * P1.0 is used as light sensor */ // P1OUT ^= BIT0; // i = 2000; // do i--; // while(i != 0); // P1OUT ^= BIT0; // i = 2000; // do i--; // while(i != 0); /* * for dog collar, don't use this one to save power * */ P2OUT ^= BIT6; i = 2000; do i--; while(i != 0); P2OUT ^= BIT6; i = 3000; do i--; while(i != 0); } } // ADC10MEM // acknowledge interrupt by reading STATUS register ReadStatusRegister(); P1IFG &= ~BIT3; // P1.3 IFG cleared // restart measurement in wakeup mode again after interrupt is cleared WriteByteToRegister( 0x2D, 0x0A ); }