1.1 --- a/init.h Thu Oct 18 22:45:55 2018 +0200
1.2 +++ b/init.h Thu Oct 18 22:55:28 2018 +0200
1.3 @@ -1,24 +1,51 @@
1.4 +/*
1.5 + * PIC32 peripheral configuration and initialisation.
1.6 + *
1.7 + * Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.8 + *
1.9 + * This program is free software: you can redistribute it and/or modify
1.10 + * it under the terms of the GNU General Public License as published by
1.11 + * the Free Software Foundation, either version 3 of the License, or
1.12 + * (at your option) any later version.
1.13 + *
1.14 + * This program is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + * GNU General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU General Public License
1.20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.21 + */
1.22 +
1.23 #ifndef __INIT_H__
1.24 #define __INIT_H__
1.25
1.26 #include "pic32_c.h"
1.27
1.28 +
1.29 +
1.30 /* Basic initialisation. */
1.31
1.32 void init_memory(void);
1.33 void init_pins(void);
1.34 void init_outputs(void);
1.35
1.36 +
1.37 +
1.38 /* Peripheral pin configuration. */
1.39
1.40 void config_uart(void);
1.41 void lock_config(void);
1.42 void unlock_config(void);
1.43
1.44 +
1.45 +
1.46 /* Convenience operations. */
1.47
1.48 void interrupts_on(void);
1.49
1.50 +
1.51 +
1.52 /* DMA configuration. */
1.53
1.54 void init_dma(void);
1.55 @@ -45,7 +72,9 @@
1.56
1.57 uint32_t DMA_IPC_PRI(int channel, uint8_t pri, uint8_t sub);
1.58
1.59 -/* Timer configuration. */
1.60 +
1.61 +
1.62 +/* Output compare configuration. */
1.63
1.64 void oc_init(int unit, uint8_t mode, int timer);
1.65
1.66 @@ -62,6 +91,8 @@
1.67 uint32_t OC_IPC_PRI(int unit, uint8_t pri, uint8_t sub);
1.68 uint32_t OC_IPC_REG(int unit);
1.69
1.70 +
1.71 +
1.72 /* Timer configuration. */
1.73
1.74 void timer_init(int timer, uint8_t prescale, uint16_t limit);
1.75 @@ -75,6 +106,8 @@
1.76 uint32_t TIMER_IPC_PRI(int timer, uint8_t pri, uint8_t sub);
1.77 uint32_t TIMER_IPC_REG(int timer);
1.78
1.79 +
1.80 +
1.81 /* UART configuration. */
1.82
1.83 void uart_init(int uart, uint32_t baudrate);