Skip to content

Commit 90573f9

Browse files
committed
change format
1 parent 2dbd825 commit 90573f9

File tree

10 files changed

+24
-42
lines changed

10 files changed

+24
-42
lines changed

pico_v2_STEP5_Straight/pico_v2_STEP5_Straight.ino

+2-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ volatile unsigned int g_step_r, g_step_l;
4444
unsigned short g_step_hz_r = MIN_HZ;
4545
unsigned short g_step_hz_l = MIN_HZ;
4646

47-
4847
//割り込み
4948
//目標値の更新周期1kHz
5049
void IRAM_ATTR onTimer0(void)
@@ -94,8 +93,8 @@ void setup()
9493
pinMode(LED2, OUTPUT);
9594
pinMode(LED3, OUTPUT);
9695

97-
pinMode(SW_L, INPUT_PULLUP);
98-
pinMode(SW_R, INPUT_PULLUP);
96+
pinMode(SW_L, INPUT);
97+
pinMode(SW_R, INPUT);
9998

10099
//motor disable
101100
pinMode(MOTOR_EN, OUTPUT);

pico_v2_STEP5_Straight/run.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
#ifndef SRC_RUN_H_
1616
#define SRC_RUN_H_
1717

18-
typedef enum {
19-
MOT_FORWARD = 1,
20-
MOT_BACK = 2
21-
} t_CW_CCW;
18+
typedef enum { MOT_FORWARD = 1, MOT_BACK = 2 } t_CW_CCW;
2219

2320
class RUN
2421
{
@@ -29,7 +26,6 @@ class RUN
2926
volatile double max_speed;
3027
volatile double min_speed;
3128

32-
3329
RUN();
3430
void interrupt(void);
3531
void counterClear(void);

pico_v2_STEP5_Straight/run.ino

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ void RUN::interrupt(void)
3737
speedSet(speed, speed);
3838
}
3939

40-
4140
void RUN::dirSet(t_CW_CCW dir_left, t_CW_CCW dir_right)
4241
{
4342
if (dir_left == MOT_FORWARD) {

pico_v2_STEP6_rotate/pico_v2_STEP6_rotate.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ void setup()
9494
pinMode(LED2, OUTPUT);
9595
pinMode(LED3, OUTPUT);
9696

97-
pinMode(SW_L, INPUT_PULLUP);
98-
pinMode(SW_R, INPUT_PULLUP);
97+
pinMode(SW_L, INPUT);
98+
pinMode(SW_R, INPUT);
9999

100100
//motor disable
101101
pinMode(MOTOR_EN, OUTPUT);

pico_v2_STEP6_rotate/run.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717

1818
typedef enum { front, right, left, rear } t_local_direction;
1919

20-
typedef enum {
21-
MOT_FORWARD = 1,
22-
MOT_BACK = 2
23-
} t_CW_CCW;
20+
typedef enum { MOT_FORWARD = 1, MOT_BACK = 2 } t_CW_CCW;
2421

2522
class RUN
2623
{

pico_v2_STEP7_P_control/pico_v2_STEP7_P_control.ino

+3-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#define MIN_HZ 40
4242
#define TIRE_DIAMETER (24.70)
43-
#define PULSE (TIRE_DIAMETER * PI / (35.0 / 10.0 * 20.0 *8.0))
43+
#define PULSE (TIRE_DIAMETER * PI / (35.0 / 10.0 * 20.0 * 8.0))
4444
#define MIN_SPEED (MIN_HZ * PULSE)
4545

4646
//環境に合わせて変更する
@@ -126,8 +126,8 @@ void setup()
126126
pinMode(LED2, OUTPUT);
127127
pinMode(LED3, OUTPUT);
128128

129-
pinMode(SW_L, INPUT_PULLUP);
130-
pinMode(SW_R, INPUT_PULLUP);
129+
pinMode(SW_L, INPUT);
130+
pinMode(SW_R, INPUT);
131131

132132
//motor disable
133133
pinMode(MOTOR_EN, OUTPUT);
@@ -168,7 +168,6 @@ void setup()
168168
timerAttachInterrupt(g_timer3, &isrL);
169169
timerAlarm(g_timer3, 13333, true, 0); //13333 * 0.5us = 6666us(150Hz)
170170
timerStart(g_timer3);
171-
172171
}
173172

174173
void loop()

pico_v2_STEP7_P_control/run.h

+4-6
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,19 @@ typedef struct
3232
bool enable;
3333
} t_control;
3434

35-
3635
typedef enum {
3736
MOT_FORWARD = 1, //TMC5240の方向に合わせた数字
3837
MOT_BACK = 2
3938
} t_CW_CCW;
4039

41-
class RUN {
40+
class RUN
41+
{
4242
private:
43-
4443
public:
4544
volatile double accel;
4645
volatile double speed;
4746
volatile double speed_target_r;
48-
volatile double speed_target_l;
47+
volatile double speed_target_l;
4948
volatile double max_speed;
5049
volatile double min_speed;
5150

@@ -64,10 +63,9 @@ class RUN {
6463
void rotate(t_local_direction dir, int times);
6564

6665
private:
67-
int step_lr_len,step_lr;
66+
int step_lr_len, step_lr;
6867
};
6968

70-
7169
extern RUN g_run;
7270

7371
#endif /* SRC_RUN_H_ */

pico_v2_STEP7_P_control/sensor.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ typedef struct
2828
bool is_control;
2929
} t_sensor;
3030

31-
32-
class SENSOR{
31+
class SENSOR
32+
{
3333
public:
3434
SENSOR();
35-
volatile t_sensor sen_r, sen_l, sen_fr, sen_fl;
36-
volatile short battery_value;
37-
void interrupt(void);
35+
volatile t_sensor sen_r, sen_l, sen_fr, sen_fl;
36+
volatile short battery_value;
37+
void interrupt(void);
3838
};
3939

4040
extern SENSOR g_sensor;

pico_v2_STEP7_P_control/sensor.ino

+4-10
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
1615
#include "sensor.h"
1716

1817
SENSOR g_sensor;
1918

20-
21-
SENSOR::SENSOR() { //コンストラクタ
19+
SENSOR::SENSOR()
20+
{ //コンストラクタ
2221

2322
sen_r.ref = REF_SEN_R;
2423
sen_l.ref = REF_SEN_L;
@@ -31,16 +30,11 @@ SENSOR::SENSOR() { //コンストラクタ
3130

3231
sen_r.th_control = CONTH_SEN_R;
3332
sen_l.th_control = CONTH_SEN_L;
34-
35-
36-
}
37-
38-
void sensorInterrupt(void) {
39-
g_sensor.interrupt();
4033
}
4134

35+
void sensorInterrupt(void) { g_sensor.interrupt(); }
4236

43-
void SENSOR::interrupt(void)
37+
void SENSOR::interrupt(void)
4438
{
4539
static char cnt = 0;
4640
short temp_r, temp_l;

pico_v2_STEP8_micromouse/device.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ void deviceInit(void)
105105
pinMode(BLED0, OUTPUT);
106106
pinMode(BLED1, OUTPUT);
107107

108-
pinMode(SW_L, INPUT_PULLUP);
109-
pinMode(SW_R, INPUT_PULLUP);
108+
pinMode(SW_L, INPUT);
109+
pinMode(SW_R, INPUT);
110110

111111
ledcAttach(BUZZER, 440, 10);
112112
ledcWrite(BUZZER, 0);

0 commit comments

Comments
 (0)