Driver code for the IR sensor driver. More...
#include <stdint.h>
#include <sys/types.h>
#include "hardware/gpio.h"
#include "hardware/adc.h"
#include "irline/ir_sensor.h"
#include "irline/barcode.h"
Functions | |
uint16_t | ir_find_wall_directions (uint gpio_pin_left, uint gpio_pin_right) |
This returns the information of the walls in the node. More... | |
barcode_line_type_t | ir_read_barcode (void) |
This function reads the barcode and determines the colour and the thickness. More... | |
uint16_t | ir_read_line (uint gpio_pin_in) |
Detects line. More... | |
void | ir_setup_adc_pin (uint adc_pin) |
Initalises the analog pins for the IR sensor to ADC. More... | |
void | ir_setup_gpio_pin (uint gpio_pin) |
Initialises the digital pin for the IR sensor. More... | |
void | ir_update_left_flag (ir_flags_t *p_flag) |
Indicates whether there is a left wall. More... | |
void | ir_update_top_flag (ir_flags_t *p_flag) |
Indicates whether there is a top wall. More... | |
Driver code for the IR sensor driver.
uint16_t ir_find_wall_directions | ( | uint | gpio_pin_left, |
uint | gpio_pin_right | ||
) |
This returns the information of the walls in the node.
[in] | gpio_pin_left | GPIO pin for the left sensor |
[in] | gpio_pin_right | GPIO pin for the front sensor |
References ir_read_line().
barcode_line_type_t ir_read_barcode | ( | void | ) |
This function reads the barcode and determines the colour and the thickness.
References BARCODE_LINE_BLACK_THICK, BARCODE_LINE_BLACK_THIN, BARCODE_LINE_NONE, BARCODE_LINE_WHITE_THICK, and BARCODE_LINE_WHITE_THIN.
uint16_t ir_read_line | ( | uint | gpio_pin_in | ) |
Detects line.
[in] | gpio_pin_in | GPIO pin for the IR sensor |
void ir_setup_adc_pin | ( | uint | adc_pin | ) |
Initalises the analog pins for the IR sensor to ADC.
[in] | adc_pin | ADC pin for the IR sensor. |
void ir_setup_gpio_pin | ( | uint | gpio_pin | ) |
Initialises the digital pin for the IR sensor.
[in] | gpio_pin | GPIO pin for the IR sensor |
void ir_update_left_flag | ( | ir_flags_t * | p_flag | ) |
Indicates whether there is a left wall.
[out] | p_flag | Pointer to the indicator for the walls. |
References ir_flags::left_wall.
void ir_update_top_flag | ( | ir_flags_t * | p_flag | ) |
Indicates whether there is a top wall.
[out] | p_flag | Pointer to the indicator for the walls. |
References ir_flags::top_wall.