WIP code
Builds, but is not yet usable in any way nor is anything tested. This includes ADC reading, basic RGBLED control, and init code. Still need to do probe, user IO including mode select and settings, RGBLED programs, and more.
This commit is contained in:
10
include/adc.h
Normal file
10
include/adc.h
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
/*
|
||||
* adc.c: probe, user config, and user IO (switch and button) reading
|
||||
*
|
||||
* file creation: 20231016 0102
|
||||
*/
|
||||
|
||||
|
||||
void adc_init();
|
||||
void adc_next();
|
||||
20
include/led.h
Normal file
20
include/led.h
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
/*
|
||||
* led.h: rgbled (and piezo) routines
|
||||
*
|
||||
* file creation: 20231015 0059
|
||||
*/
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
void led_init();
|
||||
void led_next();
|
||||
|
||||
void led_mode_rgb();
|
||||
void led_mode_buzzer();
|
||||
|
||||
void led_setrgb(uint8_t i, uint16_t r, uint16_t g, uint16_t b);
|
||||
void led_buzz(uint8_t buzz);
|
||||
34
include/py32f0xx_conf.h
Normal file
34
include/py32f0xx_conf.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef _INC_PY32F00X_CONF_H_
|
||||
#define _INC_PY32F00X_CONF_H_
|
||||
|
||||
|
||||
|
||||
#include <py32f0xx.h>
|
||||
|
||||
// low level libs
|
||||
#include "py32f0xx_ll_adc.h"
|
||||
#include "py32f0xx_ll_bus.h"
|
||||
//#include "py32f0xx_ll_comp.h"
|
||||
#include "py32f0xx_ll_cortex.h"
|
||||
//#include "py32f0xx_ll_crc.h"
|
||||
#include "py32f0xx_ll_dma.h"
|
||||
//#include "py32f0xx_ll_exti.h"
|
||||
#include "py32f0xx_ll_flash.h"
|
||||
#include "py32f0xx_ll_gpio.h"
|
||||
//#include "py32f0xx_ll_iwdg.h"
|
||||
#include "py32f0xx_ll_i2c.h"
|
||||
//#include "py32f0xx_ll_led.h"
|
||||
//#include "py32f0xx_ll_lptim.h"
|
||||
//#include "py32f0xx_ll_pwr.h"
|
||||
#include "py32f0xx_ll_rcc.h"
|
||||
//#include "py32f0xx_ll_rtc.h"
|
||||
//#include "py32f0xx_ll_spi.h"
|
||||
#include "py32f0xx_ll_system.h"
|
||||
#include "py32f0xx_ll_tim.h"
|
||||
//#include "py32f0xx_ll_usart.h"
|
||||
#include "py32f0xx_ll_utils.h"
|
||||
//#include "py32f0xx_ll_wwdg.h"
|
||||
|
||||
|
||||
|
||||
#endif /* _INC_PY32F00X_CONF_H */
|
||||
48
include/py32f0xx_it.h
Normal file
48
include/py32f0xx_it.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file py32f0xx_it.h
|
||||
* @author MCU Application Team
|
||||
* @brief This file contains the headers of the interrupt handlers.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) Puya Semiconductor Co.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2016 STMicroelectronics.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* This software component is licensed by ST under BSD 3-Clause license,
|
||||
* the "License"; You may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at:
|
||||
* opensource.org/licenses/BSD-3-Clause
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __PY32F0XX_IT_H
|
||||
#define __PY32F0XX_IT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void NMI_Handler(void);
|
||||
void HardFault_Handler(void);
|
||||
void SVC_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PY32F0XX_IT_H */
|
||||
|
||||
/************************ (C) COPYRIGHT Puya *****END OF FILE******************/
|
||||
80
include/testo.h
Normal file
80
include/testo.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* testo.h: test-o hardware configuration
|
||||
*
|
||||
* file creation: 20231015 0021
|
||||
*/
|
||||
|
||||
|
||||
#include "py32f0xx_conf.h"
|
||||
|
||||
|
||||
|
||||
#define CONF_SET1_PORT GPIOA
|
||||
#define CONF_SET1_PIN 0 // analog-input
|
||||
#define CONF_SET1_AN ADC_CHSELR_CHSEL0
|
||||
|
||||
#define VREF_IN_PORT GPIOA
|
||||
#define VREF_IN_PIN 0 // anlog-input
|
||||
#define VREF_IN_AN ADC_CHSELR_CHSEL0
|
||||
|
||||
#define PROBE_PORT GPIOA
|
||||
#define PROBE_PIN 1 // analog-input
|
||||
#define PROBE_AN ADC_CHSELR_CHSEL1
|
||||
|
||||
#define I2C_PORT GPIOA
|
||||
#define I2C_DEV I2C1
|
||||
#define I2C_AF LL_GPIO_AF12_I2C
|
||||
#define I2C_IRQn I2C1_IRQn
|
||||
#define I2C_SDA_PIN 2 // alt-func
|
||||
#define I2C_SCL_PIN 3 // alt-func
|
||||
|
||||
#define RGB_PORT GPIOA
|
||||
#define RGB_B_PIN 4 // alt-func
|
||||
#define RGB_G_PIN 5 // alt-func
|
||||
#define RGB_R_PIN 6 // alt-func
|
||||
#define TIM_RGB TIM3
|
||||
#define TIM_RGB_B_CH LL_TIM_CHANNEL_CH3
|
||||
#define TIM_RGB_G_CH LL_TIM_CHANNEL_CH2
|
||||
#define TIM_RGB_R_CH LL_TIM_CHANNEL_CH1
|
||||
#define PWM_RGB_B TIM_RGB->CCR3
|
||||
#define PWM_RGB_G TIM_RGB->CCR2
|
||||
#define PWM_RGB_R TIM_RGB->CCR1
|
||||
|
||||
#define CONF_MODE_PORT GPIOA
|
||||
#define CONF_MODE_PIN 7 // analog-input
|
||||
#define CONF_MODE_AN ADC_CHSELR_CHSEL7
|
||||
|
||||
#define RGBSEL0_PORT GPIOA
|
||||
#define RGBSEL0_PIN 12 // output, default low
|
||||
|
||||
#define UART_PORT GPIOA
|
||||
#define UART_DEV USART1
|
||||
#define UART_IRQN USART1_IRQn
|
||||
#define UART_RX_PIN 13 // alt-func (if used)
|
||||
#define UART_RX_AF LL_GPIO_AF8_USART1
|
||||
#define UART_TX_PIN 14 // alt-func (if used)
|
||||
#define UART_TX_AF LL_GPIO_AF1_USART1
|
||||
|
||||
|
||||
#define CONF_SET0_PORT GPIOB
|
||||
#define CONF_SET0_PIN 0 // analog-input
|
||||
#define CONF_SET0_AN ADC_CHSELR_CHSEL8
|
||||
|
||||
#define RGBSEL1_PORT GPIOB
|
||||
#define RGBSEL1_PIN 1 // output, default low
|
||||
|
||||
|
||||
#define PROBESEL_PORT GPIOF
|
||||
#define PROBESEL_PIN 2 // output, default high
|
||||
|
||||
|
||||
#define ADC_SET0 3
|
||||
#define ADC_SET1 0
|
||||
#define ADC_SET_MODE 2
|
||||
|
||||
#define ADC_PROBE 1
|
||||
|
||||
#define ADC_VREF_INT 5
|
||||
#define ADC_VREF_EXT 0
|
||||
#define ADC_THERM 4
|
||||
|
||||
Reference in New Issue
Block a user