Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Classes for Hardware Attributes #13

Open
tyler-gilbert opened this issue Oct 8, 2017 · 0 comments
Open

Add Classes for Hardware Attributes #13

tyler-gilbert opened this issue Oct 8, 2017 · 0 comments

Comments

@tyler-gilbert
Copy link
Member

Add classes for hardware attributes. For example:

class UartAttr {
public:
	u8 port() const { return m_port; }
	const uart_attr_t & attr() const { return m_attr; }
	mcu_pin_t tx() const { return m_attr.pin_assignment.tx; }
	mcu_pin_t rx() const { return m_attr.pin_assignment.rx; }
	mcu_pin_t cts() const { return m_attr.pin_assignment.cts; }
	mcu_pin_t rts() const { return m_attr.pin_assignment.rts; }


	void set_tx(const mcu_pin_t & pin){ m_attr.pin_assignment.tx = pin;}
	void set_rx(const mcu_pin_t & pin){ m_attr.pin_assignment.rx = pin;}
	void set_cts(const mcu_pin_t & pin){ m_attr.pin_assignment.cts = pin;}
	void set_rts(const mcu_pin_t & pin){ m_attr.pin_assignment.rts = pin;}
	void set_port(u8 p){ m_port = p; }
	void set_flags(u32 flags){ m_attr.o_flags = flags; }
	void set_freq(u32 f){ m_attr.freq = f; }
	void set_width(u32 w){ m_attr.width = w; }
private:
	u8 m_port;
	uart_attr_t m_attr;
};

Then add methods to sys::Cli to parse and handle attributes for each hardware type.

@tyler-gilbert tyler-gilbert added this to the 2.5.0 milestone Mar 1, 2018
@tyler-gilbert tyler-gilbert modified the milestones: 2.5.0, 2.6.0 Apr 6, 2018
@tyler-gilbert tyler-gilbert removed this from the 3.7.0 milestone Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant