You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is my first open-source discussion. Apologies in case I am not aware of some etiquettes.
I wanted to propose following asynchronous trait in embedded-hal-async for HW timers which I have reviewed with respect to NXP RT6xx, STM32 and Infineon PSOC62 design its fitting correctly with the design. The requirements for the HW timer moduels are -
1 - User shall be able to start Counting Timer
2 - User shall be able to start Capture Timer for capturing timestamp for an event
3 - User shall be able to pass input event for capturing timestamp
4 - User shall be able to pass output event to capture timer match/capture event in a HW pin
TriggerInput -
Logical event space for input events. Used to capturing timer counter value
HW implementation needs to map from logical to physical event representation
TriggerOutput -
Logical event space for output events. Used to set a GPIO pin based on match or capture event
HW implementation needs to map from logical to physical event representation
// This super trait will be useful to access the logical timer ID
// An implementation can choose to implement a timer as a logical entity keeping HW details away from user. In that case, logical //entity is required to be identified with an ID field for later uses like resource release/cleanup once timer usage is completed.
// In case implementation chooses to expose HW details such as base address of the timer module, the get_id can be left blank or // return base address of the HW module
trait AsyncTimerId {
fn get_id(&self) -> usize;
}
pub trait AsyncTimer : AsyncTimerId {
/// Starts a timer with the specified count and event input/output.
/// # Arguments
/// * count - The count value for the timer.
/// * event_input - The event input for the timer.
/// * event_output - The event output for the timer.
/// This function takes event input and output as option to provide flexibility to user to use it or not.
fn start(&mut self, count: u32, event_input: Option, event_output: Option);
/// Waits asynchronously for the count/capture timer to complete or to record an event timestamp.
async fn wait(&mut self);
}
Please let me know in case I need to add more info.
Thanks and Regards
Shaibal
The text was updated successfully, but these errors were encountered:
Hello Everyone,
This is my first open-source discussion. Apologies in case I am not aware of some etiquettes.
I wanted to propose following asynchronous trait in embedded-hal-async for HW timers which I have reviewed with respect to NXP RT6xx, STM32 and Infineon PSOC62 design its fitting correctly with the design. The requirements for the HW timer moduels are -
1 - User shall be able to start Counting Timer
2 - User shall be able to start Capture Timer for capturing timestamp for an event
3 - User shall be able to pass input event for capturing timestamp
4 - User shall be able to pass output event to capture timer match/capture event in a HW pin
TriggerInput -
TriggerOutput -
// This super trait will be useful to access the logical timer ID
// An implementation can choose to implement a timer as a logical entity keeping HW details away from user. In that case, logical //entity is required to be identified with an ID field for later uses like resource release/cleanup once timer usage is completed.
// In case implementation chooses to expose HW details such as base address of the timer module, the get_id can be left blank or // return base address of the HW module
trait AsyncTimerId {
fn get_id(&self) -> usize;
}
pub trait AsyncTimer : AsyncTimerId {
/// Starts a timer with the specified count and event input/output.
/// # Arguments
/// *
count
- The count value for the timer./// *
event_input
- The event input for the timer./// *
event_output
- The event output for the timer./// This function takes event input and output as option to provide flexibility to user to use it or not.
fn start(&mut self, count: u32, event_input: Option, event_output: Option);
}
Please let me know in case I need to add more info.
Thanks and Regards
Shaibal
The text was updated successfully, but these errors were encountered: