Skip to content

Commit

Permalink
More document updates
Browse files Browse the repository at this point in the history
  • Loading branch information
amcelroy committed Oct 19, 2023
1 parent 9d05e06 commit af8e32c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ A peripheral represents the device that contains the registers, like the
Max17261 or Max14748. This is created using the `peripheral!` macro and takes
the following arguments:
- `Name`: The name of the peripheral struct to be created, for example `Max14748`
- `I2C Address`: Address of the I2C device
- `Number of registers`: This is used to allocate the memory used
to store all of the registers.
- `Register Map`: This is a list of tuples that are the register name, the
Expand Down Expand Up @@ -295,7 +296,7 @@ if the register is 16-bit and split into two quantized 8-bit values, this should
- `Min quantized value`: `f32` quantized value will be this value or higher
- `Max quantized value`: `f32` quantized value will be this or lower

*Note* The `set_` function input should be `min <= user request value <= max`. If this is
*Note:* The `set_` function input should be `min <= user request value <= max`. If this is
not the case, the `set_` function returns `None`. If the value is valid, the returned value
is `Some(quantized_value)`, where `quantized_value` is the integer representation stored in
the bit values designated.
Expand All @@ -307,8 +308,8 @@ register_backer!(Register, u16);
/** configure peripheral here **/
register!(MaxMinVolt);
bitrange_quantized!(MaxMinVolt, MaxVCell, 15, 8, u8, 0.02, 0.0, 255.0*0.02); // 20mv resolution
bitrange_quantized!(MaxMinVolt, MinVCell, 7, 0, u8, 0.02, 0.0, 255.0*0.02); // 20mv resolution
bitrange_quantized!(MaxMinVolt, MaxVCell, 15, 8, u8, 0.02, 0.0, u8::MAX as f32*0.02); // 20mv resolution
bitrange_quantized!(MaxMinVolt, MinVCell, 7, 0, u8, 0.02, 0.0, u8::MAX as f32*0.02); // 20mv resolution
```


Expand Down
2 changes: 2 additions & 0 deletions examples/max14748.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,5 +861,7 @@ pub fn main() {
max14748.ChgStatus().get_ChgStat().unwrap();
max14748.ChgStatus().set_ChgStat(ChgStatusEnum::Fault);

assert!(max14748.DevStatus1().get_ThrmSd120());

let bcstatus = max14748.BcStatus().get_VbusDet();
}

0 comments on commit af8e32c

Please sign in to comment.