support for reading ADC calibration values

remotes/github/master
Ondřej Hruška 7 years ago
parent de75f2d91c
commit a66c453820
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 17
      units/adc/unit_adc.c
  2. 2
      version.h

@ -13,6 +13,7 @@
enum AdcCmd_ {
CMD_READ_RAW = 0,
CMD_READ_SMOOTHED = 1,
CMD_READ_CAL_CONSTANTS = 2,
CMD_GET_ENABLED_CHANNELS = 10,
CMD_GET_SAMPLE_RATE = 11,
@ -101,6 +102,22 @@ static error_t UADC_handleRequest(Unit *unit, TF_ID frame_id, uint8_t command, P
}
return E_SUCCESS;
/** Read ADC calibration constants */
case CMD_READ_CAL_CONSTANTS:
{
pb_u16(&pb, *VREFINT_CAL_ADDR); // VREFINT_CAL
pb_u16(&pb, VREFINT_CAL_VREF); // Vref pin voltage during calibration (usually bonded to Vdd)
pb_u16(&pb, *TEMPSENSOR_CAL1_ADDR); // TEMPSENSOR_CAL1
pb_u16(&pb, *TEMPSENSOR_CAL2_ADDR); // TEMPSENSOR_CAL2
pb_u8(&pb, TEMPSENSOR_CAL1_TEMP); // temperature for CAL1
pb_u8(&pb, TEMPSENSOR_CAL2_TEMP); // temperature for CAL2
pb_u16(&pb, TEMPSENSOR_CAL_VREFANALOG); // VREFINT_CAL_VREF - Vref pin voltage during calibration (usually bonded to Vdd)
com_respond_pb(frame_id, MSG_SUCCESS, &pb);
}
return E_SUCCESS;
/**
* Enable channels. The channels must've been configured in the settings (except ch 16 and 17 which are available always)
* pld: u32: bitmap of channels

@ -7,6 +7,6 @@
#ifndef GEX_VERSION_H
#define GEX_VERSION_H
#define GEX_VERSION "0.1.0"
#define GEX_VERSION "0.2.0"
#endif //GEX_VERSION_H

Loading…
Cancel
Save