// ----------------------------------------------------------------------------- void NotifyNav(void) { // Disable the pin change interrupt for PC4. PCMSK2 &= ~_BV(PCINT20); // Pull down PC4. PORTC &= ~_BV(4); DDRC |= _BV(4); asm ("nop"); // Wait one cycle // Set PC4 back to input and pull-up. DDRC &= ~_BV(4); PORTC |= _BV(4); // Re-enable the pin change interrupt for pin PC4. PCMSK2 |= _BV(PCINT20); RedLEDOn(); }
static void LSM303DLHTestACC(void) { #ifdef UART_DEBUG uart_puts_P("\r\n"); #endif // UART_DEBUG LSM303DLHData acc_data; // --- read accelerometer values uint8_t ret = LSM303DLHReadACC( I2C_DEV_LSM303DLH_ACC1, &acc_data ); if ( ret ) { YellowLEDOff(); RedLEDOn(); // show error #ifdef UART_DEBUG if ( ret == I2C_ERR_NO_DEVICE ) uart_puts_P("ACC: I2C_ERR_NO_DEV\r\n"); #endif // UART_DEBUG #ifdef UART_DEBUG if ( ret == I2C_ERROR ) uart_puts_P("ACC: I2C_ERROR\r\n"); #endif // UART_DEBUG return; } PrintSensorData( "AX", acc_data.fSensorX ); PrintSensorData( "AY", acc_data.fSensorY ); PrintSensorData( "AZ", acc_data.fSensorZ ); uart_puts_p( cCRLF ); delay_sec(1); }
static void LSM303DLHTestMAG(void) { #ifdef UART_DEBUG uart_puts_P("\r\n"); #endif // UART_DEBUG LSM303DLHData mag_data; // --- read magnetometer values uint8_t ret = LSM303DLHReadMAG( I2C_DEV_LSM303DLH_MAG, &mag_data ); if ( ret ) { YellowLEDOff(); RedLEDOn(); // show error #ifdef UART_DEBUG if ( ret == I2C_ERR_NO_DEVICE ) uart_puts_P("MAG: I2C_ERR_NO_DEV\r\n"); #endif // UART_DEBUG #ifdef UART_DEBUG if ( ret == I2C_ERROR ) uart_puts_P("MAG: I2C_ERROR\r\n"); #endif // UART_DEBUG return; } PrintSensorData( "MX", mag_data.fSensorX ); PrintSensorData( "MY", mag_data.fSensorY ); PrintSensorData( "MZ", mag_data.fSensorZ ); uart_puts_p( cCRLF ); delay_sec(1); }