Compare commits
5 Commits
main
...
low_power_
Author | SHA1 | Date |
---|---|---|
jakeg00dwin | 73dee87190 | |
jakeg00dwin | e5fa627c06 | |
jakeg00dwin | ab7bf961bc | |
jakeg00dwin | 4b014da8ac | |
jakeg00dwin | 09f214efbe |
4
ADC.c
4
ADC.c
|
@ -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
4
load.c
|
@ -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);
|
||||||
|
|
7
main.c
7
main.c
|
@ -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.
|
||||||
|
@ -17,7 +18,7 @@
|
||||||
//#define __AVR_ATtiny404__
|
//#define __AVR_ATtiny404__
|
||||||
//#endif
|
//#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__
|
#define __DELAY_BACKWARD_COMPATIBLE__
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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"/>
|
||||||
|
|
|
@ -2,13 +2,6 @@
|
||||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
<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">
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||||
<group>
|
<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>
|
|
||||||
</open-files>
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
|
Loading…
Reference in New Issue