From 9e304182077039afa86f170482f63657053bed7b Mon Sep 17 00:00:00 2001 From: Masatake Aoki Date: Thu, 6 Jun 2024 17:11:20 +0900 Subject: [PATCH 1/2] Fixed due to esp32 package 3.0.1 update --- uROS_STEP10_tfMsg/interrupt.ino | 2 +- uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino | 30 ++++---- .../uROS_STEP11_SensorMsg.ino | 10 +-- uROS_STEP12_micromouse/SPIFFS.ino | 2 +- uROS_STEP12_micromouse/adjust.ino | 2 +- uROS_STEP12_micromouse/device.h | 1 - uROS_STEP12_micromouse/device.ino | 75 +++++++++---------- uROS_STEP12_micromouse/fast.ino | 2 +- uROS_STEP12_micromouse/interrupt.ino | 2 +- uROS_STEP12_micromouse/map_manager.ino | 2 +- uROS_STEP12_micromouse/microROS.ino | 2 +- uROS_STEP12_micromouse/misc.ino | 2 +- uROS_STEP12_micromouse/run.ino | 2 +- uROS_STEP12_micromouse/search.ino | 2 +- .../uROS_STEP12_micromouse.ino | 2 +- uROS_STEP1_LED/uROS_STEP1_LED.ino | 2 +- uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino | 2 +- uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino | 35 +++++---- uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino | 10 +-- uROS_STEP5_Straight/interrupt.ino | 2 +- uROS_STEP5_Straight/run.ino | 2 +- uROS_STEP5_Straight/uROS_STEP5_Straight.ino | 30 ++++---- uROS_STEP6_rotate/interrupt.ino | 2 +- uROS_STEP6_rotate/run.ino | 2 +- uROS_STEP6_rotate/uROS_STEP6_rotate.ino | 30 ++++---- uROS_STEP7_P_control/interrupt.ino | 2 +- uROS_STEP7_P_control/run.ino | 2 +- uROS_STEP7_P_control/uROS_STEP7_P_control.ino | 44 +++++------ uROS_STEP8_micromouse/SPIFFS.ino | 2 +- uROS_STEP8_micromouse/adjust.ino | 2 +- uROS_STEP8_micromouse/device.h | 2 - uROS_STEP8_micromouse/device.ino | 63 ++++++++-------- uROS_STEP8_micromouse/fast.ino | 2 +- uROS_STEP8_micromouse/interrupt.ino | 2 +- uROS_STEP8_micromouse/map_manager.ino | 2 +- uROS_STEP8_micromouse/misc.ino | 2 +- uROS_STEP8_micromouse/run.ino | 2 +- uROS_STEP8_micromouse/search.ino | 2 +- .../uROS_STEP8_micromouse.ino | 2 +- uROS_STEP9_twistMsg/interrupt.ino | 2 +- uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino | 30 ++++---- 41 files changed, 204 insertions(+), 214 deletions(-) diff --git a/uROS_STEP10_tfMsg/interrupt.ino b/uROS_STEP10_tfMsg/interrupt.ino index db076ae..0f0e6bb 100644 --- a/uROS_STEP10_tfMsg/interrupt.ino +++ b/uROS_STEP10_tfMsg/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino b/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino index fa90d05..9bed5e0 100644 --- a/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino +++ b/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -136,7 +136,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -153,7 +153,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -201,20 +201,20 @@ void setup() delay(2000); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); g_allocator = rcl_get_default_allocator(); diff --git a/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino b/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino index 4d36b25..a064bfc 100644 --- a/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino +++ b/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -163,10 +163,10 @@ void setup() delay(2000); - g_timer1 = timerBegin(1, 80, true); //1us - timerAttachInterrupt(g_timer1, &onTimer1, true); - timerAlarmWrite(g_timer1, 250, true); //4kHz - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); //4kHz + timerStart(g_timer1); g_allocator = rcl_get_default_allocator(); diff --git a/uROS_STEP12_micromouse/SPIFFS.ino b/uROS_STEP12_micromouse/SPIFFS.ino index 3a8e044..6bee69a 100644 --- a/uROS_STEP12_micromouse/SPIFFS.ino +++ b/uROS_STEP12_micromouse/SPIFFS.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/adjust.ino b/uROS_STEP12_micromouse/adjust.ino index b0133f2..f57bae2 100644 --- a/uROS_STEP12_micromouse/adjust.ino +++ b/uROS_STEP12_micromouse/adjust.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/device.h b/uROS_STEP12_micromouse/device.h index 8dddc49..1dd901b 100644 --- a/uROS_STEP12_micromouse/device.h +++ b/uROS_STEP12_micromouse/device.h @@ -36,6 +36,5 @@ #define SW_CM 2 #define SW_RM 4 -#define BUZZER_CH 0 #endif // DEVICE_H_ \ No newline at end of file diff --git a/uROS_STEP12_micromouse/device.ino b/uROS_STEP12_micromouse/device.ino index 61ed13b..651c377 100644 --- a/uROS_STEP12_micromouse/device.ino +++ b/uROS_STEP12_micromouse/device.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -76,7 +76,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -87,21 +87,21 @@ void IRAM_ATTR isrL(void) portEXIT_CRITICAL_ISR(&g_timer_mux); } -void controlInterruptStart(void) { timerAlarmEnable(g_timer0); } -void controlInterruptStop(void) { timerAlarmDisable(g_timer0); } +void controlInterruptStart(void) { timerStart(g_timer0); } +void controlInterruptStop(void) { timerStop(g_timer0); } -void sensorInterruptStart(void) { timerAlarmEnable(g_timer1); } -void sensorInterruptStop(void) { timerAlarmDisable(g_timer1); } +void sensorInterruptStart(void) { timerStart(g_timer1); } +void sensorInterruptStop(void) { timerStop(g_timer1); } void PWMInterruptStart(void) { - timerAlarmEnable(g_timer2); - timerAlarmEnable(g_timer3); + timerStart(g_timer2); + timerStart(g_timer3); } void PWMInterruptStop(void) { - timerAlarmDisable(g_timer2); - timerAlarmDisable(g_timer3); + timerStop(g_timer2); + timerStop(g_timer3); } void initDevice(void) @@ -118,9 +118,8 @@ void initDevice(void) pinMode(SW_C, INPUT); pinMode(SW_R, INPUT); - ledcSetup(0, 440, 10); - ledcAttachPin(BUZZER, 0); - ledcWrite(0, 1024); + ledcAttach(BUZZER, 440, 10); + ledcWrite(BUZZER, 1024); pinMode(SLED_FR, OUTPUT); pinMode(SLED_FL, OUTPUT); @@ -149,25 +148,25 @@ void initDevice(void) } } - g_timer0 = timerBegin(0, 80, true); - timerAttachInterrupt(g_timer0, &onTimer0, false); - timerAlarmWrite(g_timer0, 1000, true); - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); + timerStart(g_timer0); - g_timer1 = timerBegin(1, 80, true); - timerAttachInterrupt(g_timer1, &onTimer1, true); - timerAlarmWrite(g_timer1, 500, true); - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 500, true, 0); + timerStart(g_timer1); - g_timer2 = timerBegin(2, 40, true); - timerAttachInterrupt(g_timer2, &isrR, false); - timerAlarmWrite(g_timer2, 13333, true); - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); - timerAttachInterrupt(g_timer3, &isrL, false); - timerAlarmWrite(g_timer3, 13333, true); - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); + timerStart(g_timer3); Serial.begin(115200); @@ -199,10 +198,10 @@ void setBLED(char data) } //Buzzer -void enableBuzzer(short f) { ledcWriteTone(BUZZER_CH, f); } +void enableBuzzer(short f) { ledcWriteTone(BUZZER, f); } void disableBuzzer(void) { - ledcWrite(BUZZER_CH, 1024); //duty 100% Buzzer OFF + ledcWrite(BUZZER, 1024); //duty 100% Buzzer OFF } //motor @@ -266,8 +265,7 @@ unsigned short getSensorR(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD3); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_5); + unsigned short tmp = analogRead(AD3); digitalWrite(SLED_R, LOW); return tmp; } @@ -277,8 +275,7 @@ unsigned short getSensorL(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD4); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_6); + unsigned short tmp = analogRead(AD4); digitalWrite(SLED_L, LOW); return tmp; } @@ -288,8 +285,7 @@ unsigned short getSensorFL(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD2); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_4); + unsigned short tmp = analogRead(AD2); digitalWrite(SLED_FL, LOW); //LED消灯 return tmp; } @@ -299,8 +295,7 @@ unsigned short getSensorFR(void) for (int i = 0; i < WAITLOOP_SLED; i++) { asm("nop \n"); } - // unsigned short tmp = analogRead(AD1); - unsigned short tmp = adc1_get_raw(ADC1_CHANNEL_3); + unsigned short tmp = analogRead(AD1); digitalWrite(SLED_FR, LOW); return tmp; } diff --git a/uROS_STEP12_micromouse/fast.ino b/uROS_STEP12_micromouse/fast.ino index 8981c34..28669ff 100644 --- a/uROS_STEP12_micromouse/fast.ino +++ b/uROS_STEP12_micromouse/fast.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/interrupt.ino b/uROS_STEP12_micromouse/interrupt.ino index f8fde48..9bd3b69 100644 --- a/uROS_STEP12_micromouse/interrupt.ino +++ b/uROS_STEP12_micromouse/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/map_manager.ino b/uROS_STEP12_micromouse/map_manager.ino index 809711d..9437fab 100644 --- a/uROS_STEP12_micromouse/map_manager.ino +++ b/uROS_STEP12_micromouse/map_manager.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/microROS.ino b/uROS_STEP12_micromouse/microROS.ino index 68108a7..6e67e37 100644 --- a/uROS_STEP12_micromouse/microROS.ino +++ b/uROS_STEP12_micromouse/microROS.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/misc.ino b/uROS_STEP12_micromouse/misc.ino index e59de6d..f1f714d 100644 --- a/uROS_STEP12_micromouse/misc.ino +++ b/uROS_STEP12_micromouse/misc.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/run.ino b/uROS_STEP12_micromouse/run.ino index f93cdcd..7d53828 100644 --- a/uROS_STEP12_micromouse/run.ino +++ b/uROS_STEP12_micromouse/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/search.ino b/uROS_STEP12_micromouse/search.ino index 2895011..d36d5e1 100644 --- a/uROS_STEP12_micromouse/search.ino +++ b/uROS_STEP12_micromouse/search.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino b/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino index e2392a2..f8afc7e 100644 --- a/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino +++ b/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP1_LED/uROS_STEP1_LED.ino b/uROS_STEP1_LED/uROS_STEP1_LED.ino index d9dbb4c..64b57a4 100644 --- a/uROS_STEP1_LED/uROS_STEP1_LED.ino +++ b/uROS_STEP1_LED/uROS_STEP1_LED.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino b/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino index fb762fc..c7760d3 100644 --- a/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino +++ b/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino b/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino index 048f15f..0abbf9f 100644 --- a/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino +++ b/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -60,22 +60,22 @@ void execByMode(char mode) { switch (mode) { case 1: - ledcWriteTone(0, FREQ_C); + ledcWriteTone(BUZZER, FREQ_C); delay(1000); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; case 2: - ledcWriteTone(0, FREQ_D); + ledcWriteTone(BUZZER, FREQ_D); delay(1000); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; case 3: - ledcWriteTone(0, FREQ_E); + ledcWriteTone(BUZZER, FREQ_E); delay(1000); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; default: - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); break; } } @@ -92,9 +92,8 @@ void setup() pinMode(SW_C, INPUT); pinMode(SW_R, INPUT); - ledcSetup(0, 440, 10); - ledcAttachPin(BUZZER, 0); - ledcWrite(0, 1024); + ledcAttach(BUZZER, 440, 10); + ledcWrite(BUZZER, 1024); g_mode = 1; setLED(g_mode); @@ -111,9 +110,9 @@ void loop() if (g_mode > 15) { g_mode = 15; } else { - ledcWriteTone(0, INC_FREQ); + ledcWriteTone(BUZZER, INC_FREQ); delay(30); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); } setLED(g_mode); } @@ -122,18 +121,18 @@ void loop() if (g_mode < 1) { g_mode = 1; } else { - ledcWriteTone(0, DEC_FREQ); + ledcWriteTone(BUZZER, DEC_FREQ); delay(30); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); } setLED(g_mode); } if (digitalRead(SW_C) == 0) { - ledcWriteTone(0, INC_FREQ); + ledcWriteTone(BUZZER, INC_FREQ); delay(80); - ledcWriteTone(0, DEC_FREQ); + ledcWriteTone(BUZZER, DEC_FREQ); delay(80); - ledcWrite(0, 1024); + ledcWrite(BUZZER, 1024); delay(300); execByMode(g_mode); } diff --git a/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino b/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino index a5454e5..27e8879 100644 --- a/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino +++ b/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -94,10 +94,10 @@ void setup() Serial.begin(115200); - g_timer1 = timerBegin(1, 80, true); //1us - timerAttachInterrupt(g_timer1, &onTimer1, true); - timerAlarmWrite(g_timer1, 250, true); //4kHz - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); //4kHz + timerStart(g_timer1); } void loop() diff --git a/uROS_STEP5_Straight/interrupt.ino b/uROS_STEP5_Straight/interrupt.ino index 8d9e922..114ae10 100644 --- a/uROS_STEP5_Straight/interrupt.ino +++ b/uROS_STEP5_Straight/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP5_Straight/run.ino b/uROS_STEP5_Straight/run.ino index 55715d4..3bd137d 100644 --- a/uROS_STEP5_Straight/run.ino +++ b/uROS_STEP5_Straight/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP5_Straight/uROS_STEP5_Straight.ino b/uROS_STEP5_Straight/uROS_STEP5_Straight.ino index 6c77f5a..0cda8a1 100644 --- a/uROS_STEP5_Straight/uROS_STEP5_Straight.ino +++ b/uROS_STEP5_Straight/uROS_STEP5_Straight.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ void IRAM_ATTR isrR(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -79,7 +79,7 @@ void IRAM_ATTR isrL(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -115,20 +115,20 @@ void setup() digitalWrite(PWM_R, LOW); digitalWrite(PWM_L, LOW); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); } void loop() diff --git a/uROS_STEP6_rotate/interrupt.ino b/uROS_STEP6_rotate/interrupt.ino index 8d9e922..114ae10 100644 --- a/uROS_STEP6_rotate/interrupt.ino +++ b/uROS_STEP6_rotate/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP6_rotate/run.ino b/uROS_STEP6_rotate/run.ino index 3b25a88..2ee3103 100644 --- a/uROS_STEP6_rotate/run.ino +++ b/uROS_STEP6_rotate/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP6_rotate/uROS_STEP6_rotate.ino b/uROS_STEP6_rotate/uROS_STEP6_rotate.ino index a4d6ff6..2ce0901 100644 --- a/uROS_STEP6_rotate/uROS_STEP6_rotate.ino +++ b/uROS_STEP6_rotate/uROS_STEP6_rotate.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ void IRAM_ATTR isrR(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -88,7 +88,7 @@ void IRAM_ATTR isrL(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -124,20 +124,20 @@ void setup() digitalWrite(PWM_R, LOW); digitalWrite(PWM_L, LOW); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); } void loop() diff --git a/uROS_STEP7_P_control/interrupt.ino b/uROS_STEP7_P_control/interrupt.ino index 61b6ec4..49579b0 100644 --- a/uROS_STEP7_P_control/interrupt.ino +++ b/uROS_STEP7_P_control/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP7_P_control/run.ino b/uROS_STEP7_P_control/run.ino index 55715d4..3bd137d 100644 --- a/uROS_STEP7_P_control/run.ino +++ b/uROS_STEP7_P_control/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP7_P_control/uROS_STEP7_P_control.ino b/uROS_STEP7_P_control/uROS_STEP7_P_control.ino index cfeefa0..183cd65 100644 --- a/uROS_STEP7_P_control/uROS_STEP7_P_control.ino +++ b/uROS_STEP7_P_control/uROS_STEP7_P_control.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -127,7 +127,7 @@ void IRAM_ATTR isrR(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -143,7 +143,7 @@ void IRAM_ATTR isrL(void) { portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -190,25 +190,25 @@ void setup() Serial.begin(115200); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); - - g_timer1 = timerBegin(1, 80, true); - timerAttachInterrupt(g_timer1, &onTimer1, false); - timerAlarmWrite(g_timer1, 250, true); - timerAlarmEnable(g_timer1); - - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); - - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); + + g_timer1 = timerBegin(1000000); + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); + timerStart(g_timer1); + + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); + + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); g_sen_r.ref = REF_SEN_R; g_sen_l.ref = REF_SEN_L; diff --git a/uROS_STEP8_micromouse/SPIFFS.ino b/uROS_STEP8_micromouse/SPIFFS.ino index 3a8e044..6bee69a 100644 --- a/uROS_STEP8_micromouse/SPIFFS.ino +++ b/uROS_STEP8_micromouse/SPIFFS.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/adjust.ino b/uROS_STEP8_micromouse/adjust.ino index 234775e..11769b9 100644 --- a/uROS_STEP8_micromouse/adjust.ino +++ b/uROS_STEP8_micromouse/adjust.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/device.h b/uROS_STEP8_micromouse/device.h index 8dddc49..b48bbbb 100644 --- a/uROS_STEP8_micromouse/device.h +++ b/uROS_STEP8_micromouse/device.h @@ -36,6 +36,4 @@ #define SW_CM 2 #define SW_RM 4 -#define BUZZER_CH 0 - #endif // DEVICE_H_ \ No newline at end of file diff --git a/uROS_STEP8_micromouse/device.ino b/uROS_STEP8_micromouse/device.ino index 821e6db..ec56717 100644 --- a/uROS_STEP8_micromouse/device.ino +++ b/uROS_STEP8_micromouse/device.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -69,7 +69,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -80,21 +80,21 @@ void IRAM_ATTR isrL(void) portEXIT_CRITICAL_ISR(&g_timer_mux); } -void controlInterruptStart(void) { timerAlarmEnable(g_timer0); } -void controlInterruptStop(void) { timerAlarmDisable(g_timer0); } +void controlInterruptStart(void) { timerStart(g_timer0); } +void controlInterruptStop(void) { timerStop(g_timer0); } -void sensorInterruptStart(void) { timerAlarmEnable(g_timer1); } -void sensorInterruptStop(void) { timerAlarmDisable(g_timer1); } +void sensorInterruptStart(void) { timerStart(g_timer1); } +void sensorInterruptStop(void) { timerStop(g_timer1); } void PWMInterruptStart(void) { - timerAlarmEnable(g_timer2); - timerAlarmEnable(g_timer3); + timerStart(g_timer2); + timerStart(g_timer3); } void PWMInterruptStop(void) { - timerAlarmDisable(g_timer2); - timerAlarmDisable(g_timer3); + timerStop(g_timer2); + timerStop(g_timer3); } void initAll(void) @@ -111,9 +111,8 @@ void initAll(void) pinMode(SW_C, INPUT); pinMode(SW_R, INPUT); - ledcSetup(0, 440, 10); - ledcAttachPin(BUZZER, 0); - ledcWrite(0, 1024); + ledcAttach(BUZZER, 440, 10); + ledcWrite(BUZZER, 1024); pinMode(SLED_FR, OUTPUT); pinMode(SLED_FL, OUTPUT); @@ -142,25 +141,25 @@ void initAll(void) } } - g_timer0 = timerBegin(0, 80, true); - timerAttachInterrupt(g_timer0, &onTimer0, false); - timerAlarmWrite(g_timer0, 1000, true); - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); + timerStart(g_timer0); - g_timer1 = timerBegin(1, 80, true); - timerAttachInterrupt(g_timer1, &onTimer1, false); - timerAlarmWrite(g_timer1, 250, true); - timerAlarmEnable(g_timer1); + g_timer1 = timerBegin(1000000); + timerAttachInterrupt(g_timer1, &onTimer1); + timerAlarm(g_timer1, 250, true, 0); + timerStart(g_timer1); - g_timer2 = timerBegin(2, 40, true); - timerAttachInterrupt(g_timer2, &isrR, false); - timerAlarmWrite(g_timer2, 13333, true); - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); - timerAttachInterrupt(g_timer3, &isrL, false); - timerAlarmWrite(g_timer3, 13333, true); - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); + timerStart(g_timer3); Serial.begin(115200); @@ -212,10 +211,10 @@ void setBLED(char data) } //Buzzer -void enableBuzzer(short f) { ledcWriteTone(BUZZER_CH, f); } +void enableBuzzer(short f) { ledcWriteTone(BUZZER, f); } void disableBuzzer(void) { - ledcWrite(BUZZER_CH, 1024); //duty 100% Buzzer OFF + ledcWrite(BUZZER, 1024); //duty 100% Buzzer OFF } //motor diff --git a/uROS_STEP8_micromouse/fast.ino b/uROS_STEP8_micromouse/fast.ino index ac4ec9e..0e1fe5b 100644 --- a/uROS_STEP8_micromouse/fast.ino +++ b/uROS_STEP8_micromouse/fast.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/interrupt.ino b/uROS_STEP8_micromouse/interrupt.ino index a6397ad..af6c3ed 100644 --- a/uROS_STEP8_micromouse/interrupt.ino +++ b/uROS_STEP8_micromouse/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/map_manager.ino b/uROS_STEP8_micromouse/map_manager.ino index caa4ef9..2648095 100644 --- a/uROS_STEP8_micromouse/map_manager.ino +++ b/uROS_STEP8_micromouse/map_manager.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/misc.ino b/uROS_STEP8_micromouse/misc.ino index e59de6d..f1f714d 100644 --- a/uROS_STEP8_micromouse/misc.ino +++ b/uROS_STEP8_micromouse/misc.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/run.ino b/uROS_STEP8_micromouse/run.ino index ebdc1d2..bb28f40 100644 --- a/uROS_STEP8_micromouse/run.ino +++ b/uROS_STEP8_micromouse/run.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/search.ino b/uROS_STEP8_micromouse/search.ino index 4ba97ae..c17d05f 100644 --- a/uROS_STEP8_micromouse/search.ino +++ b/uROS_STEP8_micromouse/search.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino b/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino index 0853d59..f2dfd0f 100644 --- a/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino +++ b/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP9_twistMsg/interrupt.ino b/uROS_STEP9_twistMsg/interrupt.ino index f693cde..8618f83 100644 --- a/uROS_STEP9_twistMsg/interrupt.ino +++ b/uROS_STEP9_twistMsg/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino b/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino index 8cf5d5e..a80bebf 100644 --- a/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino +++ b/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2023 RT Corporation +// Copyright 2024 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -109,7 +109,7 @@ void IRAM_ATTR isrR(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_r < 30) g_step_hz_r = 30; - timerAlarmWrite(g_timer2, 2000000 / g_step_hz_r, true); + timerAlarm(g_timer2, 2000000 / g_step_hz_r, true, 0); digitalWrite(PWM_R, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -126,7 +126,7 @@ void IRAM_ATTR isrL(void) portENTER_CRITICAL_ISR(&g_timer_mux); //割り込み禁止 if (g_motor_move) { if (g_step_hz_l < 30) g_step_hz_l = 30; - timerAlarmWrite(g_timer3, 2000000 / g_step_hz_l, true); + timerAlarm(g_timer3, 2000000 / g_step_hz_l, true, 0); digitalWrite(PWM_L, HIGH); for (int i = 0; i < 100; i++) { asm("nop \n"); @@ -174,20 +174,20 @@ void setup() delay(2000); - g_timer0 = timerBegin(0, 80, true); //1us - timerAttachInterrupt(g_timer0, &onTimer0, true); - timerAlarmWrite(g_timer0, 1000, true); //1kHz - timerAlarmEnable(g_timer0); + g_timer0 = timerBegin(1000000); //1us + timerAttachInterrupt(g_timer0, &onTimer0); + timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerStart(g_timer0); - g_timer2 = timerBegin(2, 40, true); //0.5us - timerAttachInterrupt(g_timer2, &isrR, true); - timerAlarmWrite(g_timer2, 13333, true); //150Hz - timerAlarmEnable(g_timer2); + g_timer2 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer2, &isrR); + timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerStart(g_timer2); - g_timer3 = timerBegin(3, 40, true); //0.5us - timerAttachInterrupt(g_timer3, &isrL, true); - timerAlarmWrite(g_timer3, 13333, true); //150Hz - timerAlarmEnable(g_timer3); + g_timer3 = timerBegin(2000000); //0.5us + timerAttachInterrupt(g_timer3, &isrL); + timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerStart(g_timer3); g_allocator = rcl_get_default_allocator(); From 6190cf2172acf5af56666acb3e2278c90f3c2718 Mon Sep 17 00:00:00 2001 From: Masatake Aoki Date: Wed, 19 Jun 2024 14:14:32 +0900 Subject: [PATCH 2/2] comment modify --- uROS_STEP10_tfMsg/interrupt.ino | 2 +- uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino | 14 +++++++------- uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino | 6 +++--- uROS_STEP12_micromouse/SPIFFS.ino | 2 +- uROS_STEP12_micromouse/adjust.ino | 2 +- uROS_STEP12_micromouse/device.h | 1 - uROS_STEP12_micromouse/device.ino | 2 +- uROS_STEP12_micromouse/fast.ino | 2 +- uROS_STEP12_micromouse/interrupt.ino | 2 +- uROS_STEP12_micromouse/map_manager.ino | 2 +- uROS_STEP12_micromouse/microROS.ino | 2 +- uROS_STEP12_micromouse/misc.ino | 2 +- uROS_STEP12_micromouse/run.ino | 2 +- uROS_STEP12_micromouse/search.ino | 2 +- uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino | 2 +- uROS_STEP1_LED/uROS_STEP1_LED.ino | 2 +- uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino | 2 +- uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino | 2 +- uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino | 6 +++--- uROS_STEP5_Straight/interrupt.ino | 2 +- uROS_STEP5_Straight/run.ino | 2 +- uROS_STEP5_Straight/uROS_STEP5_Straight.ino | 14 +++++++------- uROS_STEP6_rotate/interrupt.ino | 2 +- uROS_STEP6_rotate/run.ino | 2 +- uROS_STEP6_rotate/uROS_STEP6_rotate.ino | 14 +++++++------- uROS_STEP7_P_control/interrupt.ino | 2 +- uROS_STEP7_P_control/run.ino | 2 +- uROS_STEP7_P_control/uROS_STEP7_P_control.ino | 14 +++++++------- uROS_STEP8_micromouse/SPIFFS.ino | 2 +- uROS_STEP8_micromouse/adjust.ino | 2 +- uROS_STEP8_micromouse/device.ino | 2 +- uROS_STEP8_micromouse/fast.ino | 2 +- uROS_STEP8_micromouse/interrupt.ino | 2 +- uROS_STEP8_micromouse/map_manager.ino | 2 +- uROS_STEP8_micromouse/misc.ino | 2 +- uROS_STEP8_micromouse/run.ino | 2 +- uROS_STEP8_micromouse/search.ino | 2 +- uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino | 2 +- uROS_STEP9_twistMsg/interrupt.ino | 2 +- uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino | 14 +++++++------- 40 files changed, 73 insertions(+), 74 deletions(-) diff --git a/uROS_STEP10_tfMsg/interrupt.ino b/uROS_STEP10_tfMsg/interrupt.ino index 0f0e6bb..db076ae 100644 --- a/uROS_STEP10_tfMsg/interrupt.ino +++ b/uROS_STEP10_tfMsg/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino b/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino index 9bed5e0..e873919 100644 --- a/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino +++ b/uROS_STEP10_tfMsg/uROS_STEP10_tfMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -201,19 +201,19 @@ void setup() delay(2000); - g_timer0 = timerBegin(1000000); //1us + g_timer0 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer0, &onTimer0); - timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerAlarm(g_timer0, 1000, true, 0); //1000 * 1us =1000us(1kHz) timerStart(g_timer0); - g_timer2 = timerBegin(2000000); //0.5us + g_timer2 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer2, &isrR); - timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerAlarm(g_timer2, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer2); - g_timer3 = timerBegin(2000000); //0.5us + g_timer3 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer3, &isrL); - timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerAlarm(g_timer3, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer3); g_allocator = rcl_get_default_allocator(); diff --git a/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino b/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino index a064bfc..591333c 100644 --- a/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino +++ b/uROS_STEP11_SensorMsg/uROS_STEP11_SensorMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -163,9 +163,9 @@ void setup() delay(2000); - g_timer1 = timerBegin(1000000); //1us + g_timer1 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer1, &onTimer1); - timerAlarm(g_timer1, 250, true, 0); //4kHz + timerAlarm(g_timer1, 250, true, 0); //250 * 1us = 250us(4kHz) timerStart(g_timer1); g_allocator = rcl_get_default_allocator(); diff --git a/uROS_STEP12_micromouse/SPIFFS.ino b/uROS_STEP12_micromouse/SPIFFS.ino index 6bee69a..3a8e044 100644 --- a/uROS_STEP12_micromouse/SPIFFS.ino +++ b/uROS_STEP12_micromouse/SPIFFS.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/adjust.ino b/uROS_STEP12_micromouse/adjust.ino index f57bae2..b0133f2 100644 --- a/uROS_STEP12_micromouse/adjust.ino +++ b/uROS_STEP12_micromouse/adjust.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/device.h b/uROS_STEP12_micromouse/device.h index 1dd901b..b48bbbb 100644 --- a/uROS_STEP12_micromouse/device.h +++ b/uROS_STEP12_micromouse/device.h @@ -36,5 +36,4 @@ #define SW_CM 2 #define SW_RM 4 - #endif // DEVICE_H_ \ No newline at end of file diff --git a/uROS_STEP12_micromouse/device.ino b/uROS_STEP12_micromouse/device.ino index 651c377..1135770 100644 --- a/uROS_STEP12_micromouse/device.ino +++ b/uROS_STEP12_micromouse/device.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/fast.ino b/uROS_STEP12_micromouse/fast.ino index 28669ff..8981c34 100644 --- a/uROS_STEP12_micromouse/fast.ino +++ b/uROS_STEP12_micromouse/fast.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/interrupt.ino b/uROS_STEP12_micromouse/interrupt.ino index 9bd3b69..f8fde48 100644 --- a/uROS_STEP12_micromouse/interrupt.ino +++ b/uROS_STEP12_micromouse/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/map_manager.ino b/uROS_STEP12_micromouse/map_manager.ino index 9437fab..809711d 100644 --- a/uROS_STEP12_micromouse/map_manager.ino +++ b/uROS_STEP12_micromouse/map_manager.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/microROS.ino b/uROS_STEP12_micromouse/microROS.ino index 6e67e37..68108a7 100644 --- a/uROS_STEP12_micromouse/microROS.ino +++ b/uROS_STEP12_micromouse/microROS.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/misc.ino b/uROS_STEP12_micromouse/misc.ino index f1f714d..e59de6d 100644 --- a/uROS_STEP12_micromouse/misc.ino +++ b/uROS_STEP12_micromouse/misc.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/run.ino b/uROS_STEP12_micromouse/run.ino index 7d53828..f93cdcd 100644 --- a/uROS_STEP12_micromouse/run.ino +++ b/uROS_STEP12_micromouse/run.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/search.ino b/uROS_STEP12_micromouse/search.ino index d36d5e1..2895011 100644 --- a/uROS_STEP12_micromouse/search.ino +++ b/uROS_STEP12_micromouse/search.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino b/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino index f8afc7e..e2392a2 100644 --- a/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino +++ b/uROS_STEP12_micromouse/uROS_STEP12_micromouse.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP1_LED/uROS_STEP1_LED.ino b/uROS_STEP1_LED/uROS_STEP1_LED.ino index 64b57a4..d9dbb4c 100644 --- a/uROS_STEP1_LED/uROS_STEP1_LED.ino +++ b/uROS_STEP1_LED/uROS_STEP1_LED.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino b/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino index c7760d3..fb762fc 100644 --- a/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino +++ b/uROS_STEP2_SWITCH/uROS_STEP2_SWITCH.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino b/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino index 0abbf9f..f51a13f 100644 --- a/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino +++ b/uROS_STEP3_Buzzer/uROS_STEP3_Buzzer.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino b/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino index 27e8879..eb1dc96 100644 --- a/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino +++ b/uROS_STEP4_Sensor/uROS_STEP4_Sensor.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -94,9 +94,9 @@ void setup() Serial.begin(115200); - g_timer1 = timerBegin(1000000); //1us + g_timer1 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer1, &onTimer1); - timerAlarm(g_timer1, 250, true, 0); //4kHz + timerAlarm(g_timer1, 250, true, 0); //250 * 1us =250us(4kHz) timerStart(g_timer1); } diff --git a/uROS_STEP5_Straight/interrupt.ino b/uROS_STEP5_Straight/interrupt.ino index 114ae10..8d9e922 100644 --- a/uROS_STEP5_Straight/interrupt.ino +++ b/uROS_STEP5_Straight/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP5_Straight/run.ino b/uROS_STEP5_Straight/run.ino index 3bd137d..55715d4 100644 --- a/uROS_STEP5_Straight/run.ino +++ b/uROS_STEP5_Straight/run.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP5_Straight/uROS_STEP5_Straight.ino b/uROS_STEP5_Straight/uROS_STEP5_Straight.ino index 0cda8a1..f5fa6c0 100644 --- a/uROS_STEP5_Straight/uROS_STEP5_Straight.ino +++ b/uROS_STEP5_Straight/uROS_STEP5_Straight.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -115,19 +115,19 @@ void setup() digitalWrite(PWM_R, LOW); digitalWrite(PWM_L, LOW); - g_timer0 = timerBegin(1000000); //1us + g_timer0 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer0, &onTimer0); - timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerAlarm(g_timer0, 1000, true, 0); //1000 * 1us =1000us(1kHz) timerStart(g_timer0); - g_timer2 = timerBegin(2000000); //0.5us + g_timer2 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer2, isrR); - timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerAlarm(g_timer2, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer2); - g_timer3 = timerBegin(2000000); //0.5us + g_timer3 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer3, &isrL); - timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerAlarm(g_timer3, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer3); } diff --git a/uROS_STEP6_rotate/interrupt.ino b/uROS_STEP6_rotate/interrupt.ino index 114ae10..8d9e922 100644 --- a/uROS_STEP6_rotate/interrupt.ino +++ b/uROS_STEP6_rotate/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP6_rotate/run.ino b/uROS_STEP6_rotate/run.ino index 2ee3103..3b25a88 100644 --- a/uROS_STEP6_rotate/run.ino +++ b/uROS_STEP6_rotate/run.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP6_rotate/uROS_STEP6_rotate.ino b/uROS_STEP6_rotate/uROS_STEP6_rotate.ino index 2ce0901..2797f4f 100644 --- a/uROS_STEP6_rotate/uROS_STEP6_rotate.ino +++ b/uROS_STEP6_rotate/uROS_STEP6_rotate.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -124,19 +124,19 @@ void setup() digitalWrite(PWM_R, LOW); digitalWrite(PWM_L, LOW); - g_timer0 = timerBegin(1000000); //1us + g_timer0 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer0, &onTimer0); - timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerAlarm(g_timer0, 1000, true, 0); //1000 * 1us = 1000us(1kHz) timerStart(g_timer0); - g_timer2 = timerBegin(2000000); //0.5us + g_timer2 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer2, &isrR); - timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerAlarm(g_timer2, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer2); - g_timer3 = timerBegin(2000000); //0.5us + g_timer3 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer3, &isrL); - timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerAlarm(g_timer3, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer3); } diff --git a/uROS_STEP7_P_control/interrupt.ino b/uROS_STEP7_P_control/interrupt.ino index 49579b0..61b6ec4 100644 --- a/uROS_STEP7_P_control/interrupt.ino +++ b/uROS_STEP7_P_control/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP7_P_control/run.ino b/uROS_STEP7_P_control/run.ino index 3bd137d..55715d4 100644 --- a/uROS_STEP7_P_control/run.ino +++ b/uROS_STEP7_P_control/run.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP7_P_control/uROS_STEP7_P_control.ino b/uROS_STEP7_P_control/uROS_STEP7_P_control.ino index 183cd65..a64c2c8 100644 --- a/uROS_STEP7_P_control/uROS_STEP7_P_control.ino +++ b/uROS_STEP7_P_control/uROS_STEP7_P_control.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -190,9 +190,9 @@ void setup() Serial.begin(115200); - g_timer0 = timerBegin(1000000); //1us + g_timer0 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer0, &onTimer0); - timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerAlarm(g_timer0, 1000, true, 0); //1000 * 1us =1000us(1kHz) timerStart(g_timer0); g_timer1 = timerBegin(1000000); @@ -200,14 +200,14 @@ void setup() timerAlarm(g_timer1, 250, true, 0); timerStart(g_timer1); - g_timer2 = timerBegin(2000000); //0.5us + g_timer2 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer2, &isrR); - timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerAlarm(g_timer2, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer2); - g_timer3 = timerBegin(2000000); //0.5us + g_timer3 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer3, &isrL); - timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerAlarm(g_timer3, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer3); g_sen_r.ref = REF_SEN_R; diff --git a/uROS_STEP8_micromouse/SPIFFS.ino b/uROS_STEP8_micromouse/SPIFFS.ino index 6bee69a..3a8e044 100644 --- a/uROS_STEP8_micromouse/SPIFFS.ino +++ b/uROS_STEP8_micromouse/SPIFFS.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/adjust.ino b/uROS_STEP8_micromouse/adjust.ino index 11769b9..234775e 100644 --- a/uROS_STEP8_micromouse/adjust.ino +++ b/uROS_STEP8_micromouse/adjust.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/device.ino b/uROS_STEP8_micromouse/device.ino index ec56717..600c229 100644 --- a/uROS_STEP8_micromouse/device.ino +++ b/uROS_STEP8_micromouse/device.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/fast.ino b/uROS_STEP8_micromouse/fast.ino index 0e1fe5b..ac4ec9e 100644 --- a/uROS_STEP8_micromouse/fast.ino +++ b/uROS_STEP8_micromouse/fast.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/interrupt.ino b/uROS_STEP8_micromouse/interrupt.ino index af6c3ed..a6397ad 100644 --- a/uROS_STEP8_micromouse/interrupt.ino +++ b/uROS_STEP8_micromouse/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/map_manager.ino b/uROS_STEP8_micromouse/map_manager.ino index 2648095..caa4ef9 100644 --- a/uROS_STEP8_micromouse/map_manager.ino +++ b/uROS_STEP8_micromouse/map_manager.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/misc.ino b/uROS_STEP8_micromouse/misc.ino index f1f714d..e59de6d 100644 --- a/uROS_STEP8_micromouse/misc.ino +++ b/uROS_STEP8_micromouse/misc.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/run.ino b/uROS_STEP8_micromouse/run.ino index bb28f40..ebdc1d2 100644 --- a/uROS_STEP8_micromouse/run.ino +++ b/uROS_STEP8_micromouse/run.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/search.ino b/uROS_STEP8_micromouse/search.ino index c17d05f..4ba97ae 100644 --- a/uROS_STEP8_micromouse/search.ino +++ b/uROS_STEP8_micromouse/search.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino b/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino index f2dfd0f..0853d59 100644 --- a/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino +++ b/uROS_STEP8_micromouse/uROS_STEP8_micromouse.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP9_twistMsg/interrupt.ino b/uROS_STEP9_twistMsg/interrupt.ino index 8618f83..f693cde 100644 --- a/uROS_STEP9_twistMsg/interrupt.ino +++ b/uROS_STEP9_twistMsg/interrupt.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. diff --git a/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino b/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino index a80bebf..c28a188 100644 --- a/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino +++ b/uROS_STEP9_twistMsg/uROS_STEP9_twistMsg.ino @@ -1,4 +1,4 @@ -// Copyright 2024 RT Corporation +// Copyright 2023 RT Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -174,19 +174,19 @@ void setup() delay(2000); - g_timer0 = timerBegin(1000000); //1us + g_timer0 = timerBegin(1000000); //1MHz(1us) timerAttachInterrupt(g_timer0, &onTimer0); - timerAlarm(g_timer0, 1000, true, 0); //1kHz + timerAlarm(g_timer0, 1000, true, 0); //1000 * 1us = 1000us(1kHz) timerStart(g_timer0); - g_timer2 = timerBegin(2000000); //0.5us + g_timer2 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer2, &isrR); - timerAlarm(g_timer2, 13333, true, 0); //150Hz + timerAlarm(g_timer2, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer2); - g_timer3 = timerBegin(2000000); //0.5us + g_timer3 = timerBegin(2000000); //2MHz(0.5us) timerAttachInterrupt(g_timer3, &isrL); - timerAlarm(g_timer3, 13333, true, 0); //150Hz + timerAlarm(g_timer3, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz) timerStart(g_timer3); g_allocator = rcl_get_default_allocator();