diff options
author | skullydazed <skullydazed@users.noreply.github.com> | 2019-07-07 10:59:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-07 10:59:58 -0700 |
commit | 04a7f66421ac141a8927491fa61e4f8e425accad (patch) | |
tree | 027bafce1cd12c31e84a758bea24d5fdb78226cb /Projects/TempDataLogger | |
parent | d0fd80affba97b37eb00c650e87cb5982a4f260e (diff) | |
parent | 57edb9b0976fad82bfd0384b16c6c3269e0d19ce (diff) | |
download | lufa-04a7f66421ac141a8927491fa61e4f8e425accad.tar.gz lufa-04a7f66421ac141a8927491fa61e4f8e425accad.tar.bz2 lufa-04a7f66421ac141a8927491fa61e4f8e425accad.zip |
Merge pull request #2 from drashna/master
Update LUFA repo from upstream
Diffstat (limited to 'Projects/TempDataLogger')
-rw-r--r-- | Projects/TempDataLogger/Config/AppConfig.h | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/Config/LUFAConfig.h | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/Descriptors.c | 6 | ||||
-rw-r--r-- | Projects/TempDataLogger/Descriptors.h | 2 | ||||
-rw-r--r-- | Projects/TempDataLogger/Lib/DataflashManager.c | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/Lib/DataflashManager.h | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/Lib/RTC.c | 2 | ||||
-rw-r--r-- | Projects/TempDataLogger/Lib/RTC.h | 2 | ||||
-rw-r--r-- | Projects/TempDataLogger/Lib/SCSI.c | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/Lib/SCSI.h | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/TempDataLogger.c | 10 | ||||
-rw-r--r-- | Projects/TempDataLogger/TempDataLogger.h | 4 | ||||
-rw-r--r-- | Projects/TempDataLogger/TempLogHostApp_Python/temp_log_config.py | 51 | ||||
-rw-r--r-- | Projects/TempDataLogger/makefile | 2 |
14 files changed, 49 insertions, 54 deletions
diff --git a/Projects/TempDataLogger/Config/AppConfig.h b/Projects/TempDataLogger/Config/AppConfig.h index fcfcb2590..c4e5537bd 100644 --- a/Projects/TempDataLogger/Config/AppConfig.h +++ b/Projects/TempDataLogger/Config/AppConfig.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/Config/LUFAConfig.h b/Projects/TempDataLogger/Config/LUFAConfig.h index f7d7e6270..2b2d341d4 100644 --- a/Projects/TempDataLogger/Config/LUFAConfig.h +++ b/Projects/TempDataLogger/Config/LUFAConfig.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/Descriptors.c b/Projects/TempDataLogger/Descriptors.c index c07a58878..838278db5 100644 --- a/Projects/TempDataLogger/Descriptors.c +++ b/Projects/TempDataLogger/Descriptors.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -189,7 +189,7 @@ const USB_Descriptor_String_t PROGMEM LanguageString = USB_STRING_DESCRIPTOR_ARR * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ -const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera"); +const USB_Descriptor_String_t PROGMEM ManufacturerString = USB_STRING_DESCRIPTOR(L"LUFA Library"); /** Product descriptor string. This is a Unicode string containing the product's details in human readable form, * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device diff --git a/Projects/TempDataLogger/Descriptors.h b/Projects/TempDataLogger/Descriptors.h index ffbd65d46..53ee25ddd 100644 --- a/Projects/TempDataLogger/Descriptors.h +++ b/Projects/TempDataLogger/Descriptors.h @@ -1,6 +1,6 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org diff --git a/Projects/TempDataLogger/Lib/DataflashManager.c b/Projects/TempDataLogger/Lib/DataflashManager.c index b1111ce39..f21e61dd4 100644 --- a/Projects/TempDataLogger/Lib/DataflashManager.c +++ b/Projects/TempDataLogger/Lib/DataflashManager.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/Lib/DataflashManager.h b/Projects/TempDataLogger/Lib/DataflashManager.h index f0feeb67b..b9ac0ba9d 100644 --- a/Projects/TempDataLogger/Lib/DataflashManager.h +++ b/Projects/TempDataLogger/Lib/DataflashManager.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/Lib/RTC.c b/Projects/TempDataLogger/Lib/RTC.c index a5291eaf3..a251a58f9 100644 --- a/Projects/TempDataLogger/Lib/RTC.c +++ b/Projects/TempDataLogger/Lib/RTC.c @@ -1,5 +1,5 @@ /* - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org diff --git a/Projects/TempDataLogger/Lib/RTC.h b/Projects/TempDataLogger/Lib/RTC.h index f35b8ff1e..bcb720b37 100644 --- a/Projects/TempDataLogger/Lib/RTC.h +++ b/Projects/TempDataLogger/Lib/RTC.h @@ -1,5 +1,5 @@ /* - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org diff --git a/Projects/TempDataLogger/Lib/SCSI.c b/Projects/TempDataLogger/Lib/SCSI.c index 4fbbfd60e..a02c10b99 100644 --- a/Projects/TempDataLogger/Lib/SCSI.c +++ b/Projects/TempDataLogger/Lib/SCSI.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/Lib/SCSI.h b/Projects/TempDataLogger/Lib/SCSI.h index 494b31bf8..e57e2d706 100644 --- a/Projects/TempDataLogger/Lib/SCSI.h +++ b/Projects/TempDataLogger/Lib/SCSI.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c index 1dc267a6f..463098bd6 100644 --- a/Projects/TempDataLogger/TempDataLogger.c +++ b/Projects/TempDataLogger/TempDataLogger.c @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted @@ -125,7 +125,7 @@ ISR(TIMER1_COMPA_vect, ISR_BLOCK) char LineBuffer[100]; uint16_t BytesWritten; - BytesWritten = sprintf(LineBuffer, "%02d/%02d/20%02d, %02d:%02d:%02d, %d Degrees\r\n", + BytesWritten = snprintf(LineBuffer, sizeof(LineBuffer), "%02d/%02d/20%02d, %02d:%02d:%02d, %d Degrees\r\n", CurrentTimeDate.Day, CurrentTimeDate.Month, CurrentTimeDate.Year, CurrentTimeDate.Hour, CurrentTimeDate.Minute, CurrentTimeDate.Second, Temperature_GetTemperature()); @@ -168,12 +168,12 @@ int main(void) /** Opens the log file on the Dataflash's FAT formatted partition according to the current date */ void OpenLogFile(void) { - char LogFileName[12]; + char LogFileName[16]; /* Get the current date for the filename as "DDMMYY.csv" */ TimeDate_t CurrentTimeDate; RTC_GetTimeDate(&CurrentTimeDate); - sprintf(LogFileName, "%02d%02d%02d.csv", CurrentTimeDate.Day, CurrentTimeDate.Month, CurrentTimeDate.Year); + snprintf(LogFileName, sizeof(LogFileName), "%02d%02d%02d.csv", CurrentTimeDate.Day, CurrentTimeDate.Month, CurrentTimeDate.Year); /* Mount the storage device, open the file */ f_mount(0, &DiskFATState); diff --git a/Projects/TempDataLogger/TempDataLogger.h b/Projects/TempDataLogger/TempDataLogger.h index 90b9b4ea6..b62d25bdb 100644 --- a/Projects/TempDataLogger/TempDataLogger.h +++ b/Projects/TempDataLogger/TempDataLogger.h @@ -1,13 +1,13 @@ /* LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* - Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com) + Copyright 2019 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted diff --git a/Projects/TempDataLogger/TempLogHostApp_Python/temp_log_config.py b/Projects/TempDataLogger/TempLogHostApp_Python/temp_log_config.py index fdb4ad9b6..f769b04c8 100644 --- a/Projects/TempDataLogger/TempLogHostApp_Python/temp_log_config.py +++ b/Projects/TempDataLogger/TempLogHostApp_Python/temp_log_config.py @@ -1,6 +1,8 @@ +#!/usr/bin/env python + """ LUFA Library - Copyright (C) Dean Camera, 2017. + Copyright (C) Dean Camera, 2019. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org @@ -25,44 +27,41 @@ import sys from datetime import datetime -import pywinusb.hid as hid - -# Generic HID device VID, PID and report payload length (length is increased -# by one to account for the Report ID byte that must be pre-pended) -device_vid = 0x03EB -device_pid = 0x2063 -report_length = 1 + 7 +import hid def get_hid_device_handle(): - hid_device_filter = hid.HidDeviceFilter(vendor_id=device_vid, - product_id=device_pid) + all_hid_devices = hid.enumerate() - valid_hid_devices = hid_device_filter.get_devices() + lufa_hid_devices = [d for d in all_hid_devices if d['vendor_id'] == 0x03EB and d['product_id'] == 0x2063] - if len(valid_hid_devices) is 0: + if len(lufa_hid_devices) is 0: return None - else: - return valid_hid_devices[0] + + device_handle = hid.device() + device_handle.open_path(lufa_hid_devices[0]['path']) + return device_handle def configure_temp_log_device(device, time_date, log_interval_500ms): + report_data = bytearray(8) + # Report data for the demo is the report ID (always zero) - report_data = [0] + report_data[0] = 0 # Followed by the time/date data - report_data.extend([time_date.hour, time_date.minute, - time_date.second, time_date.day, - time_date.month, time_date.year - 2000]) + report_data[1] = time_date.hour + report_data[2] = time_date.minute, + report_data[3] = time_date.second + report_data[4] = time_date.day, + report_data[5] = time_date.month + report_data[6] = time_date.year - 2000 # Lastly the log interval in 500ms units of time - report_data.extend([log_interval_500ms]) - - # Zero-extend the array to the length the report should be - report_data.extend([0] * (report_length - len(report_data))) + report_data[7] = log_interval_500ms # Send the generated report to the device - device.send_output_report(report_data) + device.write(report_data) def main(time_date, log_interval_500ms): @@ -73,11 +72,7 @@ def main(time_date, log_interval_500ms): sys.exit(1) try: - hid_device.open() - - print("Connected to device 0x%04X/0x%04X - %s [%s]" % - (hid_device.vendor_id, hid_device.product_id, - hid_device.product_name, hid_device.vendor_name)) + print("Connected to device.", flush=True) configure_temp_log_device(hid_device, time_date, log_interval_500ms) diff --git a/Projects/TempDataLogger/makefile b/Projects/TempDataLogger/makefile index fea6fea91..13d5cf5e6 100644 --- a/Projects/TempDataLogger/makefile +++ b/Projects/TempDataLogger/makefile @@ -1,6 +1,6 @@ # # LUFA Library -# Copyright (C) Dean Camera, 2017. +# Copyright (C) Dean Camera, 2019. # # dean [at] fourwalledcubicle [dot] com # www.lufa-lib.org |