While trying to change the analog reference voltage in ATMEL Studio for ATSAMC21 I found no way to configure this in ATMEL start and in the higher level drivers.
So I searched around the ASF a bit and found, that this function is only implemented in the HRI drivers.
However the usage of these drivers is not well documented (or I don't find the right document). The documentation gives these drivers just a general description, mostly on how the functions are named and what are available.
After some searching I found the HRI driver file HRI_SUPC_C21.h. In it there are several functions for changing the VREF register such as
static inline void hri_supc_write_VREF_reg(const void *const hw, hri_supc_vref_reg_t data)
{
SUPC_CRITICAL_SECTION_ENTER();
((Supc *)hw)->VREF.reg = data;
SUPC_CRITICAL_SECTION_LEAVE();
}
What confuses me, and also what the documentation does not explain, is:
- What is the "onst void *const hw" pointer?
- When I call this function, what value do I use here?
- If there is some initializing function for this "hw" how do I find this? (I'm asking in general, because most functions in the HRI driver files require this "hw" pointer
- If it is some constant value or address, how do I find this?
As this question is kind of related to my other question, for good measure here the link ATSAMC21 - Change ADC reference voltage