-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
52 lines (40 loc) · 1.12 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "stm32f10x.h"
#include "stdio.h"
//#include "common.h"
#define RX_BUF_SIZE 80
#define BASE_NOTE_V 83-17 //minus voltage offset occurs in 5V PWM converter
#define BASE_NOTE_MIDI 36
#define TOP_NOTE_MIDI 96
#define HALFSTEP_V 83
#define OCTAVE 12
#define PIN_V_MAX 5000 //PULSE PEAK VOLTAGE; NORMAL 5000;
#define V_MAX 6000
typedef struct {
uint8_t gate;
uint16_t pitch;
uint8_t retrig;
uint8_t velocity;
}cvstate;
//DWT
uint32_t DWT_Delay_Init(void);
void delayMS_DWT(uint32_t ms);
void delayUS_DWT(uint32_t us);
//UART
extern void send_to_uart(uint8_t data);
extern void send_str(char * string);
extern void init_uart(void);
extern cvstate usart_main_loop_routine(void);
extern void clear_RXBuffer(void);
//ENCODER
void init_encoder(void);
//PWM
extern void init_pwm(void);
extern void pwm_set_volt(uint16_t v);
//CV
extern void exec_cv(cvstate notestate);
//MAX72
void init_max72(void);
void send_max_byte(uint8_t byte);
void send_max_data(uint8_t address, uint8_t data);
void max_display_digit(uint8_t addr, uint8_t digit);
void max_display_number(uint8_t number);