diff --git a/chip/zgpio.cpp b/chip/zgpio.cpp index 3272dda..1ac9efa 100644 --- a/chip/zgpio.cpp +++ b/chip/zgpio.cpp @@ -133,6 +133,8 @@ void regIRQGPIO(ZGPIO *gpio) { bool ZGPIO::isMirror() { return m_mirror; } void ZGPIO::initAsInput(Pin_t pin, GPIOMode_t mode, GPIOIrqType_t irqtype, bool mirror) { + ZEARLY_ASSERT(pin != PinNull); + m_mirror = mirror; m_mode = mode; m_irqtype = irqtype; @@ -186,6 +188,7 @@ void ZGPIO::initAsInput(Pin_t pin, GPIOMode_t mode, GPIOIrqType_t irqtype, bool return; } void ZGPIO::initAsOutput(Pin_t pin, GPIOMode_t mode, bool mirror, bool initLevel) { + ZEARLY_ASSERT(pin != PinNull); m_mirror = mirror; m_mode = mode; m_irqtype = kIRQ_noIrq; diff --git a/components/hardware/adc/z_simple_adc.cpp b/components/hardware/adc/z_simple_adc.cpp index c00e64e..16024b9 100644 --- a/components/hardware/adc/z_simple_adc.cpp +++ b/components/hardware/adc/z_simple_adc.cpp @@ -1,9 +1,10 @@ #include "z_simple_adc.hpp" using namespace iflytop; -void ZADC::initialize(ADC_HandleTypeDef* hadc1, int32_t channel, int32_t m_samplingTime) { - m_hadc1 = hadc1; - m_channel = channel; +void ZADC::initialize(ADC_HandleTypeDef* hadc1, int32_t channel, int32_t samplingTime) { + m_hadc1 = hadc1; + m_channel = channel; + m_samplingTime = samplingTime; } #if 0 @@ -31,5 +32,6 @@ int32_t ZADC::get_adc_value(int32_t& adcval) { } HAL_ADC_Start(m_hadc1); HAL_ADC_PollForConversion(m_hadc1, HAL_MAX_DELAY); - return (uint16_t)HAL_ADC_GetValue(m_hadc1); + adcval = (uint16_t)HAL_ADC_GetValue(m_hadc1); + return 0; } diff --git a/components/sensors/tmp117/tmp117.cpp b/components/sensors/tmp117/tmp117.cpp index fde6359..3d5d51a 100644 --- a/components/sensors/tmp117/tmp117.cpp +++ b/components/sensors/tmp117/tmp117.cpp @@ -12,6 +12,7 @@ using namespace iflytop; if (m_lastCallStatus != HAL_OK) { \ return 0; \ } +#ifdef HAL_I2C_MODULE_ENABLED TMP117::TMP117(/* args */) {} TMP117::~TMP117() {} @@ -90,3 +91,5 @@ uint16_t TMP117::getTemperatureOffset() { HAL_Delay(1); return ((buf[0] << 8) | buf[1]); } + +#endif \ No newline at end of file