dsp0401.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Inria
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #pragma once
10 
23 #include <inttypes.h>
24 #include <stdint.h>
25 #include "periph/gpio.h"
26 #include "periph/pwm.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 enum {
36  DSP0401_OK = 0,
41 };
42 
46 typedef struct {
47  gpio_t sdi;
48  gpio_t clk;
49  gpio_t lat;
51  uint8_t pwm_channel;
52  uint8_t brightness;
53  uint8_t module_count;
55 
59 typedef struct {
61 } dsp0401_t;
62 
75 int dsp0401_init(dsp0401_t *dev, const dsp0401_params_t *params);
76 
83 void dsp0401_display_text(const dsp0401_t *dev, char *text);
84 
90 void dsp0401_clear_text(const dsp0401_t *dev);
91 
99 void dsp0401_scroll_text(const dsp0401_t *dev, char *text, uint16_t delay);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
Low-level GPIO peripheral driver interface definitions.
void dsp0401_clear_text(const dsp0401_t *dev)
Clear the text displayed on the DSP0401.
void dsp0401_scroll_text(const dsp0401_t *dev, char *text, uint16_t delay)
Scroll the given text on the DSP0401.
int dsp0401_init(dsp0401_t *dev, const dsp0401_params_t *params)
Initialize the given DSP0401.
void dsp0401_display_text(const dsp0401_t *dev, char *text)
Display the given text on the DSP0401.
@ DSP0401_ERR_CLK_GPIO
Something went wrong with CLK GPIO.
Definition: dsp0401.h:37
@ DSP0401_ERR_PWM
Something went wrong with PWM.
Definition: dsp0401.h:40
@ DSP0401_OK
All ok.
Definition: dsp0401.h:36
@ DSP0401_ERR_SDI_GPIO
Something went wrong with SDI GPIO.
Definition: dsp0401.h:38
@ DSP0401_ERR_LAT_GPIO
Something went wrong with LAT GPIO.
Definition: dsp0401.h:39
uint_fast8_t pwm_t
Default PWM type definition.
Definition: pwm.h:91
void delay(unsigned long msec)
Sleep for a given amount of time [milliseconds].
Adds include for missing inttype definitions.
Low-level PWM peripheral driver interface definitions.
Device initialization parameters.
Definition: dsp0401.h:46
uint8_t pwm_channel
PWM device channel.
Definition: dsp0401.h:51
gpio_t lat
Latch pin.
Definition: dsp0401.h:49
pwm_t pwm
PWM device.
Definition: dsp0401.h:50
gpio_t clk
Clock pin.
Definition: dsp0401.h:48
uint8_t module_count
Number of connected modules.
Definition: dsp0401.h:53
gpio_t sdi
Data input pin.
Definition: dsp0401.h:47
uint8_t brightness
LED brightness.
Definition: dsp0401.h:52
Device descriptor for the DSP0401.
Definition: dsp0401.h:59
dsp0401_params_t params
Device parameters.
Definition: dsp0401.h:60