/* ADC Set the Injected Channel Data Offset. 
This value is subtracted from the injected channel results after conversion is complete, and can result in negative results. A separate value can be specified for each injected data register. */
void adc_set_injected_offset(uint32_t adc, uint8_t reg, uint32_t offset)
/* ADC Set the Injected Channel Data Offset. 
This value is subtracted from the injected channel results after conversion is complete, and can result in negative results. A separate value can be specified for each injected data register. */
void adc_set_injected_offset(uint32_t adc, uint8_t reg, uint32_t offset)
{
	switch (reg) {
	case 1:
		ADC_OFR1(adc) |= ADC_OFR1_OFFSET1_EN;
		ADC_OFR1(adc) |= offset;
		break;
	case 2:
		ADC_OFR2(adc) |= ADC_OFR2_OFFSET2_EN;
		ADC_OFR2(adc) |= offset;
		break;
	case 3:
		ADC_OFR3(adc) |= ADC_OFR3_OFFSET3_EN;
		ADC_OFR3(adc) |= offset;
		break;
	case 4:
		ADC_OFR4(adc) |= ADC_OFR4_OFFSET4_EN;
		ADC_OFR4(adc) |= offset;
		break;
	}
}