SRA Board Components
ESP-IDF component for SRA Board
Classes | Functions
shift_register.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "pin_defs.h"
#include "utils.h"
#include "driver/gpio.h"
#include "hal/gpio_types.h"
#include "driver/gptimer.h"
#include "driver/gptimer_types.h"
#include "esp_err.h"
#include "esp_check.h"
Include dependency graph for shift_register.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  shift_register_t
 The handle used for representing the shift register. More...
 

Functions

esp_err_t shift_register_gpio_init (shift_register_t *conf)
 Initialises the GPIO Pins for the Shift Register Present on the SRA Board. More...
 
esp_err_t shift_register_write_uint8 (const shift_register_t *sreg, const uint8_t data, const bool instant)
 Writes a single byte to the shift register and latches it (single shift register) More...
 
esp_err_t shift_register_write_uint32 (const shift_register_t *sreg, const uint32_t data, const bool instant)
 Writes a four bytes to the shift register and latches it (four cascaded shift registers) More...
 
esp_err_t shift_register_cleanup (shift_register_t sreg)
 Performs cleanup on the shift register contents. More...
 

Function Documentation

◆ shift_register_cleanup()

esp_err_t shift_register_cleanup ( shift_register_t  sreg)

Performs cleanup on the shift register contents.

Parameters
sregThe handle to use and represent the shift register
Returns
Returns an error if there is an error while cleaning up the general purpose timer, else returns ESP_OK

◆ shift_register_gpio_init()

esp_err_t shift_register_gpio_init ( shift_register_t conf)

Initialises the GPIO Pins for the Shift Register Present on the SRA Board.

Parameters
confThe handle to use and represent the shift registers.
Returns
Returns an error if NULL shift register is passed or if there is an error during configuring the GPIOs or timer, else returns ESP_OK

◆ shift_register_write_uint32()

esp_err_t shift_register_write_uint32 ( const shift_register_t sreg,
const uint32_t  data,
const bool  instant 
)

Writes a four bytes to the shift register and latches it (four cascaded shift registers)

Parameters
sregThe handle to use and represent the shift registers.
dataThe data to be sent to the shift register.
instantThis parameter defines the way in which the data is latched to the output register, all 8 bits at once or one-by-one.
Returns
Returns an error if a NULL shift register is passed, else returns ESP_OK

◆ shift_register_write_uint8()

esp_err_t shift_register_write_uint8 ( const shift_register_t sreg,
const uint8_t  data,
const bool  instant 
)

Writes a single byte to the shift register and latches it (single shift register)

Parameters
sregThe handle to use and represent the shift registers.
dataThe data to be sent to the shift register.
instantThis parameter defines the way in which the data is latched to the output register, all 8 bits at once or one-by-one.
Returns
Returns an error if a NULL shift register is passed, else returns ESP_OK