Easylab board and new dsPIC ERIKA Enterprise Driver API

From ErikaWiki

(Difference between revisions)
Jump to: navigation, search
(Buzzer)
Line 133: Line 133:
* ''EE_INT8 EE_easylab_adc_init_ch(EE_AdcChId adc_ch_id, EE_Adc_VoltageRef volt_ref, EE_Adc_BitResolution bit_res);''
* ''EE_INT8 EE_easylab_adc_init_ch(EE_AdcChId adc_ch_id, EE_Adc_VoltageRef volt_ref, EE_Adc_BitResolution bit_res);''
-
*: Description: Inizialize . The parameter '''freq''' is the frequency value and it's value is from 100 to 48000 Hz.
+
*: Description: Initialize an specific ADC channel. The parameter can be used are the follow:
 +
*:    '''adc_ch_id''': Is the ADC channel, the value can be: EE_ADC_AN1, EE_ADC_AN2, EE_ADC_AN3 or EE_ADC_AN4.
 +
*:    '''volt_ref''' : Is the Ref for ADC conversion. At this parameter can be assigned the follow value:
 +
*:                  EE_ADC_VDD_VSS    = 0x0,
 +
*:                  EE_ADC_VREFh_VSS  = 0x1,
 +
*:                  EE_ADC_VDD_VREFl  = 0x02,
 +
*:                  EE_ADC_VREFh_VREFl = 0x7

Revision as of 15:00, 31 January 2012

Contents

Introduction

During the development of Erika support for easylab some new API have created and other ones have been updated. Follow an overview of these changes, but to be sure that the information of this page are updated double check the code.

Easylab Board API

The EasyLab board is fully supported by Erika Rtos. This chapter describes the API support done in Erika Enterprise for the Evidence EasyLab Board. To configure the usage of the EasyLab Board, the user has to specify an appropriate BOARD_DATA in OIL file , as in the following example:

...
BOARD_DATA = EE_EASYLAB {
...
}
...

this OIL element enable the inclusion of pkg/board/ee_easylab/inc/ee_board.h as board header.


System LED

The Microstic Guest board has a system LED attached to a GPIO pin of the microcontroller. To use the system LED, the developer should specify the USELEDS attribute as TRUE, as in the following example:

...
BOARD_DATA = EE_EASYLAB {
  USELEDS = TRUE;
  ...
}
...

The following paragraphs will describe the functions available to control the easyLab System LED.

  • void EE_sys_led_init(void);
    Description: Initialize the system LED (the one on microstick). The LED starts turned off.
  • void EE_sys_led_on(void);
    Description: The function turns on the system LED (the one on microstick).
  • void EE_led_sys_off(void);
    Description: The function turns off the system LED (the one on microstick).

Board LEDs

The EasyLab includes 8 red LEDs. To use the board LEDs the developer have to specify the USELEDS attribute as TRUE, as in the following example (same OIL configuration of the System LED):

...
BOARD_DATA = EE_EASYLAB {
  USELEDS = TRUE;
  ...
}
...

The API for board LEDS control are the follow:

  • void EE_leds_init(void);
    Description: Initialize all LEDS present on the board. The LEDs starts turned off.
  • void EE_leds_enable(void);
    Description: Turn on all the LEDs present on the board (system LED too).
  • void EE_leds_disable(void);
    Description: Turn off all the LEDs present on the board (system LED too).
  • void EE_ledx_init(void); (x=1,...,8)
    Description: Initialize the LEDx present on the board (x=1,...,8). The LED starts turned off.
  • void EE_ledx_on(void); (x=1,...,8)
    Description: Turn on the LEDx present on the board (x=1,...,8).
  • void EE_led1_off(void); (x=1,...,8)
    Description: Turn off the LEDx present on the board (x=1,...,8).
  • void EE_led1_toggle(void); (x=1,...,8)
    Description: Toggle the LEDx present on the board (x=1,...,8).

Digital Pin I/O

The same pins connected to board LEDS can be used how general Digital Pin I/O. These pins are exported on board connectors.

For their use on the board the developer have to specify the USE_DIO attribute as TRUE, as in the following example (same OIL configuration of the DIO):

...
BOARD_DATA = EE_EASYLAB {
  USEDIO = TRUE;
  ...
}
...

The API than uses the digital pins I/O (DIO) are the follow:

  • void EE_diox_configure(EE_BIT in); (x=1,...,8)
    Description: Initialize the pinx (x=1,...,8). If the in parameter is 0 (zero) the pin is output while 1 is input.
  • void EE_diox_write(EE_BIT bit); (x=1,...,8)
    Description: If the parameter in=1 the output pin is 1 logic, while if the parameter in=0 the output pin is 0 logic.
  • int EE_BIT EE_diox_read(void); (x=1,...,8)
    Description: The API return the logic value on pinx when it is configured as input.

Buzzer

On the EasyLab board is present a simple piezo buzzer. When the users wants use it in a his project, he has to write, in the OIL file, something like this:

...
BOARD_DATA = EE_EASYLAB {
  USEBUZZER = TRUE;
  ...
}
...

The API are the follow:

  • void EE_buzzer_start(EE_UINT16 freq);
    Description: Start on the buzzer. The parameter freq is the frequency value and it's value is from 100 to 48000 Hz.
  • void EE_buzzer_stop(void);
    Description: Turn off the buzzer sound.

ADC Channels

The EasyLab board has 4 input analog to digital converter (ADCx). If an application uses the ADC functionality in necessary modified the OIL file adding the option USEADC:

...
BOARD_DATA = EE_EASYLAB {
  USEADC = TRUE;
  ...
}
...

The ADC's API are the follow:

  • EE_INT8 EE_easylab_adc_init_ch(EE_AdcChId adc_ch_id, EE_Adc_VoltageRef volt_ref, EE_Adc_BitResolution bit_res);
    Description: Initialize an specific ADC channel. The parameter can be used are the follow:
    adc_ch_id: Is the ADC channel, the value can be: EE_ADC_AN1, EE_ADC_AN2, EE_ADC_AN3 or EE_ADC_AN4.
    volt_ref : Is the Ref for ADC conversion. At this parameter can be assigned the follow value:
    EE_ADC_VDD_VSS = 0x0,
    EE_ADC_VREFh_VSS = 0x1,
    EE_ADC_VDD_VREFl = 0x02,
    EE_ADC_VREFh_VREFl = 0x7
Personal tools