Skip to content

Commit d48b4f0

Browse files
v3
1 parent 61158a7 commit d48b4f0

21 files changed

+25950
-25869
lines changed

stm32/Core/Inc/pca9685.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
//
1111
// Servo min and max values for TURINGY TG9e Servos
1212
//
13-
#define SERVO_MIN 110
14-
#define SERVO_MAX 500
13+
#define SERVO_MIN 125
14+
#define SERVO_MAX 575
1515
#define MIN_ANGLE 0.0
1616
#define MAX_ANGLE 180.0
1717
#endif

stm32/Core/Src/main.c

+29-19
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,45 @@ void StartDefaultTask(void *argument);
8484

8585
/* Private user code ---------------------------------------------------------*/
8686
/* USER CODE BEGIN 0 */
87+
void start_normal(void *parameters)
88+
{
89+
while(1)
90+
{
91+
PCA9685_SetServoAngle(0, 110);
92+
PCA9685_SetServoAngle(1, 100);
93+
PCA9685_SetServoAngle(2, 110);
94+
PCA9685_SetServoAngle(3, 45);
95+
HAL_Delay(500);
96+
PCA9685_SetServoAngle(4, 60);
97+
PCA9685_SetServoAngle(5, 40);
98+
PCA9685_SetServoAngle(6, 95);
99+
PCA9685_SetServoAngle(7, 110);
100+
PCA9685_SetServoAngle(8, 75);
101+
PCA9685_SetServoAngle(9, 100);
102+
PCA9685_SetServoAngle(10, 125);
103+
PCA9685_SetServoAngle(11, 35);
104+
}
105+
vTaskDelete(NULL);
106+
}
87107

88108
void servos()
89109
{
90110
while (1)
91111
{
92112
// PCA9685_SetServoAngle(0, 90);
93113
for (uint8_t Angle = 0; Angle < 90; Angle++) {
114+
HAL_Delay(100);
94115
PCA9685_SetServoAngle(ActiveServo, Angle);
95116
}
96117
HAL_Delay(500);
97118
for (uint16_t Angle = 90; Angle > 0; Angle--) {
98119
PCA9685_SetServoAngle(ActiveServo, Angle);
99120
}
100121
HAL_Delay(500);
101-
ActiveServo++;
102-
if (ActiveServo >= SERVO_COUNT) ActiveServo = 0;
122+
// ActiveServo++;
123+
// if (ActiveServo >= SERVO_COUNT) ActiveServo = 0;
103124
}
104-
// vTaskDelete(NULL);
125+
vTaskDelete(NULL);
105126
}
106127

107128
void debugsy(void *parameters)
@@ -206,25 +227,14 @@ int main(void)
206227
SSD1306_Init();
207228
PCA9685_Init(&hi2c3);
208229

209-
PCA9685_SetServoAngle(0, 0);
210-
PCA9685_SetServoAngle(1, 0);
211-
PCA9685_SetServoAngle(2, 0);
212-
PCA9685_SetServoAngle(3, 0);
213-
// PCA9685_SetServoAngle(4, 0);
214-
// PCA9685_SetServoAngle(5, 0);
215-
// PCA9685_SetServoAngle(6, 0);
216-
// PCA9685_SetServoAngle(7, 0);
217-
// PCA9685_SetServoAngle(8, 0);
218-
// PCA9685_SetServoAngle(9, 0);
219-
// PCA9685_SetServoAngle(10, 0);
220-
// PCA9685_SetServoAngle(11, 0);
230+
221231

222232
//
223233
xTaskHandle HT1,HT2;
224234
xTaskCreate(faces, "face_show", configMINIMAL_STACK_SIZE, 0, tskIDLE_PRIORITY, &HT1);
225-
// xTaskCreate(servos, "debugging", configMINIMAL_STACK_SIZE, 0, tskIDLE_PRIORITY, &HT2);
226-
servos();
227-
// vTaskStartScheduler();
235+
xTaskCreate(start_normal, "debugging", configMINIMAL_STACK_SIZE, 0, tskIDLE_PRIORITY, &HT2);
236+
// servos();
237+
vTaskStartScheduler();
228238
/* USER CODE END 2 */
229239

230240
/* Init scheduler */
@@ -374,7 +384,7 @@ static void MX_I2C3_Init(void)
374384

375385
/* USER CODE END I2C3_Init 1 */
376386
hi2c3.Instance = I2C3;
377-
hi2c3.Init.ClockSpeed = 100000;
387+
hi2c3.Init.ClockSpeed = 400000;
378388
hi2c3.Init.DutyCycle = I2C_DUTYCYCLE_2;
379389
hi2c3.Init.OwnAddress1 = 0;
380390
hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;

stm32/Debug/Core/Src/freertos.o

0 Bytes
Binary file not shown.

stm32/Debug/Core/Src/main.o

708 Bytes
Binary file not shown.

stm32/Debug/Core/Src/main.su

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
main.c:88:6:servos 16 static
2-
main.c:107:6:debugsy 16 static
3-
main.c:132:6:faces 32 static
4-
main.c:176:5:main 24 static
5-
main.c:280:6:SystemClock_Config 104 static
6-
main.c:331:13:MX_I2C1_Init 8 static
7-
main.c:364:13:MX_I2C3_Init 8 static
8-
main.c:397:13:MX_I2S3_Init 8 static
9-
main.c:430:13:MX_SPI1_Init 8 static
10-
main.c:467:13:MX_USART2_UART_Init 8 static
11-
main.c:499:13:MX_GPIO_Init 56 static
12-
main.c:594:6:StartDefaultTask 16 static
13-
main.c:615:6:HAL_TIM_PeriodElapsedCallback 16 static
14-
main.c:633:6:Error_Handler 4 static,ignoring_inline_asm
1+
main.c:87:6:start_normal 16 static
2+
main.c:108:6:servos 16 static
3+
main.c:128:6:debugsy 16 static
4+
main.c:153:6:faces 32 static
5+
main.c:197:5:main 24 static
6+
main.c:290:6:SystemClock_Config 104 static
7+
main.c:342:13:MX_I2C1_Init 8 static
8+
main.c:376:13:MX_I2C3_Init 8 static
9+
main.c:410:13:MX_I2S3_Init 8 static
10+
main.c:444:13:MX_SPI1_Init 8 static
11+
main.c:482:13:MX_USART2_UART_Init 8 static
12+
main.c:515:13:MX_GPIO_Init 56 static
13+
main.c:613:6:StartDefaultTask 16 static
14+
main.c:634:6:HAL_TIM_PeriodElapsedCallback 16 static
15+
main.c:651:6:Error_Handler 4 static,ignoring_inline_asm

stm32/Debug/Core/Src/pca9685.o

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

stm32/Debug/Core/Src/stm32f4xx_it.o

0 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

stm32/Debug/USB_HOST/App/usb_host.o

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

stm32/Debug/display_board_oled.bin

28 Bytes
Binary file not shown.

stm32/Debug/display_board_oled.elf

124 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)