Indendation fixes and comments updated

This commit is contained in:
pwpiwi 2018-09-13 09:50:30 +02:00 committed by GitHub
commit 08a7ed661f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,8 +92,8 @@ static inline uint16_t rx_frame_from_fpga() {
// and averages the next (most stable) 8 samples. The final 8 samples are dropped // and averages the next (most stable) 8 samples. The final 8 samples are dropped
// also. // also.
// //
// The demedulated should be alligned to the bit period by the caller. This is // The demodulated should be alligned to the bit period by the caller. This is
// done in rx_bit_as_reader and rx_ack_as_reader. // done in rx_bit and rx_ack.
static inline bool rx_bit() { static inline bool rx_bit() {
int32_t sum_cq = 0; int32_t sum_cq = 0;
int32_t sum_ci = 0; int32_t sum_ci = 0;
@ -105,11 +105,11 @@ static inline bool rx_bit() {
// sample next 8 I/Q pairs // sample next 8 I/Q pairs
for(size_t i = 0; i<8; ++i) { for(size_t i = 0; i<8; ++i) {
uint16_t iq = rx_frame_from_fpga(); uint16_t iq = rx_frame_from_fpga();
int8_t ci = iq >> 8; int8_t ci = (int8_t)(iq >> 8);
int8_t cq = iq; int8_t cq = (int8_t)(iq & 0xff);
sum_ci += ci; sum_ci += ci;
sum_cq += cq; sum_cq += cq;
} }
// calculate power // calculate power
@ -129,12 +129,12 @@ static inline bool rx_bit() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
static inline void tx_bit(bool bit) { static inline void tx_bit(bool bit) {
// insert pause (modulate carrier, ssp_dout=1) // insert pause
HIGH(GPIO_SSC_DOUT); HIGH(GPIO_SSC_DOUT);
last_frame_end += RWD_TIME_PAUSE; last_frame_end += RWD_TIME_PAUSE;
while(GET_TICKS < last_frame_end) { }; while(GET_TICKS < last_frame_end) { };
// return to high (unmodulated carrier, ssp_dout = 0), wait for bit periode to end // return to carrier on, wait for bit periode to end
LOW(GPIO_SSC_DOUT); LOW(GPIO_SSC_DOUT);
last_frame_end += (bit ? RWD_TIME_1 : RWD_TIME_0) - RWD_TIME_PAUSE; last_frame_end += (bit ? RWD_TIME_1 : RWD_TIME_0) - RWD_TIME_PAUSE;
while(GET_TICKS < last_frame_end) { }; while(GET_TICKS < last_frame_end) { };
@ -164,7 +164,7 @@ static void tx_frame(uint32_t frame, uint8_t len) {
legic_prng_forward(1); legic_prng_forward(1);
}; };
// add pause (modulate carrier, ssp_dout = 1) to mark end of the frame // add pause to mark end of the frame
HIGH(GPIO_SSC_DOUT); HIGH(GPIO_SSC_DOUT);
last_frame_end += RWD_TIME_PAUSE; last_frame_end += RWD_TIME_PAUSE;
while(GET_TICKS < last_frame_end) { }; while(GET_TICKS < last_frame_end) { };