pico-ice
RaspberryPi Pico with an iCE40 FPGA
Loading...
Searching...
No Matches
ice_pmod.h
1
/*
2
* MIT License
3
*
4
* Copyright (c) 2023 tinyVision.ai
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to deal
8
* in the Software without restriction, including without limitation the rights
9
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
* copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in all
14
* copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
36
#pragma once
37
#include <stdint.h>
38
#include <stddef.h>
39
#include <stdbool.h>
40
41
struct
pmod_1x_gpio
{
42
uint8_t io1, io2, io3, io4;
43
};
44
45
struct
pmod_2x_gpio
{
46
uint8_t io1, io2, io3, io4;
47
uint8_t io7, io8, io9, io10;
48
};
49
50
struct
pmod_1x_spi
{
51
uint8_t cs_n, copi, cipo, clk;
52
};
53
54
struct
pmod_2x_spi
{
55
uint8_t cs_n, copi, cipo, clk;
56
uint8_t io7, io8, io9, io10;
57
};
58
59
struct
pmod_1x_uart
{
60
uint8_t cts, txd, rxd, rts;
61
};
62
63
struct
pmod_2x_uart
{
64
uint8_t cts, txd, rxd, rts;
65
uint8_t io7, io8, io9, io10;
66
};
67
68
struct
pmod_1x_hbridge_feedback
{
69
uint8_t dir, en, sa, sb;
70
};
71
72
struct
pmod_1x_hbridge_dual
{
73
uint8_t dir1, en1, dir2, en2;
74
};
75
76
struct
pmod_2x_hbridge
{
77
uint8_t dir1, en1, s1a, s1b;
78
uint8_t dir2, en2, s2a, s2b;
79
};
80
81
struct
pmod_1x_i2c
{
82
uint8_t irq, reset, sda, scl;
83
};
84
85
struct
pmod_2x_i2c
{
86
uint8_t irq, reset, sda, scl;
87
uint8_t io7, io8, io9, io10;
88
};
89
90
struct
pmod_2x_i2s
{
91
uint8_t lrclk, dac, adc, bclk;
92
uint8_t io7, io8, io9, io10;
93
};
94
95
typedef
union
pmod_1x
{
96
struct
pmod_1x_gpio
gpio;
97
struct
pmod_1x_spi
spi;
98
struct
pmod_1x_uart
uart;
99
struct
pmod_1x_hbridge_feedback
hbridge_feedback;
100
struct
pmod_1x_hbridge_dual
hbridge_dual;
101
struct
pmod_1x_i2c
i2c;
102
}
pmod_1x_t
;
103
104
typedef
union
pmod_2x
{
105
struct
{
106
union
pmod_1x
top;
107
union
pmod_1x
bottom;
108
} row;
109
struct
pmod_2x_gpio
gpio;
110
struct
pmod_2x_spi
spi;
111
struct
pmod_2x_uart
uart;
112
struct
pmod_2x_hbridge
hbridge;
113
struct
pmod_2x_i2c
i2c;
114
struct
pmod_2x_i2s
i2s;
115
}
pmod_2x_t
;
116
117
static
const
pmod_2x_t
ice_pmod_3 = {
118
.gpio = { 1, 3, 0, 2, 5, 7, 4, 6 }
119
};
120
121
static
const
pmod_2x_t
ice_pmod_4 = {
122
.gpio = { 17, 19, 16, 18, 21, 23, 20, 22 }
123
};
124
pmod_1x_gpio
Definition
ice_pmod.h:41
pmod_1x_hbridge_dual
Definition
ice_pmod.h:72
pmod_1x_hbridge_feedback
Definition
ice_pmod.h:68
pmod_1x_i2c
Definition
ice_pmod.h:81
pmod_1x_spi
Definition
ice_pmod.h:50
pmod_1x_uart
Definition
ice_pmod.h:59
pmod_2x_gpio
Definition
ice_pmod.h:45
pmod_2x_hbridge
Definition
ice_pmod.h:76
pmod_2x_i2c
Definition
ice_pmod.h:85
pmod_2x_i2s
Definition
ice_pmod.h:90
pmod_2x_spi
Definition
ice_pmod.h:54
pmod_2x_uart
Definition
ice_pmod.h:63
pmod_1x
Definition
ice_pmod.h:95
pmod_2x
Definition
ice_pmod.h:104
Firmware
pico-ice-sdk
include
ice_pmod.h
Generated by
1.9.8