Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void CN0411_cmd_conv_mode(uint8_t *args, cn0411_device *cn0411_dev)
- {
- int32_t ret;
- uint8_t *p = args;
- char arg[5];
- /* Check if this function gets an argument */
- while (*(p = CN0411_find_argv(p)) != '\0') {
- /* Save conversion mode parameter */
- CN0411_get_argv(arg, p);
- }
- if(!strcmp(arg, "sing")) {
- ret = CN0411_adc_conv_init(cn0411_dev, ADC_SINGLE_CONV);
- printf("ADC set to single Conversion Mode.\n");
- } else if (!strcmp(arg, "cont")) {
- ret = CN0411_adc_conv_init(cn0411_dev, ADC_CONTINUOUS_CONV);
- printf("ADC set to continuous Conversion Mode.\n");
- } else {
- ret = CN0411_FAILURE;
- printf("Incorrect input value!\n");
- }
- if (ret != CN0411_SUCCESS) {
- printf("Conversion Mode initialization failed!\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement