forked from mfulz_github/qmk_firmware
Fix TemperatureDataLogger - sample tick timer wasn't being initialized in the correct CTC mode.
This commit is contained in:
parent
7beafc64e2
commit
0ea819f781
|
@ -37,7 +37,7 @@ void Bluetooth_ProcessACLPackets(void)
|
|||
Bluetooth_DataPacket_Header_t DataHeader;
|
||||
|
||||
Pipe_SelectPipe(BLUETOOTH_DATA_IN_PIPE);
|
||||
Pipe_SetToken(PIPE_TOKEN_IN);
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_IN);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
if (!(Pipe_IsReadWriteAllowed()))
|
||||
|
@ -116,7 +116,7 @@ static inline void Bluetooth_ProcessSignalPacket_ConnectionRequest(Bluetooth_ACL
|
|||
Pipe_ClearIN();
|
||||
Pipe_Freeze();
|
||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
||||
Pipe_SetToken(PIPE_TOKEN_OUT);
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
Bluetooth_SignalCommand_ConnectionResponse_t ConnectionResponse;
|
||||
|
@ -167,7 +167,7 @@ static inline void Bluetooth_ProcessSignalPacket_ConfigurationRequest(Bluetooth_
|
|||
Pipe_ClearIN();
|
||||
Pipe_Freeze();
|
||||
Pipe_SelectPipe(BLUETOOTH_DATA_OUT_PIPE);
|
||||
Pipe_SetToken(PIPE_TOKEN_OUT);
|
||||
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
|
||||
Pipe_Unfreeze();
|
||||
|
||||
Bluetooth_SignalCommand_ConfigurationResponse_t ConfigurationResponse;
|
||||
|
|
|
@ -72,7 +72,6 @@ static bool Bluetooth_GetNextHCIEventHeader(void)
|
|||
}
|
||||
|
||||
Pipe_Read_Stream_LE(&HCIEventHeader, sizeof(HCIEventHeader));
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
return true;
|
||||
|
@ -81,11 +80,14 @@ static bool Bluetooth_GetNextHCIEventHeader(void)
|
|||
static void Bluetooth_DiscardRemainingHCIEventParameters(void)
|
||||
{
|
||||
Pipe_SelectPipe(BLUETOOTH_EVENTS_PIPE);
|
||||
|
||||
Pipe_Unfreeze();
|
||||
|
||||
Pipe_Discard_Stream(HCIEventHeader.ParameterLength);
|
||||
Pipe_ClearIN();
|
||||
|
||||
Pipe_Freeze();
|
||||
|
||||
HCIEventHeader.ParameterLength = 0;
|
||||
}
|
||||
|
||||
void Bluetooth_ProcessHCICommands(void)
|
||||
|
@ -329,6 +331,10 @@ void Bluetooth_ProcessHCICommands(void)
|
|||
|
||||
Bluetooth_HCIProcessingState = Bluetooth_Conn_SendPINCode;
|
||||
}
|
||||
else if (HCIEventHeader.EventCode == EVENT_COMMAND_COMPLETE)
|
||||
{
|
||||
BT_DEBUG("(HCI) >> Command Complete", NULL);
|
||||
}
|
||||
|
||||
BT_DEBUG("(HCI) -- Unread Event Param Length: %d", HCIEventHeader.ParameterLength);
|
||||
|
||||
|
@ -394,17 +400,6 @@ void Bluetooth_ProcessHCICommands(void)
|
|||
|
||||
Bluetooth_SendHCICommand(&PINCodeRequestParams, sizeof(PINCodeRequestParams));
|
||||
|
||||
do
|
||||
{
|
||||
while (!(Bluetooth_GetNextHCIEventHeader()))
|
||||
{
|
||||
if (USB_HostState == HOST_STATE_Unattached)
|
||||
return;
|
||||
}
|
||||
|
||||
Bluetooth_DiscardRemainingHCIEventParameters();
|
||||
} while (HCIEventHeader.EventCode != EVENT_COMMAND_COMPLETE);
|
||||
|
||||
Bluetooth_HCIProcessingState = Bluetooth_PrepareToProcessEvents;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -131,18 +131,18 @@
|
|||
214 .Letext0:
|
||||
DEFINED SYMBOLS
|
||||
*ABS*:00000000 diskio.c
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:2 *ABS*:0000003f __SREG__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:3 *ABS*:0000003e __SP_H__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:4 *ABS*:0000003d __SP_L__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:5 *ABS*:00000034 __CCP__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:6 *ABS*:00000000 __tmp_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:7 *ABS*:00000001 __zero_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:19 .text.disk_initialize:00000000 disk_initialize
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:35 .text.disk_status:00000000 disk_status
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:51 .text.disk_ioctl:00000000 disk_ioctl
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:74 .text.get_fattime:00000000 get_fattime
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:91 .text.disk_write:00000000 disk_write
|
||||
C:\Users\Dean\AppData\Local\Temp/ccUCer1P.s:122 .text.disk_read:00000000 disk_read
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:2 *ABS*:0000003f __SREG__
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:3 *ABS*:0000003e __SP_H__
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:4 *ABS*:0000003d __SP_L__
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:5 *ABS*:00000034 __CCP__
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:6 *ABS*:00000000 __tmp_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:7 *ABS*:00000001 __zero_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:19 .text.disk_initialize:00000000 disk_initialize
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:35 .text.disk_status:00000000 disk_status
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:51 .text.disk_ioctl:00000000 disk_ioctl
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:74 .text.get_fattime:00000000 get_fattime
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:91 .text.disk_write:00000000 disk_write
|
||||
C:\Users\Dean\AppData\Local\Temp/cc0EySTJ.s:122 .text.disk_read:00000000 disk_read
|
||||
|
||||
UNDEFINED SYMBOLS
|
||||
DataflashManager_WriteBlocks_RAM
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -139,7 +139,7 @@
|
|||
/ System Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _WORD_ACCESS 0 /* 0 or 1 */
|
||||
#define _WORD_ACCESS 1 /* 0 or 1 */
|
||||
/* The _WORD_ACCESS option defines which access method is used to the word
|
||||
/ data on the FAT volume.
|
||||
/
|
||||
|
|
|
@ -712,18 +712,18 @@
|
|||
772 .Letext0:
|
||||
DEFINED SYMBOLS
|
||||
*ABS*:00000000 SCSI.c
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:2 *ABS*:0000003f __SREG__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:3 *ABS*:0000003e __SP_H__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:4 *ABS*:0000003d __SP_L__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:5 *ABS*:00000034 __CCP__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:6 *ABS*:00000000 __tmp_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:7 *ABS*:00000001 __zero_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:18 .text.SCSI_Command_Inquiry:00000000 SCSI_Command_Inquiry
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:719 .data:00000024 SenseData
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:700 .data:00000000 InquiryData
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:184 .text.SCSI_Command_Request_Sense:00000000 SCSI_Command_Request_Sense
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:303 .text.SCSI_Command_ReadWrite_10:00000000 SCSI_Command_ReadWrite_10
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIi4Dyn.s:467 .text.SCSI_DecodeSCSICommand:00000000 SCSI_DecodeSCSICommand
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:2 *ABS*:0000003f __SREG__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:3 *ABS*:0000003e __SP_H__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:4 *ABS*:0000003d __SP_L__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:5 *ABS*:00000034 __CCP__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:6 *ABS*:00000000 __tmp_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:7 *ABS*:00000001 __zero_reg__
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:18 .text.SCSI_Command_Inquiry:00000000 SCSI_Command_Inquiry
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:719 .data:00000024 SenseData
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:700 .data:00000000 InquiryData
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:184 .text.SCSI_Command_Request_Sense:00000000 SCSI_Command_Request_Sense
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:303 .text.SCSI_Command_ReadWrite_10:00000000 SCSI_Command_ReadWrite_10
|
||||
C:\Users\Dean\AppData\Local\Temp/ccIJeq6j.s:467 .text.SCSI_DecodeSCSICommand:00000000 SCSI_DecodeSCSICommand
|
||||
|
||||
UNDEFINED SYMBOLS
|
||||
Endpoint_Write_Stream_LE
|
||||
|
|
|
@ -64,7 +64,7 @@ FATFS DiskFATState;
|
|||
/** FAT Fs structure to hold a FAT file handle for the log data write destination. */
|
||||
FIL TempLogFile;
|
||||
|
||||
/** Counter to count the number of 10 millisecond tick that has elapsed since the last sample */
|
||||
/** Counter to count the number of 10 millisecond ticks that has elapsed since the last sample */
|
||||
uint16_t CurrentLogTick;
|
||||
|
||||
|
||||
|
@ -73,6 +73,10 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
|
|||
if (CurrentLogTick++ != LOG_INTERVAL_10MS)
|
||||
return;
|
||||
|
||||
uint8_t LEDMask = LEDs_GetLEDs();
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
|
||||
|
||||
CurrentLogTick = 0;
|
||||
|
||||
if (USB_DeviceState == DEVICE_STATE_Unattached)
|
||||
|
@ -80,6 +84,8 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK)
|
|||
f_printf(&TempLogFile, "%d Degrees\r\n", Temperature_GetTemperature());
|
||||
f_sync(&TempLogFile);
|
||||
}
|
||||
|
||||
LEDs_SetAllLEDs(LEDMask);
|
||||
}
|
||||
|
||||
|
||||
|
@ -96,10 +102,11 @@ int main(void)
|
|||
f_mount(0, &DiskFATState);
|
||||
f_open(&TempLogFile, LOG_FILENAME, FA_OPEN_ALWAYS | FA_WRITE);
|
||||
f_lseek(&TempLogFile, TempLogFile.fsize);
|
||||
|
||||
/* Write out the log seperator line */
|
||||
f_printf(&TempLogFile, "===========================\r\n");
|
||||
Temperature_GetTemperature(); // Discard first temperature reading to ensure accuracy
|
||||
|
||||
/* Discard the first sample from the temperature sensor, as it is generally incorrect */
|
||||
uint8_t Dummy = Temperature_GetTemperature();
|
||||
(void)Dummy;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -128,8 +135,7 @@ void SetupHardware(void)
|
|||
|
||||
/* 10ms interval timer configuration */
|
||||
OCR1A = (((F_CPU / 1024) / 100) - 1);
|
||||
TCCR1A = (1 << WGM01); // CTC mode
|
||||
TCCR1B = (1 << CS12) | (1 << CS10); // Fcpu/1024 speed
|
||||
TCCR1B = (1 << WGM12) | (1 << CS12) | (1 << CS10); // CTC mode, Fcpu/1024 speed
|
||||
TIMSK1 = (1 << OCIE1A);
|
||||
|
||||
/* Clear Dataflash sector protections, if enabled */
|
||||
|
@ -154,6 +160,7 @@ void EVENT_USB_Device_Disconnect(void)
|
|||
f_mount(0, &DiskFATState);
|
||||
f_open(&TempLogFile, LOG_FILENAME, FA_OPEN_ALWAYS | FA_WRITE);
|
||||
f_lseek(&TempLogFile, TempLogFile.fsize);
|
||||
f_printf(&TempLogFile, "===========================\r\n");
|
||||
}
|
||||
|
||||
/** Event handler for the library USB Configuration Changed event. */
|
||||
|
|
Loading…
Reference in New Issue