CuVoodoo STM32F1 firmware template
Functions | Variables
global.c File Reference

global definitions and methods (code) More...

Go to the source code of this file.

Functions

char * b2s (uint64_t binary, uint8_t rjust)
 get binary representation of a number More...
 
void led_on (void)
 switch on board LED
 
void led_off (void)
 switch off board LED
 
void led_toggle (void)
 toggle board LED
 
void sleep_us (uint32_t duration)
 go to sleep for some microseconds More...
 
void sleep_ms (uint32_t duration)
 go to sleep for some milliseconds More...
 
void sys_tick_handler (void)
 SysTick interrupt handler.
 
char user_input_get (void)
 get user input More...
 
void user_input_store (char c)
 store user input More...
 
void board_setup (void)
 setup board peripherals
 

Variables

volatile bool button_flag = false
 flag set when board user button has been pressed/released
 
volatile bool user_input_available = false
 flag set when user input is available
 
static volatile uint8_t user_input_buffer [64] = {0}
 ring buffer for received data
 
static volatile uint8_t user_input_i = 0
 current position of read received data
 
static volatile uint8_t user_input_used = 0
 how much data has been received and not red
 
static volatile uint32_t sleep_duration = 0
 sleep duration count down (in SysTick interrupts)
 

Detailed Description

global definitions and methods (code)

Author
King Kévin kingk.nosp@m.evin.nosp@m.@cuvo.nosp@m.odoo.nosp@m..info
Date
2016-2017

Definition in file global.c.

Function Documentation

◆ b2s()

char* b2s ( uint64_t  binary,
uint8_t  rjust 
)

get binary representation of a number

Parameters
[in]binarynumber to represent in binary
[in]rjustjustify representation with leading zeros
Returns
string with binary representation of the number

Definition at line 45 of file global.c.

◆ sleep_ms()

void sleep_ms ( uint32_t  duration)

go to sleep for some milliseconds

Parameters
[in]durationsleep duration in ms

Definition at line 159 of file global.c.

◆ sleep_us()

void sleep_us ( uint32_t  duration)

go to sleep for some microseconds

Parameters
[in]durationsleep duration in us

Definition at line 144 of file global.c.

◆ user_input_get()

char user_input_get ( void  )

get user input

Note
verify availability using user_input_available
Warning
blocks and sleeps until user input is available
Returns
user input character

Definition at line 187 of file global.c.

◆ user_input_store()

void user_input_store ( char  c)

store user input

Parameters
[in]cuser input character to store
Note
old data will be overwritten when buffer is full

Definition at line 199 of file global.c.