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 
21 #ifndef DSP0401_H
22 #define DSP0401_H
23 
24 #include <inttypes.h>
25 #include <stdint.h>
26 #include "periph/gpio.h"
27 #include "periph/pwm.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
36 enum {
37  DSP0401_OK = 0,
42 };
43 
47 typedef struct {
48  gpio_t sdi;
49  gpio_t clk;
50  gpio_t lat;
52  uint8_t pwm_channel;
53  uint8_t brightness;
54  uint8_t module_count;
56 
60 typedef struct {
62 } dsp0401_t;
63 
76 int dsp0401_init(dsp0401_t *dev, const dsp0401_params_t *params);
77 
84 void dsp0401_display_text(const dsp0401_t *dev, char *text);
85 
91 void dsp0401_clear_text(const dsp0401_t *dev);
92 
100 void dsp0401_scroll_text(const dsp0401_t *dev, char *text, uint16_t delay);
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif /* DSP0401_H */
107 
dsp0401_clear_text
void dsp0401_clear_text(const dsp0401_t *dev)
Clear the text displayed on the DSP0401.
DSP0401_ERR_SDI_GPIO
@ DSP0401_ERR_SDI_GPIO
Something went wrong with SDI GPIO.
Definition: dsp0401.h:39
dsp0401_params_t::clk
gpio_t clk
Clock pin.
Definition: dsp0401.h:49
DSP0401_ERR_LAT_GPIO
@ DSP0401_ERR_LAT_GPIO
Something went wrong with LAT GPIO.
Definition: dsp0401.h:40
dsp0401_params_t::lat
gpio_t lat
Latch pin.
Definition: dsp0401.h:50
DSP0401_ERR_CLK_GPIO
@ DSP0401_ERR_CLK_GPIO
Something went wrong with CLK GPIO.
Definition: dsp0401.h:38
dsp0401_params_t::pwm_channel
uint8_t pwm_channel
PWM device channel.
Definition: dsp0401.h:52
dsp0401_params_t
Device initialization parameters.
Definition: dsp0401.h:47
dsp0401_scroll_text
void dsp0401_scroll_text(const dsp0401_t *dev, char *text, uint16_t delay)
Scroll the given text on the DSP0401.
dsp0401_init
int dsp0401_init(dsp0401_t *dev, const dsp0401_params_t *params)
Initialize the given DSP0401.
delay
void delay(unsigned long msec)
Sleep for a given amount of time [milliseconds].
dsp0401_t
Device descriptor for the DSP0401.
Definition: dsp0401.h:60
dsp0401_params_t::sdi
gpio_t sdi
Data input pin.
Definition: dsp0401.h:48
gpio.h
Low-level GPIO peripheral driver interface definitions.
dsp0401_params_t::module_count
uint8_t module_count
Number of connected modules.
Definition: dsp0401.h:54
dsp0401_params_t::brightness
uint8_t brightness
LED brightness.
Definition: dsp0401.h:53
DSP0401_OK
@ DSP0401_OK
All ok.
Definition: dsp0401.h:37
pwm.h
Low-level PWM peripheral driver interface definitions.
pwm_t
unsigned int pwm_t
Default PWM type definition.
Definition: pwm.h:92
dsp0401_t::params
dsp0401_params_t params
Device parameters.
Definition: dsp0401.h:61
DSP0401_ERR_PWM
@ DSP0401_ERR_PWM
Something went wrong with PWM.
Definition: dsp0401.h:41
inttypes.h
Adds include for missing inttype definitions.
dsp0401_display_text
void dsp0401_display_text(const dsp0401_t *dev, char *text)
Display the given text on the DSP0401.
dsp0401_params_t::pwm
pwm_t pwm
PWM device.
Definition: dsp0401.h:51