hw/drivers/adc/adc_ads1015/src/adc_ads1015.c
int
ads1015_adc_dev_init(struct os_dev *odev, void *arg)
{
    struct adc_dev *dev;
    struct adc_driver_funcs *af;
    struct ads1015_adc_dev_cfg *cfg = (struct ads1015_adc_dev_cfg *) arg;
    assert(cfg != NULL);

    dev = (struct adc_dev *) odev;

    os_mutex_init(&dev->ad_lock);

    dev->ad_chans = (void *) ads1015_adc_chans;
    dev->ad_chan_count = ADS1015_CHANNEL_COUNT;

    log_register(odev->od_name, &_log, &log_console_handler, NULL, LOG_SYSLEVEL);

    //OS_DEV_SETHANDLERS(odev, nrf52_adc_open, nrf52_adc_close);
    af = &dev->ad_funcs;

    af->af_configure_channel = configure_channel;
    af->af_sample = 0;
    af->af_read_channel = read_channel;
    af->af_set_buffer = 0;
    af->af_release_buffer = 0;
    af->af_read_buffer = 0;
    af->af_size_buffer = 0;

    return (0);
}
/**
 * Callback to initialize an adc_dev structure from the os device
 * initialization callback.  This sets up a ads1015_adc_device(), so
 * that subsequent lookups to this device allow us to manipulate it.
 */
Callback to initialize an adc_dev structure from the os device
initialization callback.  This sets up a ads1015_adc_device(), so
that subsequent lookups to this device allow us to manipulate it.
Callback to initialize an adc_dev structure from the os device initialization callback . This sets up a ads1015_adc_device () so that subsequent lookups to this device allow us to manipulate it .
int
ads1015_adc_dev_init(struct os_dev *odev, void *arg)
{
    struct adc_dev *dev;
    struct adc_driver_funcs *af;
    struct ads1015_adc_dev_cfg *cfg = (struct ads1015_adc_dev_cfg *) arg;
    assert(cfg != NULL);
    dev = (struct adc_dev *) odev;
    os_mutex_init(&dev->ad_lock);
    dev->ad_chans = (void *) ads1015_adc_chans;
    dev->ad_chan_count = ADS1015_CHANNEL_COUNT;
    log_register(odev->od_name, &_log, &log_console_handler, NULL, LOG_SYSLEVEL);
    af = &dev->ad_funcs;
    af->af_configure_channel = configure_channel;
    af->af_sample = 0;
    af->af_read_channel = read_channel;
    af->af_set_buffer = 0;
    af->af_release_buffer = 0;
    af->af_read_buffer = 0;
    af->af_size_buffer = 0;
    return (0);
}
int ads1015_adc_dev_init ( struct os_dev * odev , void * arg ) { struct adc_dev * dev ; struct adc_driver_funcs * af ; struct ads1015_adc_dev_cfg * cfg = ( struct ads1015_adc_dev_cfg * ) arg ; assert ( cfg != NULL ) ; dev = ( struct adc_dev * ) odev ; os_mutex_init ( & dev -> ad_lock ) ; dev -> ad_chans = ( void * ) ads1015_adc_chans ; dev -> ad_chan_count = ADS1015_CHANNEL_COUNT ; log_register ( odev -> od_name , & _log , & log_console_handler , NULL , LOG_SYSLEVEL ) ; af = & dev -> ad_funcs ; af -> af_configure_channel = configure_channel ; af -> af_sample = 0 ; af -> af_read_channel = read_channel ; af -> af_set_buffer = 0 ; af -> af_release_buffer = 0 ; af -> af_read_buffer = 0 ; af -> af_size_buffer = 0 ; return ( 0 ) ; }
Callback to initialize an adc_dev structure from the os device
 initialization callback.
Callback to initialize an adc_dev structure from the os device initialization callback .
//OS_DEV_SETHANDLERS(odev, nrf52_adc_open, nrf52_adc_close);