1
0
mirror of https://github.com/sendyne/cppreg.git synced 2025-05-09 23:24:05 +00:00

FIX QUICK START DOCUMENTATION

This commit is contained in:
Nicolas Clauvelin 2018-03-16 07:53:00 -04:00
parent 8cdc89336f
commit 53b74b2b5c

View File

@ -76,8 +76,8 @@ struct Peripheral {
// Define the setup register and the fields. // Define the setup register and the fields.
struct Setup : PackedRegister< struct Setup : PackedRegister<
periph_pack, // Pack to which the register belongs to. periph_pack, // Pack to which the register belongs to.
0, // Offset in bits from the base. RegBitSize::b8, // Register size.
8 // Register width in bits 0 // Offset in bits from the base.
> { > {
// When defining a Field-based type: // When defining a Field-based type:
@ -94,8 +94,8 @@ struct Peripheral {
// Define the RX data register. // Define the RX data register.
struct RX : PackedRegister< struct RX : PackedRegister<
periph_pack, // Pack to which the register belongs to. periph_pack, // Pack to which the register belongs to.
8, // Offset in bits from the base. RegBitSize::b8, // Register width in bits
8 // Register width in bits 8 // Offset in bits from the base.
> { > {
using Data = Field<RX, 8u, 0u, read_only>; using Data = Field<RX, 8u, 0u, read_only>;
}; };
@ -103,8 +103,8 @@ struct Peripheral {
// Define the RX data register. // Define the RX data register.
struct TX : PackedRegister< struct TX : PackedRegister<
periph_pack, // Pack to which the register belongs to. periph_pack, // Pack to which the register belongs to.
8 * 2, // Offset in bits from the base. RegBitSize::b8, // Register width in bits
8 // Register width in bits 8 * 2 // Offset in bits from the base.
> { > {
using Data = Field<TX, 8u, 0u, read_only>; using Data = Field<TX, 8u, 0u, read_only>;
}; };
@ -229,25 +229,25 @@ namespace gpio {
// Register pack. // Register pack.
// 6 x 32-bits = 6 x 4 bytes. // 6 x 32-bits = 6 x 4 bytes.
using gpio_pack = RegisterPack<0xF4000000, 6 * 4>; using gpio_pack = RegisterPack<0xF4000000, 6 * 8>;
// Data output register (PDOR). // Data output register (PDOR).
using pdor = PackedRegister<gpio_pack, 0 * 32, 32u>; using pdor = PackedRegister<gpio_pack, RegBitSize::b32, 0 * 32>;
// Set output register (PSOR). // Set output register (PSOR).
using psor = PackedRegister<gpio_pack, 1 * 32, 32u>; using psor = PackedRegister<gpio_pack, RegBitSize::b32, 1 * 32>;
// Clear output register (PCOR). // Clear output register (PCOR).
using pcor = PackedRegister<gpio_pack, 2 * 32, 32u>; using pcor = PackedRegister<gpio_pack, RegBitSize::b32, 2 * 32>;
// Toggle output register (PTOR). // Toggle output register (PTOR).
using ptor = PackedRegister<gpio_pack, 3 * 32, 32u>; using ptor = PackedRegister<gpio_pack, RegBitSize::b32, 3 * 32>;
// Data input register. // Data input register.
using pdir = PackedRegister<gpio_pack, 4 * 32, 32u>; using pdir = PackedRegister<gpio_pack, RegBitSize::b32, 4 * 32>;
// Data direction output register. // Data direction output register.
using pddr = PackedRegister<gpio_pack, 5 * 32, 32u>; using pddr = PackedRegister<gpio_pack, RegBitSize::b32, 5 * 32>;
} }
``` ```