forked from jimahlstrom/HL2IOBoard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhl2ioboard.h
65 lines (59 loc) · 1.77 KB
/
hl2ioboard.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
53
54
55
56
57
58
59
60
61
62
63
64
65
// This is firmware for the Hermes Lite 2 IO board designed by Jim Ahlstrom, N2ADR. It is
// Copyright (c) 2022-2023 James C. Ahlstrom <jahlstr@gmail.com>.
// It is licensed under the MIT license. See MIT.txt.
#include <hardware/gpio.h>
#include <hardware/i2c.h>
#include <pico/i2c_slave.h>
#include <hardware/pwm.h>
#include <pico/binary_info.h>
#include <pico/stdlib.h>
#include <stdio.h>
#define I2C1_ADDRESS 0x1D
#define I2C1_BAUDRATE (400 * 1000)
#define FT817_SLICE 4
#define FT817_CHAN PWM_CHAN_A
#define FT817_WRAP 1000
#define FAN_SLICE 2
#define FAN_CHAN PWM_CHAN_A
#define FAN_WRAP 1000
#define GPIO00_HPF 0
#define GPIO01_Sw12 1
#define GPIO02_RF3 2
#define GPIO03_INTTR 3
#define GPIO04_Fan 4
#define GPIO05_xxx 5
#define GPIO06_In5 6
#define GPIO07_In4 7
#define GPIO08_Out8 8
#define GPIO09_Out7 9
#define GPIO10_Out5 10
#define GPIO11_Out4 11
#define GPIO12_Sw5 12
#define GPIO13_EXTTR 13
#define GPIO14_I2C1_SDA 14
#define GPIO15_I2C1_SCL 15
#define GPIO16_Out1 16
#define GPIO17_In1 17
#define GPIO18_In2 18
#define GPIO19_Out2 19
#define GPIO20_Out3 20
#define GPIO21_In3 21
#define GPIO22_Out6 22
#define GPIO25_LED 25
#define GPIO26_ADC0 26
#define GPIO27_ADC1 27
#define GPIO28_ADC2 28
typedef void (*irq_handler)(uint8_t register_number, uint8_t register_datum);
void configure_pins(bool use_uart1, bool use_pwm4a);
void configure_led_flasher(void);
void fast_led_flasher(void);
void i2c_slave_handler(i2c_inst_t *i2c, i2c_slave_event_t event);
void IrqRxTxChange(uint gpio, uint32_t events);
void ft817_band_volts(uint8_t band);
uint8_t tx_freq_to_band(uint64_t freq);
void IcomAh4(uint8_t, uint8_t);
extern uint8_t firmware_version_major;
extern uint8_t firmware_version_minor;
extern uint64_t new_tx_freq;
extern uint8_t Registers[256];
extern irq_handler IrqHandler[256];