formatting change.
This commit is contained in:
parent
60a6cf345f
commit
a7682c802a
2 changed files with 17 additions and 7 deletions
|
@ -1,13 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Author: Jake Goodwin
|
* Author: Jake Goodwin
|
||||||
* Date: 2025
|
* Date: 2025
|
||||||
* filename: ADC.c
|
* filename: ADC.c
|
||||||
* description:
|
* description:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*DEVNOTES:
|
/*DEVNOTES:
|
||||||
* The CH32v003 micro-controllers have 8channels for the ADC that are
|
* The CH32v003 micro-controllers have 8channels for the ADC that are
|
||||||
* external and 2 internal channels.
|
* external and 2 internal channels.
|
||||||
*
|
*
|
||||||
* The channels/inputs are labeled as AIN0-AIN7
|
* The channels/inputs are labeled as AIN0-AIN7
|
||||||
*/
|
*/
|
||||||
|
@ -20,15 +20,15 @@
|
||||||
* A4 --> PD3
|
* A4 --> PD3
|
||||||
* A5 --> PD5
|
* A5 --> PD5
|
||||||
* A6 --> PD6
|
* A6 --> PD6
|
||||||
* A7 --> PD4
|
* A7 --> PD4
|
||||||
*
|
*
|
||||||
* Because they don't exactly match up, I'll need to write up my own
|
* Because they don't exactly match up, I'll need to write up my own
|
||||||
* way to do the mapping.
|
* way to do the mapping.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ADC.h"
|
#include "ADC.h"
|
||||||
#include "RegEdit.h"
|
#include "RegEdit.h"
|
||||||
#include "ch32fun.h"
|
#include "ch32v003hw.h"
|
||||||
|
|
||||||
#define MAX_PIN_NUM 7
|
#define MAX_PIN_NUM 7
|
||||||
|
|
||||||
|
@ -45,6 +45,11 @@ void ADC_Setup(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ADC_PowerOn(void)
|
||||||
|
{
|
||||||
|
RegEdit_SetBit((void *)&ADC1->CTLR2, ADC_ADON);
|
||||||
|
}
|
||||||
|
|
||||||
void ADC_Init(uint8_t pin_num)
|
void ADC_Init(uint8_t pin_num)
|
||||||
{
|
{
|
||||||
if (IsInvalidPin(pin_num))
|
if (IsInvalidPin(pin_num))
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
*/
|
*/
|
||||||
void ADC_Init(uint8_t pin_num);
|
void ADC_Init(uint8_t pin_num);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables the ADC
|
||||||
|
*/
|
||||||
|
void ADC_PowerOn(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enables the ADC
|
* @brief Enables the ADC
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue