[stm32f429-discovery] General sweep to fix style according to make stylecheck.
This commit is contained in:
@@ -41,10 +41,10 @@
|
||||
* read by the program. See the README file for a discussion of
|
||||
* the failure semantics.
|
||||
*/
|
||||
#define RECV_BUF_SIZE 128 // Arbitrary buffer size
|
||||
#define RECV_BUF_SIZE 128 /* Arbitrary buffer size */
|
||||
char recv_buf[RECV_BUF_SIZE];
|
||||
volatile int recv_ndx_nxt; // Next place to store
|
||||
volatile int recv_ndx_cur; // Next place to read
|
||||
volatile int recv_ndx_nxt; /* Next place to store */
|
||||
volatile int recv_ndx_cur; /* Next place to read */
|
||||
|
||||
/* For interrupt handling we add a new function which is called
|
||||
* when recieve interrupts happen. The name (usart1_isr) is created
|
||||
@@ -57,7 +57,8 @@ volatile int recv_ndx_cur; // Next place to read
|
||||
* right or it won't work. And you'll wonder where your interrupts
|
||||
* are going.
|
||||
*/
|
||||
void usart1_isr(void) {
|
||||
void usart1_isr(void)
|
||||
{
|
||||
uint32_t reg;
|
||||
int i;
|
||||
|
||||
@@ -79,7 +80,8 @@ void usart1_isr(void) {
|
||||
recv_ndx_nxt = i;
|
||||
}
|
||||
}
|
||||
} while ((reg & USART_SR_RXNE) != 0); // can read back-to-back interrupts
|
||||
} while ((reg & USART_SR_RXNE) != 0); /* can read back-to-back
|
||||
interrupts */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -88,7 +90,8 @@ void usart1_isr(void) {
|
||||
* Send the character 'c' to the USART, wait for the USART
|
||||
* transmit buffer to be empty first.
|
||||
*/
|
||||
void console_putc(char c) {
|
||||
void console_putc(char c)
|
||||
{
|
||||
uint32_t reg;
|
||||
do {
|
||||
reg = USART_SR(CONSOLE_UART);
|
||||
@@ -106,10 +109,11 @@ void console_putc(char c) {
|
||||
* The implementation is a bit different however, now it looks
|
||||
* in the ring buffer to see if a character has arrived.
|
||||
*/
|
||||
char console_getc(int wait) {
|
||||
char console_getc(int wait)
|
||||
{
|
||||
char c = 0;
|
||||
|
||||
while ((wait != 0) && (recv_ndx_cur == recv_ndx_nxt)) ;
|
||||
while ((wait != 0) && (recv_ndx_cur == recv_ndx_nxt));
|
||||
if (recv_ndx_cur != recv_ndx_nxt) {
|
||||
c = recv_buf[recv_ndx_cur];
|
||||
recv_ndx_cur = (recv_ndx_cur + 1) % RECV_BUF_SIZE;
|
||||
@@ -124,7 +128,8 @@ char console_getc(int wait) {
|
||||
* after the last character, as indicated by a NUL character, is
|
||||
* reached.
|
||||
*/
|
||||
void console_puts(char *s) {
|
||||
void console_puts(char *s)
|
||||
{
|
||||
while (*s != '\000') {
|
||||
console_putc(*s);
|
||||
/* Add in a carraige return, after sending line feed */
|
||||
@@ -142,7 +147,8 @@ void console_puts(char *s) {
|
||||
* support for editing characters (back space and delete)
|
||||
* end when a <CR> character is received.
|
||||
*/
|
||||
int console_gets(char *s, int len) {
|
||||
int console_gets(char *s, int len)
|
||||
{
|
||||
char *t = s;
|
||||
char c;
|
||||
|
||||
@@ -165,7 +171,7 @@ int console_gets(char *s, int len) {
|
||||
/* update end of string with NUL */
|
||||
*t = '\000';
|
||||
}
|
||||
return (t - s);
|
||||
return t - s;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -174,7 +180,8 @@ int console_gets(char *s, int len) {
|
||||
* Set the pins and clocks to create a console that we can
|
||||
* use for serial messages and getting text from the user.
|
||||
*/
|
||||
void console_setup(int baud) {
|
||||
void console_setup(int baud)
|
||||
{
|
||||
|
||||
/* MUST enable the GPIO clock in ADDITION to the USART clock */
|
||||
rcc_periph_clock_enable(RCC_GPIOA);
|
||||
|
||||
Reference in New Issue
Block a user