Added incomplete MIDIToneGenerator project.
[pub/USBasp.git] / Projects / TemperatureDataLogger / TempDataLogger.c
index 2f2e8da..955359d 100644 (file)
@@ -110,6 +110,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
        /* Reset log tick counter to prepare for next logging interval */\r
        CurrentLoggingTicks = 0;\r
        \r
+       /* Only log when not connected to a USB host */\r
        if (USB_DeviceState == DEVICE_STATE_Unattached)\r
        {\r
                uint8_t Day,  Month,  Year;\r
@@ -139,15 +140,15 @@ int main(void)
        /* Fetch logging interval from EEPROM */\r
        LoggingInterval500MS_SRAM = eeprom_read_byte(&LoggingInterval500MS_EEPROM);\r
 \r
-       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-\r
        SetupHardware();\r
 \r
+       LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+\r
        /* Mount and open the log file on the dataflash FAT partition */\r
        OpenLogFile();\r
 \r
        /* Discard the first sample from the temperature sensor, as it is generally incorrect */\r
-       uint8_t Dummy = Temperature_GetTemperature();\r
+       volatile uint8_t Dummy = Temperature_GetTemperature();\r
        (void)Dummy;\r
        \r
        for (;;)\r
@@ -199,6 +200,7 @@ void SetupHardware(void)
        Temperature_Init();\r
        Dataflash_Init();\r
        USB_Init();\r
+       TWI_Init();\r
        \r
        /* 500ms logging interval timer configuration */\r
        OCR1A   = ((F_CPU / 1024) / 2);\r