document static variables/methods

This commit is contained in:
King Kévin 2016-03-25 11:42:41 +01:00
parent d171eaa2bc
commit 6f26bd0e96
5 changed files with 50 additions and 28 deletions

View File

@ -404,19 +404,19 @@ EXTRACT_ALL = NO
# be included in the documentation.
# The default value is: NO.
EXTRACT_PRIVATE = NO
EXTRACT_PRIVATE = YES
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
EXTRACT_PACKAGE = NO
EXTRACT_PACKAGE = YES
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
# included in the documentation.
# The default value is: NO.
EXTRACT_STATIC = NO
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO

View File

@ -77,7 +77,7 @@
#define WS2812B_SPI_TEMPLATE 0x92492400
uint8_t ws2812b_data[WS2812B_LEDS*3*3+40*3/8] = {0}; /**< data encoded to be shifted out by SPI for the WS2812b, pulse the 50us reset */
static volatile bool transmit_flag = false; // is transmission ongoing
static volatile bool transmit_flag = false; /**< flag set in software when transmission started, clear by interrupt when transmission completed */
void ws2812b_set_rgb(uint16_t led, uint8_t red, uint8_t green, uint8_t blue)
{

View File

@ -48,12 +48,12 @@
#define USART_BAUDRATE 115200 /**< serial baudrate, in bits per second (with 8N1 8 bits, no parity bit, 1 stop bit settings) */
/* input and output ring buffer, indexes, and available memory */
static uint8_t rx_buffer[USART_BUFFER] = {0};
static volatile uint8_t rx_i = 0;
static volatile uint8_t rx_used = 0;
static uint8_t tx_buffer[USART_BUFFER] = {0};
static volatile uint8_t tx_i = 0;
static volatile uint8_t tx_used = 0;
static uint8_t rx_buffer[USART_BUFFER] = {0}; /**< ring buffer for received data */
static volatile uint8_t rx_i = 0; /**< current position of read received data */
static volatile uint8_t rx_used = 0; /**< how much data has been received and not red */
static uint8_t tx_buffer[USART_BUFFER] = {0}; /**< ring buffer for data to transmit */
static volatile uint8_t tx_i = 0; /**< current position if transmitted data */
static volatile uint8_t tx_used = 0; /**< how much data needs to be transmitted */
volatile uint8_t usart_received = 0; // same as rx_used, but since the user can write this variable we don't rely on it
void usart_setup(void)

View File

@ -86,6 +86,7 @@ static const struct usb_endpoint_descriptor communication_endpoints[] = {{
}};
/** @brief USB CDC ACM functional descriptor
* @return
* @note as defined in USB CDC specification section 5.2.3
*/
static const struct {
@ -198,12 +199,12 @@ static uint8_t usbd_control_buffer[128];
static usbd_device *usb_device;
/* input and output ring buffer, indexes, and available memory */
static uint8_t rx_buffer[CDCACM_BUFFER] = {0};
static volatile uint8_t rx_i = 0;
static volatile uint8_t rx_used = 0;
static uint8_t tx_buffer[CDCACM_BUFFER] = {0};
static volatile uint8_t tx_i = 0;
static volatile uint8_t tx_used = 0;
static uint8_t rx_buffer[CDCACM_BUFFER] = {0}; /**< ring buffer for received data */
static volatile uint8_t rx_i = 0; /**< current position of read received data */
static volatile uint8_t rx_used = 0; /**< how much data has been received and not red */
static uint8_t tx_buffer[CDCACM_BUFFER] = {0}; /**< ring buffer for data to transmit */
static volatile uint8_t tx_i = 0; /**< current position if transmitted data */
static volatile uint8_t tx_used = 0; /**< how much data needs to be transmitted */
volatile uint8_t cdcacm_received = 0; // same as rx_used, but since the user can write this variable we don't rely on it
/** @brief disconnect USB by pulling down D+ to for re-enumerate */
@ -231,6 +232,12 @@ static void usb_disconnect(void)
}
/** @brief incoming USB CDC ACM control request
* @param[in] usbd_dev USB device descriptor
* @param[in] req control request information
* @param[in] buf control request data
* @param[in] len control request data length
* @param[in] complete not used
* @return 0 if succeeded, error else
* @note resets device when configured with 5 bits
*/
static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void (**complete)(usbd_device *usbd_dev, struct usb_setup_data *req))
@ -275,6 +282,10 @@ static int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *
return 0;
}
/** @brief USB CDC ACM data received callback
* @param[in] usbd_dev USB device descriptor
* @param[in] ep endpoint where data came in
*/
static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep)
{
(void)ep;
@ -294,6 +305,10 @@ static void cdcacm_data_rx_cb(usbd_device *usbd_dev, uint8_t ep)
}
}
/** @brief USB CDC ACM data transmitted callback
* @param[in] usbd_dev USB device descriptor
* @param[in] ep endpoint where data came in
*/
static void cdcacm_data_tx_cb(usbd_device *usbd_dev, uint8_t ep)
{
(void)ep;
@ -316,6 +331,10 @@ static void cdcacm_data_tx_cb(usbd_device *usbd_dev, uint8_t ep)
}
}
/** @brief set USB CDC ACM configuration
* @param[in] usbd_dev USB device descriptor
* @param[in] wValue not used
*/
static void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue)
{
(void)wValue;

27
main.c
View File

@ -70,7 +70,6 @@ const uint32_t ticks_midday = 12*60*60*TICKS_PER_SECOND;
/** RGB values for the WS2812b clock LEDs */
uint8_t clock_leds[WS2812B_LEDS*3] = {0};
/** @brief default printf output */
int _write(int file, char *ptr, int len)
{
int i;
@ -90,7 +89,6 @@ int _write(int file, char *ptr, int len)
return -1;
}
/** @brief switch on board LED */
void led_on(void)
{
#ifdef SYSTEM_BOARD
@ -100,7 +98,6 @@ void led_on(void)
#endif
}
/** @brief switch off board LED */
void led_off(void)
{
#ifdef SYSTEM_BOARD
@ -110,13 +107,14 @@ void led_off(void)
#endif
}
/** @brief toggle board LED */
void led_toggle(void)
{
gpio_toggle(LED_PORT, LED_PIN);
}
/* switch off all clock LEDs */
/** @brief switch off all clock LEDs
* @note LEDs need to be set separately
*/
static void clock_clear(void)
{
// set all colors of all LEDs to 0
@ -125,7 +123,9 @@ static void clock_clear(void)
}
}
/* set hours mark on clock LEDs */
/** @brief set hours mark on clock LEDs
* @note LEDs need to be set separately
*/
static void clock_hours(void)
{
for (uint8_t hour=0; hour<12; hour++) {
@ -136,11 +136,11 @@ static void clock_hours(void)
}
}
/* show time on LED clock
* show hours and minutes progress as full arcs
* show second position as marker
* the brightness of the LED shows the progress of the unit
* hours are blue, minutes green, seconds red */
/** @brief show time on LED clock
* @param[in] time in ticks to show
* @details show hours and minutes progress as full arcs, show second position as marker. the brightness of the LED shows the progress of the unit. hours are blue, minutes green, seconds red
* @note LEDs need to be set separately
*/
static void clock_show_time(uint32_t time)
{
uint32_t led_hour = (WS2812B_LEDS*(255*(uint64_t)(time%ticks_midday)))/ticks_midday; // scale to LED brightnesses for hours
@ -212,7 +212,10 @@ static void clock_show_time(uint32_t time)
clock_leds[((led_second-1)%WS2812B_LEDS)*3+2] = 0;
}
/* set the LEDs */
/** @brief set the LEDs
* @details set the LED colors on WS2812b LEDs
* @note WS2812b LED color values need to be transmitted separately
*/
static void leds_set(void)
{
for (uint16_t i=0; i<LENGTH(clock_leds)/3; i++) {