Update Firmware with features:
* Shellmatta implemented using UART * Version string implemented * Increased heap size * Add shellmatta printf support
This commit is contained in:
13
stm-firmware/include/shell.h
Normal file
13
stm-firmware/include/shell.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef __SHELL_H__
|
||||
#define __SHELL_H__
|
||||
|
||||
#include <stddef.h>
|
||||
#include <shellmatta.h>
|
||||
|
||||
shellmatta_handle_t shell_init(void);
|
||||
|
||||
void shell_handle_input(shellmatta_handle_t shell, const char *data, size_t len);
|
||||
|
||||
void shell_print_string(shellmatta_handle_t shell, const char *string);
|
||||
|
||||
#endif /* __SHELL_H__ */
|
@@ -1,6 +1,7 @@
|
||||
#ifndef __STM32GPIOMACROS_H__
|
||||
#define __STM32GPIOMACROS_H__
|
||||
|
||||
#define MODER_DELETE(pin) ~(0x3U << (pin * 2))
|
||||
#define OUTPUT(pin) (0x01U << (pin * 2))
|
||||
#define PULLUP(pin) (0x1U << (pin* 2))
|
||||
#define ALTFUNC(pin) ((0x2) << (pin * 2))
|
||||
|
@@ -1,4 +1,24 @@
|
||||
#ifndef __DMA_RING_BUFFER_H__
|
||||
#define __DMA_RING_BUFFER_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stm32f4xx.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct dma_ring_buffer {
|
||||
char *data_ptr;
|
||||
size_t buffer_count;
|
||||
DMA_Stream_TypeDef *dma;
|
||||
size_t get_idx;
|
||||
uint8_t base_dma_id;
|
||||
};
|
||||
|
||||
int dma_ring_buffer_initialize(struct dma_ring_buffer *dma_buffer, uint8_t base_dma_id, DMA_Stream_TypeDef *dma_stream, size_t buffer_element_count, char *data_buffer, void *src_reg, uint8_t dma_trigger_channel);
|
||||
int dma_ring_buffer_get_data(struct dma_ring_buffer *buff, const char **data_buff, size_t *len);
|
||||
|
||||
void dma_ring_buffer_stop(struct dma_ring_buffer *buff);
|
||||
|
||||
#endif /* __DMA_RING_BUFFER_H__ */
|
||||
|
||||
|
||||
|
||||
|
@@ -1,17 +1,51 @@
|
||||
/*
|
||||
* uart.h
|
||||
*
|
||||
* Created on: Dec 15, 2014
|
||||
* Author: shino-chan
|
||||
*/
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef UART_UART_H_
|
||||
#define UART_UART_H_
|
||||
|
||||
#define UART_RECEIVE_DMA_STREAM
|
||||
|
||||
#define UART_SEND_DMA_STREAM
|
||||
|
||||
#define UART_PORT_RCC_MASK RCC_AHB1ENR_GPIOAEN
|
||||
|
||||
#define UART_PORT GPIOA
|
||||
|
||||
#define UART_PERIPH USART1
|
||||
#define UART_RCC_MASK RCC_APB2ENR_USART1EN
|
||||
|
||||
#define UART_RX_PIN 10
|
||||
#define UART_TX_PIN 9
|
||||
#define UART_RX_PIN_ALTFUNC 7
|
||||
#define UART_TX_PIN_ALTFUNC 7
|
||||
|
||||
/* UART_DIV is 45.5625 => 115200 @ 84 MHz */
|
||||
#define UART_DIV_FRACTION 9U /* Equals 9/16 = 0.5625 */
|
||||
#define UART_DIV_MANTISSA 45U /* Equals 45 */
|
||||
|
||||
#define UART_BRR_REG_VALUE ((UART_DIV_MANTISSA<<4) | UART_DIV_FRACTION);
|
||||
|
||||
void initUART();
|
||||
void sendChar(char c);
|
||||
void sendString(char* s, int count);
|
||||
#ifdef _P20N_
|
||||
void yuri();
|
||||
#endif
|
||||
|
||||
|
||||
void uart_init_with_dma();
|
||||
|
||||
void uart_disable();
|
||||
|
||||
void uart_send_char(char c);
|
||||
|
||||
void uart_send_array(const char *data, uint32_t len);
|
||||
|
||||
void uart_send_string(char *string);
|
||||
|
||||
void uart_send_array_with_dma(char *data, uint32_t len);
|
||||
|
||||
void uart_send_string_with_dma(char *string);
|
||||
|
||||
int uart_receive_data_with_dma(const char **data, size_t *len);
|
||||
|
||||
|
||||
#endif /* UART_UART_H_ */
|
||||
|
Reference in New Issue
Block a user