Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/microchip/atmega/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub fn build(b: *std.Build) void {
const available_examples = [_]Example{
.{ .target = mb.ports.atmega.boards.arduino.nano, .name = "arduino-nano_blinky", .file = "src/blinky.zig" },
.{ .target = mb.ports.atmega.boards.arduino.uno_rev3, .name = "arduino-uno_blinky", .file = "src/blinky.zig" },
.{ .target = mb.ports.atmega.boards.emakefun.rf_nano_v3, .name = "rf-nano-v3_blinky", .file = "src/blinky.zig" },
};

for (available_examples) |example| {
Expand Down
12 changes: 12 additions & 0 deletions port/microchip/atmega/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ boards: struct {
adafruit: struct {
itsybitsy_32u4: *const microzig.Target,
},
emakefun: struct {
rf_nano_v3: *const microzig.Target,
},
},

pub fn init(dep: *std.Build.Dependency) ?Self {
Expand Down Expand Up @@ -99,6 +102,15 @@ pub fn init(dep: *std.Build.Dependency) ?Self {
},
}),
},
.emakefun = .{
.rf_nano_v3 = chip_atmega328p.derive(.{
.board = .{
.name = "Emakefun RF-Nano V3.0",
.url = "https://github.com/emakefun/rf-nano",
.root_source_file = b.path("src/boards/rf_nano_v3.zig"),
},
}),
},
},
};
}
Expand Down
59 changes: 59 additions & 0 deletions port/microchip/atmega/src/boards/rf_nano_v3.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//! Emakefun RF-Nano V3.0: Arduino Nano V3.0 compatible board with an onboard
//! nRF24L01+ (or Si24R1) wired to the hardware SPI bus.
//!
//! - Radio: CE = D7 (PD7), CS = D8 (PB0), SCK = D13 (PB5), HODI = D11 (PB3), HIDO = D12 (PB4).
//! - The radio IRQ pin is not connected; poll the STATUS register instead.
//! - The onboard LED shares D13 (PB5) with SCK, so it flickers with SPI traffic.
//! - D7, D8, D11, D12 and D13 are used by the radio.
//!
//! Schematic: https://github.com/emakefun/rf-nano/blob/master/schematic/rf-nano_sch_v3.0.pdf

pub const chip = @import("chip");

pub const clock_frequencies = .{
.cpu = 16_000_000,
};

pub const pin_map = .{
// Port D
.D0 = "PD0",
.D1 = "PD1",
.D2 = "PD2",
.D3 = "PD3",
.D4 = "PD4",
.D5 = "PD5",
.D6 = "PD6",
.D7 = "PD7",

// Port B
.D8 = "PB0",
.D9 = "PB1",
.D10 = "PB2",
.D11 = "PB3",
.D12 = "PB4",
.D13 = "PB5",

// Port C (Analog)
.A0 = "PC0",
.A1 = "PC1",
.A2 = "PC2",
.A3 = "PC3",
.A4 = "PC4",
.A5 = "PC5",
.A6 = "ADC6",
.A7 = "ADC7",

// Onboard LED
.LED = "PB5",

// nRF24L01+ radio
.NRF_CE = "PD7",
.NRF_CS = "PB0",
.SCK = "PB5",
.HODI = "PB3",
.HIDO = "PB4",

// I2C (TWI)
.SDA = "PC4",
.SCL = "PC5",
};
Loading