first
This commit is contained in:
30
extras/tests/simavr_based/off_test_timing/platformio.ini
Normal file
30
extras/tests/simavr_based/off_test_timing/platformio.ini
Normal file
@@ -0,0 +1,30 @@
|
||||
; PlatformIO Project Configuration File
|
||||
;
|
||||
; Build options: build flags, source filter
|
||||
; Upload options: custom upload port, speed and extra flags
|
||||
; Library options: dependencies, extra library storages
|
||||
; Advanced options: extra scripting
|
||||
;
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[platformio]
|
||||
|
||||
# There should be only one env section for the DUT under test.
|
||||
# One of
|
||||
# atmega168p
|
||||
# atmega328p
|
||||
# atmega2560_timer1
|
||||
# atmega2560_timer3
|
||||
# atmega2560_timer4
|
||||
# atmega2560_timer5
|
||||
#
|
||||
[common]
|
||||
build_flags = -DTEST_TIMING
|
||||
|
||||
[env:atmega328p]
|
||||
platform = atmelavr
|
||||
board = nanoatmega328
|
||||
framework = arduino
|
||||
build_flags = -Werror -Wall -DSIMAVR_FOC_WORKAROUND ${common.build_flags}
|
||||
lib_extra_dirs = ../../../../..
|
||||
40
extras/tests/simavr_based/off_test_timing/src/main.ino
Normal file
40
extras/tests/simavr_based/off_test_timing/src/main.ino
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <avr/sleep.h>
|
||||
#include <AVRStepperPins.h>
|
||||
#include <RampCalculator.h>
|
||||
|
||||
float acceleration_f;
|
||||
uint32_t acceleration_i;
|
||||
uint32_t steps;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
Serial.println("Start");
|
||||
|
||||
digitalWrite(stepPinStepperA, LOW);
|
||||
digitalWrite(stepPinStepperB, LOW);
|
||||
pinMode(stepPinStepperA, OUTPUT);
|
||||
pinMode(stepPinStepperB, OUTPUT);
|
||||
|
||||
acceleration_f = 12345.0;
|
||||
acceleration_i = 12345.0;
|
||||
steps = 10;
|
||||
}
|
||||
void loop() {
|
||||
digitalWrite(stepPinStepperA, HIGH);
|
||||
uint32_t x;
|
||||
// x = calculate_ticks_v1(steps, acceleration_f);
|
||||
// x = calculate_ticks_v2(steps, acceleration_f);
|
||||
// x = calculate_ticks_v3(steps, acceleration_f);
|
||||
// x = calculate_ticks_v4(steps, acceleration_i);
|
||||
// x = calculate_ticks_v5(steps, acceleration_i);
|
||||
// x = calculate_ticks_v7(0x1234000, 1000);
|
||||
x = calculate_ticks_v8(0x1234000, 1000);
|
||||
digitalWrite(stepPinStepperA, LOW);
|
||||
|
||||
digitalWrite(stepPinStepperB, HIGH);
|
||||
digitalWrite(stepPinStepperB, LOW);
|
||||
Serial.println(x);
|
||||
delay(100);
|
||||
noInterrupts();
|
||||
sleep_cpu();
|
||||
}
|
||||
Reference in New Issue
Block a user