Files
RP2040-Decoder/shared.h
T
1nct 2cad01370c - implemented linear approximation for pwm duty cycle offset (feed forward)
- changed pid params and variables in measure() from float to integers
- implemented Motor PWM Frequency CV
- improved acknowledge() function ( 3ms forward / 3ms reverse )
- moved automatic offset setup to speed step evaluation
- removed zener diode correction
- some minor changes regarding naming of constants
2022-02-23 02:15:12 +01:00

28 lines
841 B
C

//////////////////////////
// RP2040-Decoder //
// Gabriel Koppenstein //
// shared.h //
//////////////////////////
#pragma once
#include <stdio.h>
#include "string.h"
#include "pico/stdlib.h"
#include "pico/multicore.h"
#include "pico/util/queue.h"
#include "hardware/pwm.h"
#include "hardware/adc.h"
#include "hardware/flash.h"
#include "hardware/irq.h"
#define _125M 125000000
#define ADC_OFFSET 13
#define MOTOR_FWD_PIN 22
#define MOTOR_REV_PIN 23
#define FLASH_TARGET_OFFSET (PICO_FLASH_SIZE_BYTES-FLASH_SECTOR_SIZE) //This Offset should be far enough away from program data
extern repeating_timer_t pid_control_timer;
extern repeating_timer_t speed_helper_timer;
extern bool target_direction;
extern uint target_speed_step;
extern const uint8_t *CV_ARRAY_FLASH;
void core1_entry();
uint32_t measure(bool direction);