template for .c .h
This commit is contained in:
parent
3dd32d039c
commit
a5da739f65
45
RpiLedBars/res/src/c.template
Normal file
45
RpiLedBars/res/src/c.template
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/** \file .c
|
||||||
|
* \brief This module
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Includes
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Preprocessor Constants and Macros
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Type and Contant Definitions
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Persistent Variables
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boolean for interrupting the main thread loop
|
||||||
|
*/
|
||||||
|
bool isUdpListenerRunning = false;
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Internal Function Prototypes
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief This function is used to thread main execution function
|
||||||
|
*
|
||||||
|
* \param arg not used.
|
||||||
|
*
|
||||||
|
* \return NULL.
|
||||||
|
*/
|
||||||
|
static void *artnet_udp_handler(void *arg);
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* External Function Definitions
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Internal Function Definitions
|
||||||
|
**************************************************************************************************/
|
37
RpiLedBars/res/src/h.template
Normal file
37
RpiLedBars/res/src/h.template
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/** \file .h
|
||||||
|
* \brief This module
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__RPI_ARTNET_H__)
|
||||||
|
#define __RPI_ARTNET_H__
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Includes
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Preprocessor Constants and Macros
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Type and Contant Definitions
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* Global Variables
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/***************************************************************************************************
|
||||||
|
* External Function Prototypes
|
||||||
|
**************************************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Get last DMX data received for the specified universe
|
||||||
|
*
|
||||||
|
* \param[in] univerve The universe to get data from
|
||||||
|
*
|
||||||
|
* \param[out] dmxData The pointer to the DMX data array
|
||||||
|
*/
|
||||||
|
int artnet_get_dmx_data(unsigned int univerve, uint8_t *dmxData[]);
|
||||||
|
|
||||||
|
#endif /* __RPI_ARTNET_H__ */
|
@ -8,11 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef _WIN32
|
|
||||||
#include <Windows.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
pid_t cavaPid;
|
pid_t cavaPid;
|
||||||
pthread_t fifoReader;
|
pthread_t fifoReader;
|
||||||
@ -23,9 +19,9 @@ static void *fifo_to_buffer(void *arg);
|
|||||||
|
|
||||||
void setup_cava() {}
|
void setup_cava() {}
|
||||||
|
|
||||||
void close_cava() { stop_cava_bg_worker(); }
|
void close_cava() { cava_stop(); }
|
||||||
|
|
||||||
void start_cava_bg_worker() {
|
void cava_start() {
|
||||||
if ((cavaPid = fork()) == -1) {
|
if ((cavaPid = fork()) == -1) {
|
||||||
perror("fork");
|
perror("fork");
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -52,7 +48,7 @@ void start_cava_bg_worker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop_cava_bg_worker() {
|
void cava_stop() {
|
||||||
if (pthread_cancel(fifoReader) != 0) {
|
if (pthread_cancel(fifoReader) != 0) {
|
||||||
perror("pthread_cancel");
|
perror("pthread_cancel");
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@ int get_cava_buffer(uint16_t buffer_dst[20]);
|
|||||||
|
|
||||||
void close_cava();
|
void close_cava();
|
||||||
|
|
||||||
void start_cava_bg_worker();
|
void cava_start();
|
||||||
|
|
||||||
void stop_cava_bg_worker();
|
void cava_stop();
|
||||||
|
|
||||||
#endif /* __RPI_CAVA_H__ */
|
#endif /* __RPI_CAVA_H__ */
|
Loading…
Reference in New Issue
Block a user