aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKing Kévin <kingkevin@cuvoodoo.info>2020-10-07 13:19:09 +0200
committerKing Kévin <kingkevin@cuvoodoo.info>2020-10-07 13:19:09 +0200
commitc245295cc3dffcadcd48bb00a9b567af1347c6f6 (patch)
treedcd7d6b63f681cd5fdd8915fd3b60046528fbb4e
parent5758e46a723ff1a9de80ede73362d9becb8aaeac (diff)
fix type and spacing
-rw-r--r--pic/318LPW1K-L/318LPW1K-L.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/pic/318LPW1K-L/318LPW1K-L.c b/pic/318LPW1K-L/318LPW1K-L.c
index 8d6171b..58698fb 100644
--- a/pic/318LPW1K-L/318LPW1K-L.c
+++ b/pic/318LPW1K-L/318LPW1K-L.c
@@ -36,20 +36,20 @@
/* variables */
//volatile uint32_t code = 0; // the code to transmit (read from EEPROM)
-volatile int8_t transmit = 0; // transmitting (0: do not transmit, 1: transmit, -1: finish transmiting)
-volatile uint8_t phase = 0; // the 4 phases of the bit (2ms pause, 1ms pulse, 2ms pause, 1ms pulse. only transmit during one of the two pulse periode depending on the bit value)
+volatile int8_t transmit = 0; // transmitting (0: do not transmit, 1: transmit, -1: finish transmitting)
+volatile uint8_t phase = 0; // the 4 phases of the bit (2ms pause, 1ms pulse, 2ms pause, 1ms pulse. only transmit during one of the two pulse period depending on the bit value)
/* configuration bits
* all set (to 1) per default
* clear (to 0) relevant bits
*/
uint16_t __at(_CONFIG) __CONFIG = _CPD_OFF & // no data code protect
- _CP_OFF & // no code proect
+ _CP_OFF & // no code project
_BODEN_OFF & // no brown out detect
_MCLRE_OFF & // disable master clear reset
_PWRTE_ON & // enable power-up timeout
_WDTE_OFF & // no watchdog
- _INTRC_OSC_NOCLKOUT; // use internal oscilator and both I/O pins
+ _INTRC_OSC_NOCLKOUT; // use internal oscillator and both I/O pins
/* default code to transmit in EEPROM
a megacode is 3 bytes long (MSB of byte 1 is 1)
@@ -100,15 +100,15 @@ void megacode (void) {
led_on();
timer_2ms();
}
- } else if (bit==24) { // 25th bit is a blank
+ } else if (bit == 24) { // 25th bit is a blank
led_on();
tx_off();
timer_2ms();
} else { // restart after 25th bit
phase = 0xff; // phase will be 0 after incrementing
- if (transmit == -1) { // stop transmiting if requested
+ if (transmit == -1) { // stop transmitting if requested
led_off();
- transmit = 0; // stop transmiting
+ transmit = 0; // stop transmitting
}
timer_1ms();
}
@@ -116,23 +116,23 @@ void megacode (void) {
}
}
-/* initialize micro-conroller */
+/* initialize micro-controller */
void init (void) {
TRISIO |= SWITCH; // switch is input
WPU |= SWITCH; // enable pull-up on switch
NOT_GPPU = 0; // enable global weak pull-up for inputs
- TRISIO &= ~(LED_ANODE|LED_CATHODE|TX); // all other are outputs
- GPIO &= ~(LED_ANODE|LED_CATHODE|TX); // clear output
+ TRISIO &= ~(LED_ANODE | LED_CATHODE | TX); // all other are outputs
+ GPIO &= ~(LED_ANODE | LED_CATHODE | TX); // clear output
}
-// funcion called on interrupts
+// function called on interrupts
// interrupt 0 is only one on PIC12
static void interrupt(void) __interrupt 0
{
if (GPIF) { // pin state changed
- if (GPIO&SWITCH) { // switch is released stop transmission
+ if (GPIO & SWITCH) { // switch is released stop transmission
if (transmit == 1) {
- transmit = -1; // stop transmitting after last transmition
+ transmit = -1; // stop transmitting after last transmission
}
} else { // switch is pressed, start transmission
if (transmit == 0) { // only transmit if code is loaded
@@ -166,7 +166,7 @@ void main (void)
PIE1 = 1; // enable timer 1 interrupt
PEIE = 1; // enable timer interrupt
- if (read_eeprom(0)&0x80) { // verify if the code is programm (the MSB bit is always 1 for megacode codes)
+ if (read_eeprom(0) & 0x80) { // verify if the code is program (the MSB bit is always 1 for megacode codes)
GIE = 1; // globally enable interrupts
} else { // show error and got to sleep forever
led_on();