32 lines
862 B
C
32 lines
862 B
C
#ifndef IO_H_
|
|
#define IO_H_
|
|
|
|
// Input/output support functions for pingpong.
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
// tick variable is set to true every sample time.
|
|
extern volatile bool tick;
|
|
// distance variable contains the measured distance in mm.
|
|
extern volatile int32_t distance;
|
|
// Kc variable can be set by typing a float value to the terminal (which is connected to the UART).
|
|
//extern volatile float Kc;
|
|
|
|
bool initUART(void);
|
|
bool initTimer(uint32_t sampleFrequency);
|
|
bool initPWM(void);
|
|
void initPort();
|
|
|
|
// setPWM sets dutyCycle in 1000 steps (min = 0, max = 1000)
|
|
bool setPWM(uint16_t dutyCycle);
|
|
// trigger creates a 10 usec trigger pulse for the ultrasonic sensor.
|
|
void trigger();
|
|
|
|
void sendStringUART(char *s);
|
|
void sendIntUART(int i);
|
|
void sendIntIntUART(int i1, int i2);
|
|
void sendFloatUART(float f);
|
|
|
|
#endif
|