Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Code Examples for Padauk MCUs using the free-pdk toolchain
### Toolchain:
- The open-source [Small Device C Compiler (SDCC)](http://sdcc.sourceforge.net/)
- Requires version 3.9.0 or newer - version 4.0.0+ preferred
- **Some of the examples don't work with the neweset version of SDCC (4.4.0). Revert to SDCC 4.1.0 please**
- The open-source [Easy PDK Programmer](https://github.com/free-pdk/easy-pdk-programmer-software)
- Requires version 1.3 or newer
- The open-source [pdk-includes](https://github.com/free-pdk/pdk-includes) repository
Expand Down
2 changes: 1 addition & 1 deletion Serial_HelloWorld/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

DEVICE = PFS154
DEVICE = PFS173
F_CPU = 8000000
TARGET_VDD_MV = 4000
TARGET_VDD = 4.0
Expand Down
6 changes: 3 additions & 3 deletions SleepWake/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

DEVICE = PFS154
F_CPU = 70000
DEVICE = PFS173
F_CPU = 8000000
TARGET_VDD_MV = 4000
TARGET_VDD = 4.0

Expand All @@ -20,7 +20,7 @@ SOURCES = main.c
OBJECTS = $(patsubst %.c,$(BUILD_DIR)/%.rel,$(SOURCES))

# http://sdcc.sourceforge.net/doc/sdccman.pdf
COMPILE = sdcc -m$(ARCH) -c --std-sdcc11 --opt-code-size -D$(DEVICE) -DF_CPU=$(F_CPU) -DTARGET_VDD_MV=$(TARGET_VDD_MV) -I. -I$(ROOT_DIR)/include
COMPILE = sdcc -m$(ARCH) -c --std-sdcc11 --opt-code-size --fverbose-asm -D$(DEVICE) -DF_CPU=$(F_CPU) -DTARGET_VDD_MV=$(TARGET_VDD_MV) -I. -I$(ROOT_DIR)/include
LINK = sdcc -m$(ARCH)
EASYPDKPROG = easypdkprog

Expand Down
5 changes: 3 additions & 2 deletions SleepWake/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ void main(void) {
setup();

// Main processing loop
while (1) {
while (1)
{
for (int i = 0; i < 3; i++) {
turnLedOn();
_delay_ms(400);
turnLedOff();
_delay_ms(400);
}

sleep();
//sleep();
}
}

Expand Down
4 changes: 2 additions & 2 deletions include/delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ __asm
subc __delay_loop_16_PARM_1+1 ; 1 cycle
mov a, __delay_loop_16_PARM_1+0 ; 1 cycle
or a, __delay_loop_16_PARM_1+1 ; 1 cycle
t1sn f, z ; 1 cycle + 1 cycle for final skip
t1sn.io f, z ; 1 cycle + 1 cycle for final skip
goto 00001$ ; 2 cycles
// ret ; 2 cycles
__endasm;
Expand Down Expand Up @@ -88,7 +88,7 @@ __asm
or a, __delay_loop_32_PARM_1+1 ; 1 cycle
or a, __delay_loop_32_PARM_1+2 ; 1 cycle
or a, __delay_loop_32_PARM_1+3 ; 1 cycle
t1sn f, z ; 1 cycle + 1 cycle for final skip
t1sn.io f, z ; 1 cycle + 1 cycle for final skip
goto 00001$ ; 2 cycles
// ret ; 2 cycles
__endasm;
Expand Down
7 changes: 4 additions & 3 deletions include/pdk/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@

//macros so we can use defines in assembler strings
#define _STRINGIFY(x) #x
#define _STR(x) _STRINGIFY(x)
#define _STR_VAR(x) "_"_STRINGIFY(x)
#define _STR(x) _STRINGIFY(x)
#define _VAR(x) _ ## x
#define _ASMS(x) VAR(x)

//definitions for built in opcodes
#define __nop() __asm__("nop\n")
Expand All @@ -41,8 +42,8 @@
#define __stopexe() __asm__("stopexe\nnop\n")
#define __reset() __asm__("reset\n")
#define __wdreset() __asm__("wdreset\n")
#define __set0(var,bit) __asm__("set0 "_STR_VAR(var)", #"_STR(bit)"\n")
#define __set1(var,bit) __asm__("set1 "_STR_VAR(var)", #"_STR(bit)"\n")
#define __set0io(x,y) __asm__("set0.io "_STR_VAR(x)", #"_STR(y)"\n")
#define __set1io(x,y) __asm__("set1.io "_STR_VAR(x)", #"_STR(y)"\n")

// BIT definitions
#define BIT0 (1)
Expand Down
4 changes: 2 additions & 2 deletions include/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ void serial_setup() {
void serial_irq_handler() {
if (txdata) { // Does txdata contains bits to send?
if (txdata & 0x01) // Check bit (1/0) for sending
__set1(PA, SERIAL_TX_PIN); // Send 1 on TX Pin
__set1io(PA, 7); // Send 1 on TX Pin
else
__set0(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
__set0io(PA, SERIAL_TX_PIN); // Send 0 on TX Pin
txdata >>= 1; // Shift txdata
}
}
Expand Down