Compare commits

..

4 commits

5 changed files with 10 additions and 13 deletions

4
ADC.c
View file

@ -35,8 +35,8 @@ void ADC_Init(uint8_t pin_num)
RegEdit_SetBit((void *) &PORTA.OUTCLR, pin_num); RegEdit_SetBit((void *) &PORTA.OUTCLR, pin_num);
//Disable input buffer //Disable input buffer
//We do some kinda nasty address addition but it saves //We do some kind of nasty address addition but it saves
//memory and means we don't need a switch statment. //memory and means we don't need a switch statement.
//PORT_ISC_INPUT_DISABLE_gc //PORT_ISC_INPUT_DISABLE_gc
RegEdit_SetBit( RegEdit_SetBit(
(void *) (&PORTA.PIN0CTRL)+pin_num, (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); ADC_Enable(adc_pin);
uint16_t val; uint16_t val;
for(int i = 0; i < 32; i++){ for(int i = 0; i < 32; i++){
val += ADC_ReadValue(adc_pin); val = ADC_ReadValue(adc_pin);
} }
val /= 32;
ADC_Disable(); ADC_Disable();
if(val < 527 || val > 1000){ if(val < 527 || val > 1000){
RegEdit_ClearBit((void *) &PORTA.OUT, out_pin); RegEdit_ClearBit((void *) &PORTA.OUT, out_pin);

5
main.c
View file

@ -9,7 +9,8 @@
* extracted into separate source files and headers for configuration. * 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 //These defines are mostly useful for when you want you editors LSP server to
//function correctly. //function correctly.
@ -46,7 +47,7 @@ static void CLK_DisablePrescaler(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
CLK_DisablePrescaler(); //CLK_DisablePrescaler();
while(true){ while(true){
for(int i = 0; i < GatePulsesQty; i++){ for(int i = 0; i < GatePulsesQty; i++){
ZCD_Poll(); 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.com-microchip-mplab-mdbcore-PK5Tool-PK5ToolImpl.md5=8ed9aa4326bfc0c1a849e697826741b7
attiny404.languagetoolchain.version=2.46 attiny404.languagetoolchain.version=2.46
attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d attiny404.com-microchip-mplab-nbide-toolchain-xc8-XC8LanguageToolchain.md5=bf89cdcdd6c0a49174fe4b605ef2b42d
conf.ids=,attiny404 conf.ids=,attiny404
host.id=2ov5-ff4p-rv host.id=2ov5-ff4p-rv
configurations-xml=612d34b4ce82b1d02e7fec601f793556 configurations-xml=a8df58f0d8aebafa503466e35cdcf228
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321 com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=f612087c95360c842296d189edfe3321
attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin attiny404.languagetoolchain.dir=/opt/microchip/xc8/v2.46/bin
proj.dir=/home/ronin/Documents/projects/freelance/laith_naaman/fg004a.X 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" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/> <property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/> <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="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/> <property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/> <property key="programoptions.eraseb4program" value="true"/>
@ -447,7 +445,7 @@
<property key="communication.speed" value="0.250"/> <property key="communication.speed" value="0.250"/>
<property key="debugoptions.debug-startup" value="Use system settings"/> <property key="debugoptions.debug-startup" value="Use system settings"/>
<property key="debugoptions.reset-behaviour" 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.debugger.behavior" value="Running"/>
<property key="event.recorder.enabled" value="false"/> <property key="event.recorder.enabled" value="false"/>
<property key="event.recorder.scvd.files" value=""/> <property key="event.recorder.scvd.files" value=""/>
@ -467,8 +465,6 @@
<property key="memories.programmemory" value="true"/> <property key="memories.programmemory" value="true"/>
<property key="memories.programmemory.ranges" value="0-7ff"/> <property key="memories.programmemory.ranges" value="0-7ff"/>
<property key="poweroptions.powerenable" value="true"/> <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="programmerToGoImageName" value="fg004a_ptg"/>
<property key="programoptions.donoteraseauxmem" value="false"/> <property key="programoptions.donoteraseauxmem" value="false"/>
<property key="programoptions.eraseb4program" value="true"/> <property key="programoptions.eraseb4program" value="true"/>