Commit ac2e739f authored by Joshua Supra's avatar Joshua Supra
Browse files

added encoder

parent 810ed3a3
#include "pilc2_encoder.h"
#include "pilc2_register_func.h"
int EncoderLoadPreloadValue(unsigned int ChannelMask) {
WriteFPGA(PILC_ENCODER_OFFSET+PILC_ENCODER_LPRLVREG, ChannelMask);
WriteFPGA(PILC_ENCODER_OFFSET+PILC_ENCODER_LPRLVREG, 0x0);
return 0;
}
int EncoderSetPreloadValue(unsigned int channel, unsigned int preload_value) {
WriteFPGA(PILC_ENCODER_OFFSET+PILC_ENCODER_PRLV_OFFSET+channel, preload_value);
return 0;
}
int EncoderGetValue(unsigned int channel) {
unsigned int value;
value = ReadFPGA(PILC_ENCODER_OFFSET+PILC_ENCODER_VAL_OFFSET+channel);
return value;
}
#define PILC_ENCODER_OFFSET (0x9000>>2)
#define PILC_ENCODER_LPRLVREG 0x0
#define PILC_ENCODER_PRLV_OFFSET 0x8
#define PILC_ENCODER_VAL_OFFSET 0x10
#define PILC_ENCODER_CH_0 0x0
#define PILC_ENCODER_CH_1 0x1
#define PILC_ENCODER_CH_2 0x2
#define PILC_ENCODER_CH_3 0x3
#define PILC_ENCODER_CH_4 0x4
#define PILC_ENCODER_CH_5 0x5
#define PILC_ENCODER_CH_6 0x6
#define PILC_ENCODER_CH_7 0x7
int EncoderLoadPreloadValue(unsigned int ChannelMask);
int EncoderSetPreloadValue(unsigned int channel, unsigned int preload_value);
int EncoderGetValue(unsigned int channel);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment