+/rtos

git clone https://git.julia.blue/+/rtos

Joseph RyanAdd core temp reading413cd76

master
1.1 KiB48 linesraw
1#pragma once
2
3#include "tivaware/gpio.h"
4#include "tivaware/hw_gpio.h"
5#include "tivaware/hw_memmap.h"
6#include "tivaware/sysctl.h"
7#include <stdbool.h>
8#include <stdint.h>
9
10// Channel -> Pin mapping:
11// 0: PE3
12// 1: PE2
13// 2: PE1
14// 3: PE0
15// 4: PD3
16// 5: PD2
17// 6: PD1
18// 7: PD0
19// 8: PE4
20// 9: PE5
21// 10: PC6
22// 11: PC7
23
24// sets up a channel (0 to 11) and corresponding GPIO pin to be software
25// triggered for single samples using adc 0 sequence 3
26bool adc_init(uint8_t channel_num);
27
28// software trigger adc 0 sequence 3 and return 12 bit result
29uint16_t adc_in(void);
30
31// sets up adc 0 channel 0 sequence 2 to do software triggered temperature reads
32void temperature_init(void);
33
34// read temperature in degrees Farenheit
35float temperature(void);
36
37// uses adc 1 sequence 0 with the specified channel and timer to provide samples
38// at a consistent rate
39bool adc_timer_init(uint8_t channel_num, uint8_t timer_num, uint32_t period,
40                    uint8_t priority, void (*task)(uint16_t));
41
42typedef struct {
43    uint32_t port;
44    uint32_t port_base;
45    uint8_t pin;
46} ADCConfig;
47
48const ADCConfig adcs[12];