Exemplo n.º 1
0
//-------------------------------------------------------------------------------------------------
static le_result_t cm_adc_ReadAndPrintValue
(
    const char* channelName
)
{
    int i;
    le_result_t result = LE_FAULT;
    int32_t value;
    bool found = false;

    for (i = 0; i < LE_ADC_MAX; i++)
    {
        if (strcmp(AdcList[i].channelNameStr, channelName) == 0)
        {
            found = true;
            result = le_adc_ReadValue(AdcList[i].adcChannel, &value);
            if (result == LE_OK)
            {
                printf("%s:%d\n", channelName, value);
            }
            break;
        }
    }

    if (!found)
    {
        printf("Unknown channel: %s\n", channelName);
    }

    return result;
}
Exemplo n.º 2
0
le_result_t mangOH_ReadLightSensor
(
    int32_t *reading
)
{
    return le_adc_ReadValue(lightSensorAdc, reading);
}
Exemplo n.º 3
0
//-------------------------------------------------------------------------------------------------
static le_result_t cm_adc_ReadAndPrintValue
(
    const char* channelName
)
{
    le_result_t result = LE_FAULT;
    int32_t value;

    result = le_adc_ReadValue(channelName, &value);

    if (result == LE_OK)
    {
        printf("%s:%d\n", channelName, value);
    }

    return result;
}