mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 18:55:13 +03:00
Modified VID/PID for working in mustdie
This commit is contained in:
parent
20e9313664
commit
5c9cf855af
@ -19,7 +19,7 @@ To get precision time this tool use GPS module (NEO-6M)
|
|||||||
|
|
||||||
#### Connection diagram
|
#### Connection diagram
|
||||||
| Pin | Function |
|
| Pin | Function |
|
||||||
| :-: |:-|
|
| :--: | :-------- |
|
||||||
| PA0 | Infrared sensor data |
|
| PA0 | Infrared sensor data |
|
||||||
| PA1 | Laser photoresistor data |
|
| PA1 | Laser photoresistor data |
|
||||||
| PA2 | GPS Rx (MCU Tx) |
|
| PA2 | GPS Rx (MCU Tx) |
|
||||||
@ -27,7 +27,7 @@ To get precision time this tool use GPS module (NEO-6M)
|
|||||||
| PA4 | GPS PPS signal |
|
| PA4 | GPS PPS signal |
|
||||||
| PA5 | Trigger (button) switch |
|
| PA5 | Trigger (button) switch |
|
||||||
| PB10 | Ultrasonic "TRIG" pin |
|
| PB10 | Ultrasonic "TRIG" pin |
|
||||||
| PB11 | Ultrasonic "ECHO" pin|
|
| PB11 | Ultrasonic "ECHO" pin |
|
||||||
|
|
||||||
#### Powering devices
|
#### Powering devices
|
||||||
* To power up GPS module you can use +5V or +3.3V.
|
* To power up GPS module you can use +5V or +3.3V.
|
||||||
|
|||||||
@ -64,7 +64,7 @@ int main(void){
|
|||||||
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
rcc_clock_setup_in_hse_8mhz_out_72mhz();
|
||||||
// init systick (1ms)
|
// init systick (1ms)
|
||||||
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8); // Systyck: 72/8=9MHz
|
systick_set_clocksource(STK_CSR_CLKSOURCE_AHB_DIV8); // Systyck: 72/8=9MHz
|
||||||
systick_set_reload(8999); // 9000 pulses: 1kHz
|
systick_set_reload(STK_RVR_DEFAULT_VAL); // 9000 pulses: 1kHz
|
||||||
systick_interrupt_enable();
|
systick_interrupt_enable();
|
||||||
systick_counter_enable();
|
systick_counter_enable();
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ int main(void){
|
|||||||
GPS_parse_answer(string);
|
GPS_parse_answer(string);
|
||||||
}
|
}
|
||||||
if(trigger_ms != DIDNT_TRIGGERED && trigger_ms != Timer){
|
if(trigger_ms != DIDNT_TRIGGERED && trigger_ms != Timer){
|
||||||
if(msctr - trigrtm > 500 || trigrtm > msctr){
|
if(msctr - trigrtm > TRIGGER_DEBOUNCE_DELAY || trigrtm > msctr){
|
||||||
trigrtm = msctr;
|
trigrtm = msctr;
|
||||||
P("Trigger time: ");
|
P("Trigger time: ");
|
||||||
print_time(&trigger_time, trigger_ms);
|
print_time(&trigger_time, trigger_ms);
|
||||||
@ -107,7 +107,7 @@ int main(void){
|
|||||||
}
|
}
|
||||||
for(i = 0; i < ADC_CHANNEL_NUMBER; ++i){
|
for(i = 0; i < ADC_CHANNEL_NUMBER; ++i){
|
||||||
if(adc_ms[i] != DIDNT_TRIGGERED && adc_ms[i] != Timer){
|
if(adc_ms[i] != DIDNT_TRIGGERED && adc_ms[i] != Timer){
|
||||||
if(msctr - adctm[i] > 500 || adctm[i] > msctr){
|
if(msctr - adctm[i] > ADC_DEBOUNCE_DELAY || adctm[i] > msctr){
|
||||||
adctm[i] = msctr;
|
adctm[i] = msctr;
|
||||||
P("ADC");
|
P("ADC");
|
||||||
put_char_to_buf('0'+i);
|
put_char_to_buf('0'+i);
|
||||||
@ -125,7 +125,7 @@ int main(void){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ultrasonic_ms != DIDNT_TRIGGERED && ultrasonic_ms != Timer){
|
if(ultrasonic_ms != DIDNT_TRIGGERED && ultrasonic_ms != Timer){
|
||||||
if(msctr - ultrasonictm > 500 || ultrasonictm > msctr){
|
if(msctr - ultrasonictm > ULTRASONIC_DEBOUNCE_DELAY || ultrasonictm > msctr){
|
||||||
ultrasonictm = msctr;
|
ultrasonictm = msctr;
|
||||||
P("Ultrasonic time: ");
|
P("Ultrasonic time: ");
|
||||||
print_time(&ultrasonic_time, ultrasonic_ms);
|
print_time(&ultrasonic_time, ultrasonic_ms);
|
||||||
|
|||||||
@ -50,6 +50,14 @@ extern void *memcpy(void *dest, const void *src, int n);
|
|||||||
|
|
||||||
#define DIDNT_TRIGGERED (2000)
|
#define DIDNT_TRIGGERED (2000)
|
||||||
|
|
||||||
|
// debounce delays:
|
||||||
|
// Trigger (button) - 500ms
|
||||||
|
#define TRIGGER_DEBOUNCE_DELAY (500)
|
||||||
|
// ADC debounce - 1000ms
|
||||||
|
#define ADC_DEBOUNCE_DELAY (1000)
|
||||||
|
// ultrasonic - 1500ms
|
||||||
|
#define ULTRASONIC_DEBOUNCE_DELAY (1500)
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
uint8_t H;
|
uint8_t H;
|
||||||
uint8_t M;
|
uint8_t M;
|
||||||
|
|||||||
Binary file not shown.
@ -37,9 +37,9 @@ const struct usb_device_descriptor dev = {
|
|||||||
.bDeviceSubClass = 0,
|
.bDeviceSubClass = 0,
|
||||||
.bDeviceProtocol = 0,
|
.bDeviceProtocol = 0,
|
||||||
.bMaxPacketSize0 = 64,
|
.bMaxPacketSize0 = 64,
|
||||||
// 0x03EB 0x2042 - Atmel Keyboard Demo Application
|
// 0x045E 0x005C - Microsoft Office Keyboard (106/109)
|
||||||
.idVendor = 0x03EB,
|
.idVendor = 0x045E,
|
||||||
.idProduct = 0x2042,
|
.idProduct = 0x005C,
|
||||||
.bcdDevice = 0x0200,
|
.bcdDevice = 0x0200,
|
||||||
.iManufacturer = 1,
|
.iManufacturer = 1,
|
||||||
.iProduct = 2,
|
.iProduct = 2,
|
||||||
@ -154,7 +154,7 @@ const struct usb_config_descriptor config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const char *usb_strings[] = {
|
static const char *usb_strings[] = {
|
||||||
"Simple matrix keyboard 3x4",
|
"Timelapse keyboard",
|
||||||
"EEV",
|
"EEV",
|
||||||
"v01",
|
"v01",
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user