ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
|
Outputs a pulser and (one day will) measures pulses. More...
#include <libopencm3/cm3/cortex.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/dac.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/timer.h>
#include <libopencm3/stm32/usart.h>
#include "arm/stm_timers.h"
#include "arm/stm_usart.h"
#include "asc_exception.h"
#include "asc_helpers.h"
#include "ascii_serial_com.h"
#include "ascii_serial_com_device.h"
#include "ascii_serial_com_register_pointers.h"
#include "circular_buffer.h"
#include "millisec_timer.h"
Go to the source code of this file.
Macros | |
#define | ASC_USART_NO 2 |
#define | ASC_USART USART2 |
#define | PORT_LED GPIOA |
#define | PIN_LED GPIO5 |
#define | RCC_GPIO_LED RCC_GPIOA |
#define | TIM_LED TIM2 |
#define | TIM_OC_LED TIM_OC1 |
#define | RCC_TIM_LED RCC_TIM2 |
#define | AF_TIM_LED GPIO_AF2 |
#define | pulser_tick_freq 1000 |
#define | pulser_period 1000 |
#define | pulser_width 500 |
#define | IC_PORT GPIOA |
#define | IC_PIN GPIO8 |
#define | IC_RCC_GPIO RCC_GPIOA |
#define | IC_TIM TIM1 |
#define | IC_RCC_TIM RCC_TIM1 |
#define | IC_TI TIM_IC_IN_TI1 |
#define | IC_AF GPIO_AF2 |
#define | nRegs 10 |
Functions | |
DECLARE_ASC_DEVICE_W_REGISTER_POINTERS () uint8_t tmp_byte=0 | |
int | main (void) |
Variables | |
uint32_t | ic_pulse_length |
uint32_t | ic_period |
uint32_t | ic_overrun |
CEXCEPTION_T | e |
uint16_t | nExceptions |
MILLISEC_TIMER_SYSTICK_IT | |
uint32_t | optionFlags = 0 |
volatile REGTYPE * | register_map [nRegs] |
Register Map. | |
REGTYPE | register_write_masks [nRegs] |
Write masks for register_map. | |
Outputs a pulser and (one day will) measures pulses.
Outputs configurable pulses on the LED pin, PA5, which is "D13" on the Arduino connector
Reads input pulses on PA8, which is "D7" on the Arduino connector
Register map is documented at register_map
Definition in file stm32f091nucleo64_pulser.c.
#define AF_TIM_LED GPIO_AF2 |
Definition at line 43 of file stm32f091nucleo64_pulser.c.
#define ASC_USART USART2 |
Definition at line 35 of file stm32f091nucleo64_pulser.c.
#define ASC_USART_NO 2 |
Definition at line 34 of file stm32f091nucleo64_pulser.c.
#define IC_AF GPIO_AF2 |
Definition at line 57 of file stm32f091nucleo64_pulser.c.
#define IC_PIN GPIO8 |
Definition at line 52 of file stm32f091nucleo64_pulser.c.
#define IC_PORT GPIOA |
Definition at line 51 of file stm32f091nucleo64_pulser.c.
#define IC_RCC_GPIO RCC_GPIOA |
Definition at line 53 of file stm32f091nucleo64_pulser.c.
#define IC_RCC_TIM RCC_TIM1 |
Definition at line 55 of file stm32f091nucleo64_pulser.c.
#define IC_TI TIM_IC_IN_TI1 |
Definition at line 56 of file stm32f091nucleo64_pulser.c.
#define IC_TIM TIM1 |
Definition at line 54 of file stm32f091nucleo64_pulser.c.
#define nRegs 10 |
Definition at line 73 of file stm32f091nucleo64_pulser.c.
#define PIN_LED GPIO5 |
Definition at line 38 of file stm32f091nucleo64_pulser.c.
#define PORT_LED GPIOA |
Definition at line 37 of file stm32f091nucleo64_pulser.c.
#define pulser_period 1000 |
Definition at line 47 of file stm32f091nucleo64_pulser.c.
#define pulser_tick_freq 1000 |
Definition at line 46 of file stm32f091nucleo64_pulser.c.
#define pulser_width 500 |
Definition at line 48 of file stm32f091nucleo64_pulser.c.
#define RCC_GPIO_LED RCC_GPIOA |
Definition at line 39 of file stm32f091nucleo64_pulser.c.
#define RCC_TIM_LED RCC_TIM2 |
Definition at line 42 of file stm32f091nucleo64_pulser.c.
#define TIM_LED TIM2 |
Definition at line 40 of file stm32f091nucleo64_pulser.c.
#define TIM_OC_LED TIM_OC1 |
Definition at line 41 of file stm32f091nucleo64_pulser.c.
|
pure virtual |
Definition at line 155 of file stm32f091nucleo64_adc_streaming.c.
int main | ( | void | ) |
Definition at line 131 of file stm32f091nucleo64_pulser.c.
CEXCEPTION_T e |
Definition at line 64 of file stm32f091nucleo64_pulser.c.
uint32_t ic_overrun |
Definition at line 60 of file stm32f091nucleo64_pulser.c.
uint32_t ic_period |
Definition at line 59 of file stm32f091nucleo64_pulser.c.
uint32_t ic_pulse_length |
Definition at line 58 of file stm32f091nucleo64_pulser.c.
MILLISEC_TIMER_SYSTICK_IT |
Definition at line 67 of file stm32f091nucleo64_pulser.c.
uint16_t nExceptions |
Definition at line 65 of file stm32f091nucleo64_pulser.c.
uint32_t optionFlags = 0 |
Definition at line 71 of file stm32f091nucleo64_pulser.c.
volatile REGTYPE* register_map[nRegs] |
Register Map.
Register Number | Description | r/w |
---|---|---|
0 | PORTA input data register, bit 5 is LED | r |
1 | PORTA output data register, bit 5 is LED | r, bit 5 is w |
2 | optionFlags: see below | r/w |
3 | Current millisecond_timer value | r |
4 | LED pulser prescaler | r/w 16 bits |
5 | LED pulser period | r/w 16 bits |
6 | LED pulser pulse length | r/w 16 bits |
7 | Input capture pulse period | r |
8 | Input capture pulse width | r |
9 | Input capture overrun flags (bit 0 for period and 4 for width) | r |
Definition at line 95 of file stm32f091nucleo64_pulser.c.
REGTYPE register_write_masks[nRegs] |
Write masks for register_map.
These define whether the given register in register_map is writable or not
Definition at line 113 of file stm32f091nucleo64_pulser.c.