Code update for v0.1 HW design
parent
1d1be8f707
commit
c14e8b675f
22
src/main.zig
22
src/main.zig
|
@ -9,14 +9,16 @@ const multicore = rp2040.multicore;
|
||||||
const pwm = rp2040.pwm;
|
const pwm = rp2040.pwm;
|
||||||
|
|
||||||
const pin_config = rp2040.pins.GlobalConfiguration{
|
const pin_config = rp2040.pins.GlobalConfiguration{
|
||||||
.GPIO0 = .{ .name = "channel0", .function = .PWM0_A },
|
.GPIO8 = .{ .name = "channel0", .function = .PWM4_A },
|
||||||
.GPIO1 = .{ .name = "channel1", .function = .PWM0_B },
|
.GPIO9 = .{ .name = "channel1", .function = .PWM4_B },
|
||||||
.GPIO2 = .{ .name = "channel2", .function = .PWM1_A },
|
.GPIO10 = .{ .name = "channel2", .function = .PWM5_A },
|
||||||
.GPIO3 = .{ .name = "channel3", .function = .PWM1_B },
|
.GPIO3 = .{ .name = "channel3", .function = .PWM1_B },
|
||||||
|
.GPIO4 = .{ .name = "channel4", .function = .PWM2_A },
|
||||||
|
.GPIO5 = .{ .name = "channel5", .function = .PWM2_B },
|
||||||
.GPIO25 = .{ .name = "channelInt", .function = .PWM4_B },
|
.GPIO25 = .{ .name = "channelInt", .function = .PWM4_B },
|
||||||
};
|
};
|
||||||
|
|
||||||
const Channels = enum { Channel0, Channel1, Channel2, Channel3, ChannelInt };
|
const Channels = enum { Channel0, Channel1, Channel2, Channel3, Channel4, Channel5, ChannelInt };
|
||||||
|
|
||||||
const Animations = enum { Candle, Pulse };
|
const Animations = enum { Candle, Pulse };
|
||||||
|
|
||||||
|
@ -77,12 +79,18 @@ pub fn main() !void {
|
||||||
try cfgChannel(pins.channel1);
|
try cfgChannel(pins.channel1);
|
||||||
try cfgChannel(pins.channel2);
|
try cfgChannel(pins.channel2);
|
||||||
try cfgChannel(pins.channel3);
|
try cfgChannel(pins.channel3);
|
||||||
|
try cfgChannel(pins.channel4);
|
||||||
|
try cfgChannel(pins.channel5);
|
||||||
try cfgChannel(pins.channelInt);
|
try cfgChannel(pins.channelInt);
|
||||||
|
|
||||||
var cfg = [_]ChannelConfig{
|
var cfg = [_]ChannelConfig{
|
||||||
ChannelConfig.init(Channels.ChannelInt, Animations.Candle),
|
ChannelConfig.init(Channels.ChannelInt, Animations.Candle),
|
||||||
ChannelConfig.init(Channels.Channel0, Animations.Candle),
|
ChannelConfig.init(Channels.Channel0, Animations.Candle),
|
||||||
ChannelConfig.init(Channels.Channel1, Animations.Pulse),
|
ChannelConfig.init(Channels.Channel1, Animations.Pulse),
|
||||||
|
ChannelConfig.init(Channels.Channel2, Animations.Candle),
|
||||||
|
ChannelConfig.init(Channels.Channel3, Animations.Candle),
|
||||||
|
ChannelConfig.init(Channels.Channel4, Animations.Candle),
|
||||||
|
ChannelConfig.init(Channels.Channel5, Animations.Candle),
|
||||||
};
|
};
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -105,6 +113,12 @@ pub fn main() !void {
|
||||||
Channels.Channel3 => {
|
Channels.Channel3 => {
|
||||||
pins.channel3.setLevel(level);
|
pins.channel3.setLevel(level);
|
||||||
},
|
},
|
||||||
|
Channels.Channel4 => {
|
||||||
|
pins.channel4.setLevel(level);
|
||||||
|
},
|
||||||
|
Channels.Channel5 => {
|
||||||
|
pins.channel5.setLevel(level);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
time.sleepMs(10);
|
time.sleepMs(10);
|
||||||
|
|
Loading…
Reference in New Issue