formatting change.

This commit is contained in:
Jake Goodwin 2025-03-09 09:34:18 -07:00
parent 60a6cf345f
commit a7682c802a
2 changed files with 17 additions and 7 deletions

View file

@ -1,13 +1,13 @@
/*
* Author: Jake Goodwin
* Author: Jake Goodwin
* Date: 2025
* filename: ADC.c
* description:
* description:
*/
/*DEVNOTES:
* The CH32v003 micro-controllers have 8channels for the ADC that are
* external and 2 internal channels.
* The CH32v003 micro-controllers have 8channels for the ADC that are
* external and 2 internal channels.
*
* The channels/inputs are labeled as AIN0-AIN7
*/
@ -20,15 +20,15 @@
* A4 --> PD3
* A5 --> PD5
* 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.
*/
#include "ADC.h"
#include "RegEdit.h"
#include "ch32fun.h"
#include "ch32v003hw.h"
#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)
{
if (IsInvalidPin(pin_num))

View file

@ -27,6 +27,11 @@
*/
void ADC_Init(uint8_t pin_num);
/**
* @brief Enables the ADC
*/
void ADC_PowerOn(void);
/**
* @brief Enables the ADC
*/