Compare commits

...

5 Commits

Author SHA1 Message Date
jakeg00dwin 73dee87190 Updated the project files a bit. 2024-07-15 12:13:55 -07:00
jakeg00dwin e5fa627c06 cleaned up comment spelling. 2024-07-15 12:13:38 -07:00
jakeg00dwin ab7bf961bc commented out 20MHz setup. 3.3Mhz with 6x divisor for the main clock works fine and saves power. 2024-07-15 12:13:28 -07:00
jakeg00dwin 4b014da8ac switched to only doing the samping, not using avrage, reduces needed instructions. 2024-07-15 12:12:53 -07:00
jakeg00dwin 09f214efbe white space changes. 2024-07-14 17:25:44 -07:00
6 changed files with 12 additions and 22 deletions

4
ADC.c
View File

@ -35,8 +35,8 @@ void ADC_Init(uint8_t pin_num)
RegEdit_SetBit((void *) &PORTA.OUTCLR, pin_num);
//Disable input buffer
//We do some kinda nasty address addition but it saves
//memory and means we don't need a switch statment.
//We do some kind of nasty address addition but it saves
//memory and means we don't need a switch statement.
//PORT_ISC_INPUT_DISABLE_gc
RegEdit_SetBit(
(void *) (&PORTA.PIN0CTRL)+pin_num,

4
load.c
View File

@ -16,9 +16,9 @@ void Load_HandleLoadPortA(uint8_t adc_pin, uint8_t out_pin)
ADC_Enable(adc_pin);
uint16_t val;
for(int i = 0; i < 32; i++){
val += ADC_ReadValue(adc_pin);
val = ADC_ReadValue(adc_pin);
}
val /= 32;
ADC_Disable();
if(val < 527 || val > 1000){
RegEdit_ClearBit((void *) &PORTA.OUT, out_pin);

7
main.c
View File

@ -9,7 +9,8 @@
* extracted into separate source files and headers for configuration.
*/
#define F_CPU 2000000UL
//#define F_CPU 2000000UL
#define F_CPU 3333333UL
//These defines are mostly useful for when you want you editors LSP server to
//function correctly.
@ -17,7 +18,7 @@
//#define __AVR_ATtiny404__
//#endif
//This can prevent issues with utils/delay.h library with the gcc toolchain
//This can prevent issues with util/delay.h library with the gcc toolchain
#define __DELAY_BACKWARD_COMPATIBLE__
#include "config.h"
@ -46,7 +47,7 @@ static void CLK_DisablePrescaler(void)
int main(int argc, char **argv)
{
CLK_DisablePrescaler();
//CLK_DisablePrescaler();
while(true){
for(int i = 0; i < GatePulsesQty; i++){
ZCD_Poll();

View File

@ -1,11 +1,11 @@
#
#Tue Jul 02 16:53:25 PDT 2024
#Mon Jul 15 11:39:10 PDT 2024
attiny404.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=8ed9aa4326bfc0c1a849e697826741b7
attiny404.languagetoolchain.version=2.46
attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
conf.ids=,attiny404
host.id=2ov5-ff4p-rv
configurations-xml=612d34b4ce82b1d02e7fec601f793556
configurations-xml=a8df58f0d8aebafa503466e35cdcf228
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin
proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X

View File

@ -212,8 +212,6 @@
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/debug/default/fg004a_ptg"/>
<property key="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>
@ -447,7 +445,7 @@
<property key="communication.speed" value="0.250"/>
<property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" value="Use system settings"/>
<property key="debugoptions.useswbreakpoints" value="true"/>
<property key="debugoptions.useswbreakpoints" value="false"/>
<property key="event.recorder.debugger.behavior" value="Running"/>
<property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/>
@ -467,8 +465,6 @@
<property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/>
<property key="programmerToGoFilePath"
value="/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/debug/attiny404/fg004a_ptg"/>
<property key="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/>

View File

@ -2,13 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/main.c</file>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/load.c</file>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/load.h</file>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/config.h</file>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/RegEdit.c</file>
<file>file:/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X/ADC.c</file>
</group>
<group/>
</open-files>
</project-private>