OLED1 Xplained Pro LED and button driver for FreeRTOS demo.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | oled1_instance |
Driver instance struct. More... | |
Macros | |
#define | _OLED1_CREATE_INSTANCE(name, ext_header) |
#define | OLED1_CREATE_INSTANCE(name, ext_header) _OLED1_CREATE_INSTANCE(name, ext_header) |
Create a driver instance. More... | |
Constants | |
#define | OLED1_LED_ACTIVE false |
Active level for LEDs. More... | |
#define | OLED1_BUTTON_ACTIVE false |
Active level for buttons. More... | |
Enumerations | |
enum | oled1_button_id { OLED1_BUTTON1_ID, OLED1_BUTTON2_ID, OLED1_BUTTON3_ID, OLED1_BUTTON1_ID, OLED1_BUTTON2_ID, OLED1_BUTTON3_ID, OLED1_BUTTON1_ID, OLED1_BUTTON2_ID, OLED1_BUTTON3_ID, OLED1_BUTTON1_ID, OLED1_BUTTON2_ID, OLED1_BUTTON3_ID } |
IDs for each of the on-board buttons. More... | |
enum | oled1_led_id { OLED1_LED1_ID, OLED1_LED2_ID, OLED1_LED3_ID, OLED1_LED1_ID, OLED1_LED2_ID, OLED1_LED3_ID, OLED1_LED1_ID, OLED1_LED2_ID, OLED1_LED3_ID, OLED1_LED1_ID, OLED1_LED2_ID, OLED1_LED3_ID } |
IDs for each of the on-board LEDs. More... | |
Functions | |
static void | oled1_init (const struct oled1_instance *const oled1) |
Initialize hardware for driver instance. More... | |
LED manipulation | |
static uint8_t | _oled1_get_led_pin (const struct oled1_instance *const oled1, const enum oled1_led_id led_id) |
Get the pin identifier for a given LED number in instance. More... | |
static bool | oled1_get_led_state (const struct oled1_instance *const oled1, const enum oled1_led_id led_id) |
Get the state of a LED. More... | |
static void | oled1_set_led_state (const struct oled1_instance *const oled1, const enum oled1_led_id led_id, const bool state) |
Set the state of a LED. More... | |
static void | oled1_toggle_led_state (const struct oled1_instance *const oled1, const enum oled1_led_id led_id) |
Set the state of a LED. More... | |
Button manipulation | |
static uint8_t | _oled1_get_button_pin (const struct oled1_instance *const oled1, const enum oled1_button_id button_id) |
Get the pin identifier for a given button number in instance. More... | |
static bool | oled1_get_button_state (const struct oled1_instance *const oled1, const enum oled1_button_id button_id) |
Get the state of a button. More... | |
|
inlinestatic |
Get the pin identifier for a given button number in instance.
oled1_instance | Driver instance to fetch pin identifier from. |
led_id | ID of the button to fetch pin identifier for. |
References oled1_instance::button0_pin, oled1_instance::button1_pin, oled1_instance::button2_pin, OLED1_BUTTON1_ID, OLED1_BUTTON2_ID, and OLED1_BUTTON3_ID.
Referenced by oled1_get_button_state().
|
inlinestatic |
Get the pin identifier for a given LED number in instance.
oled1 | Address of driver instance to fetch pin identifier from. |
led_id | ID of the LED to fetch pin identifier for. |
References oled1_instance::led0_pin, oled1_instance::led1_pin, oled1_instance::led2_pin, OLED1_LED1_ID, OLED1_LED2_ID, and OLED1_LED3_ID.
Referenced by oled1_get_led_state(), oled1_set_led_state(), and oled1_toggle_led_state().
|
inlinestatic |
Get the state of a button.
oled1 | Address of driver instance to operate on. |
led_id | ID of the button to get state of. |
true | if button is active, i.e., pressed. |
false | if button is not active. |
References _oled1_get_button_pin(), OLED1_BUTTON_ACTIVE, and port_pin_get_input_level().
|
inlinestatic |
Get the state of a LED.
oled1 | Address of driver instance to operate on. |
led_id | ID of the LED to get state of. |
true | if LED is active, i.e., lit up. |
false | if LED is not active. |
References _oled1_get_led_pin(), OLED1_LED_ACTIVE, and port_pin_get_input_level().
|
inlinestatic |
Initialize hardware for driver instance.
This function initializes the hardware (pins) that belong to the specified driver instance.
oled1 | Address of driver instance to initialize hardware for. |
References oled1_instance::button0_pin, oled1_instance::button1_pin, oled1_instance::button2_pin, port_config::direction, port_config::input_pull, oled1_instance::led0_pin, oled1_instance::led1_pin, oled1_instance::led2_pin, OLED1_LED_ACTIVE, port_get_config_defaults(), PORT_PIN_DIR_INPUT, PORT_PIN_DIR_OUTPUT_WTH_READBACK, PORT_PIN_PULL_NONE, PORT_PIN_PULL_UP, port_pin_set_config(), and port_pin_set_output_level().
|
inlinestatic |
Set the state of a LED.
oled1 | Address of driver instance to operate on. |
led_id | ID of the LED to set state of. |
state | State to set LED to:
|
References _oled1_get_led_pin(), OLED1_LED_ACTIVE, and port_pin_set_output_level().
|
inlinestatic |
Set the state of a LED.
oled1 | Address of driver instance to operate on. |
led_id | ID of the LED to toggle state of. |
References _oled1_get_led_pin(), and port_pin_toggle_output_level().